mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-05 18:23:48 +00:00
build
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_KEY=base64:X7/vUveJtTmrC1J+UFXb9m6l1RBbAoJvNyj7sMC+GFI=
|
||||
APP_KEY=base64:Rv3QVmDH6npEiVy+pKyyjWYyTJfMvsQdFZ2YA7hAclg=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
APP_DEMO=false
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'version' => '2.0.8',
|
||||
'version' => '2.0.9',
|
||||
|
||||
'is_demo' => env('APP_DEMO', false),
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ use Domain\Homepage\Controllers\IndexController;
|
||||
use Domain\Invoices\Controllers\GetInvoiceController;
|
||||
use Domain\Settings\Controllers\DownloadLogController;
|
||||
use App\Socialite\Controllers\SocialiteCallbackController;
|
||||
use Domain\Sharing\Controllers\DirectlyDownloadFileController;
|
||||
use Domain\Sharing\Controllers\SharePublicIndexController;
|
||||
use Domain\Sharing\Controllers\WebCrawlerOpenGraphController;
|
||||
use Domain\Sharing\Controllers\DirectlyDownloadFileController;
|
||||
use Domain\Localization\Controllers\CurrentLocalizationController;
|
||||
|
||||
Route::get('/socialite/{provider}/callback', SocialiteCallbackController::class);
|
||||
|
||||
@@ -223,7 +223,6 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
});
|
||||
|
||||
static::updating(function ($user) {
|
||||
|
||||
// Prevent to set 2fa in demo mode
|
||||
if (config('vuefilemanager.is_demo') && $user->email === 'howdy@hi5ve.digital') {
|
||||
$user->two_factor_secret = null;
|
||||
|
||||
@@ -36,8 +36,8 @@ class UserResource extends JsonResource
|
||||
'avatar' => $this->settings->avatar,
|
||||
'email' => is_demo() ? obfuscate_email($this->email) : $this->email,
|
||||
'role' => $this->role,
|
||||
'two_factor_authentication' => (bool)$this->two_factor_secret,
|
||||
'socialite_account' => !(bool)$this->password,
|
||||
'two_factor_authentication' => (bool) $this->two_factor_secret,
|
||||
'socialite_account' => ! (bool) $this->password,
|
||||
'storage' => $this->storage,
|
||||
'created_at' => format_date($this->created_at, 'd. M. Y'),
|
||||
'updated_at' => format_date($this->updated_at, 'd. M. Y'),
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace Domain\Admin\Controllers\Dashboard;
|
||||
|
||||
use ByteUnits\Metric;
|
||||
@@ -68,18 +67,18 @@ class GetDashboardDataController extends Controller
|
||||
DB::raw('sum(download) as download'),
|
||||
DB::raw('sum(upload) as upload'),
|
||||
])
|
||||
->each(fn($record) => $record->date = format_date($record->date, 'd. M. Y'))
|
||||
->each(fn ($record) => $record->date = format_date($record->date, 'd. M. Y'))
|
||||
->keyBy('date');
|
||||
|
||||
$mappedTrafficRecords = mapTrafficRecords($trafficRecords);
|
||||
|
||||
$upload = $mappedTrafficRecords->map(fn($record) => [
|
||||
$upload = $mappedTrafficRecords->map(fn ($record) => [
|
||||
'created_at' => $record->date,
|
||||
'percentage' => intval($trafficRecords->max('upload')) !== 0 ? round(($record->upload / $trafficRecords->max('upload')) * 100, 2) : 0,
|
||||
'amount' => Metric::bytes($record->upload)->format(),
|
||||
]);
|
||||
|
||||
$download = $mappedTrafficRecords->map(fn($record) => [
|
||||
$download = $mappedTrafficRecords->map(fn ($record) => [
|
||||
'created_at' => $record->date,
|
||||
'percentage' => intval($trafficRecords->max('download')) !== 0 ? round(($record->download / $trafficRecords->max('download')) * 100, 2) : 0,
|
||||
'amount' => Metric::bytes($record->download)->format(),
|
||||
@@ -128,6 +127,7 @@ class GetDashboardDataController extends Controller
|
||||
$activeTranslationsCount = DB::table('language_translations')
|
||||
->where('lang', 'en')
|
||||
->count();
|
||||
return array($originalTranslationCount, $activeTranslationsCount);
|
||||
|
||||
return [$originalTranslationCount, $activeTranslationsCount];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Domain\Admin\Requests\DeleteUserRequest;
|
||||
use Domain\Admin\Actions\DeleteUserDataAction;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class DeleteUserController extends Controller
|
||||
{
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
namespace Domain\Files\Controllers\FileAccess;
|
||||
|
||||
use Gate;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Domain\Files\Models\File;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Domain\Files\Models\File;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Domain\Files\Actions\DownloadFileAction;
|
||||
use Domain\Traffic\Actions\RecordDownloadAction;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
|
||||
@@ -4,9 +4,9 @@ namespace Domain\Files\Controllers\FileAccess;
|
||||
use Gate;
|
||||
use Illuminate\Http\Request;
|
||||
use Domain\Files\Models\File;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Domain\Files\Actions\DownloadThumbnailAction;
|
||||
use Illuminate\Http\Response;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
||||
|
||||
@@ -14,13 +14,13 @@ class GetThumbnailController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private DownloadThumbnailAction $downloadThumbnail,
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
public function __invoke(
|
||||
Request $request,
|
||||
string $filename,
|
||||
): FileNotFoundException | StreamedResponse | Response {
|
||||
|
||||
// Get requested thumbnail
|
||||
$file = File::withTrashed()
|
||||
->where('basename', substr($filename, 3))
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
namespace Domain\Files\Controllers\FileAccess;
|
||||
|
||||
use Domain\Files\Models\File;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Response;
|
||||
use Domain\Sharing\Models\Share;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Domain\Files\Actions\DownloadFileAction;
|
||||
use Domain\Traffic\Actions\RecordDownloadAction;
|
||||
use Domain\Sharing\Actions\ProtectShareRecordAction;
|
||||
use Domain\Sharing\Actions\VerifyAccessToItemWithinAction;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
use Domain\Sharing\Actions\VerifyAccessToItemWithinAction;
|
||||
|
||||
/**
|
||||
* Get file public
|
||||
|
||||
@@ -3,8 +3,8 @@ namespace Domain\Folders\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Collection;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class FavouriteController extends Controller
|
||||
|
||||
@@ -11,7 +11,8 @@ class SendContactMessage extends Mailable
|
||||
|
||||
public function __construct(
|
||||
private array $request
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the message.
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Domain\Items\Actions;
|
||||
|
||||
use Domain\Teams\Actions\SetTeamFolderPropertyForAllChildrenAction;
|
||||
use Domain\Folders\Models\Folder;
|
||||
use Domain\Sharing\Models\Share;
|
||||
use Gate;
|
||||
use Domain\Sharing\Models\Share;
|
||||
use Domain\Folders\Models\Folder;
|
||||
use Domain\Teams\Actions\SetTeamFolderPropertyForAllChildrenAction;
|
||||
|
||||
class MoveFileOrFolderAction
|
||||
{
|
||||
public function __construct(
|
||||
public SetTeamFolderPropertyForAllChildrenAction $setTeamFolderPropertyForAllChildren,
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Move folder or file to new location
|
||||
@@ -26,7 +26,6 @@ class MoveFileOrFolderAction
|
||||
|
||||
// Process folder
|
||||
if ($item['type'] === 'folder') {
|
||||
|
||||
// Determine, if we are moving folder into the team folder or not
|
||||
$isTeamFolder = is_null($request->input('to_id'))
|
||||
? false
|
||||
|
||||
@@ -1,32 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Domain\Sharing\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Domain\Files\Actions\DownloadFileAction;
|
||||
use Domain\Files\Models\File;
|
||||
use Domain\Sharing\Actions\ProtectShareRecordAction;
|
||||
use Domain\Sharing\Actions\VerifyAccessToItemWithinAction;
|
||||
use Domain\Sharing\Models\Share;
|
||||
use Domain\Traffic\Actions\RecordDownloadAction;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Domain\Sharing\Models\Share;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Domain\Files\Actions\DownloadFileAction;
|
||||
use Domain\Traffic\Actions\RecordDownloadAction;
|
||||
use Domain\Sharing\Actions\ProtectShareRecordAction;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
use Domain\Sharing\Actions\VerifyAccessToItemWithinAction;
|
||||
|
||||
class DirectlyDownloadFileController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private DownloadFileAction $downloadFile,
|
||||
private RecordDownloadAction $recordDownload,
|
||||
private ProtectShareRecordAction $protectShareRecord,
|
||||
private DownloadFileAction $downloadFile,
|
||||
private RecordDownloadAction $recordDownload,
|
||||
private ProtectShareRecordAction $protectShareRecord,
|
||||
private VerifyAccessToItemWithinAction $verifyAccessToItemWithin,
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
public function __invoke(
|
||||
Share $share
|
||||
): Response|StreamedResponse|RedirectResponse
|
||||
{
|
||||
): Response|StreamedResponse|RedirectResponse {
|
||||
// Check if item is not a folder
|
||||
if ($share->type !== 'file') {
|
||||
return response('This content is not downloadable');
|
||||
@@ -36,7 +34,7 @@ class DirectlyDownloadFileController extends Controller
|
||||
($this->protectShareRecord)($share);
|
||||
|
||||
// Check if user can download file
|
||||
if (!$share->user->canDownload()) {
|
||||
if (! $share->user->canDownload()) {
|
||||
return response([
|
||||
'type' => 'error',
|
||||
'message' => 'This user action is not allowed.',
|
||||
@@ -59,4 +57,4 @@ class DirectlyDownloadFileController extends Controller
|
||||
|
||||
return ($this->downloadFile)($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,8 @@ class ShareViaEmailController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private SendViaEmailAction $sendLinkToEmailAction,
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
public function __invoke(
|
||||
Request $request,
|
||||
|
||||
@@ -16,7 +16,8 @@ class SharedSendViaEmail extends Notification
|
||||
public function __construct(
|
||||
public string $token,
|
||||
public User $user,
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the notification's delivery channels.
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
namespace Domain\UploadRequest\Controllers\FileAccess;
|
||||
|
||||
use Domain\Files\Models\File;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Domain\Files\Actions\DownloadFileAction;
|
||||
use Domain\UploadRequest\Models\UploadRequest;
|
||||
use Domain\Traffic\Actions\RecordDownloadAction;
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
<?php
|
||||
|
||||
function accessDeniedError(): array {
|
||||
function accessDeniedError(): array
|
||||
{
|
||||
return [
|
||||
'type' => 'error',
|
||||
'message' => 'Access Denied',
|
||||
];
|
||||
}
|
||||
|
||||
function userActionNotAllowedError(): array {
|
||||
function userActionNotAllowedError(): array
|
||||
{
|
||||
return [
|
||||
'type' => 'error',
|
||||
'message' => 'This user action is not allowed.',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Domain\Admin;
|
||||
|
||||
use Tests\TestCase;
|
||||
@@ -55,7 +54,7 @@ class DashboardTest extends TestCase
|
||||
->create(['role' => 'admin']);
|
||||
|
||||
$users->each(
|
||||
fn($user) => $this
|
||||
fn ($user) => $this
|
||||
->actingAs($admin)
|
||||
->getJson('/api/admin/dashboard/newbies')
|
||||
->assertStatus(200)
|
||||
|
||||
Reference in New Issue
Block a user