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