mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 00:02:15 +00:00
fixes
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
||||
>
|
||||
<projectFiles>
|
||||
<directory name="app"/>
|
||||
<directory name="src"/>
|
||||
<ignoreFiles>
|
||||
<directory name="vendor"/>
|
||||
</ignoreFiles>
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
"/chunks/plan-settings.js": "/chunks/plan-settings.js?id=dbc08f8cdc23900ef40a",
|
||||
"/chunks/plan-subscribers.js": "/chunks/plan-subscribers.js?id=8c4b655b9286e06894c5",
|
||||
"/chunks/plans.js": "/chunks/plans.js?id=2b26173a02ed9f86e875",
|
||||
"/chunks/platform.js": "/chunks/platform.js?id=96e35689e3b71e7097eb",
|
||||
"/chunks/platform.js": "/chunks/platform.js?id=5e32d71dd20b421c0339",
|
||||
"/chunks/platform~chunks/shared.js": "/chunks/platform~chunks/shared.js?id=be3d7cf51585313cf53b",
|
||||
"/chunks/profile.js": "/chunks/profile.js?id=03526296e71df827ff47",
|
||||
"/chunks/profile~chunks/settings-password.js": "/chunks/profile~chunks/settings-password.js?id=fd25990d1ccec0294602",
|
||||
@@ -70,7 +70,7 @@
|
||||
"/chunks/settings~chunks/settings-password.js": "/chunks/settings~chunks/settings-password.js?id=1c49c2c5bcef4395dedb",
|
||||
"/chunks/setup-wizard.js": "/chunks/setup-wizard.js?id=41d3478184ec24644a1c",
|
||||
"/chunks/shared.js": "/chunks/shared.js?id=7524b7a783d4aed23794",
|
||||
"/chunks/shared/authenticate.js": "/chunks/shared/authenticate.js?id=bfdf9bb904d354bdcbd1",
|
||||
"/chunks/shared/authenticate.js": "/chunks/shared/authenticate.js?id=0d55b9570c2e4dffc6c4",
|
||||
"/chunks/shared/file-browser.js": "/chunks/shared/file-browser.js?id=0f6c34512740fca7e007",
|
||||
"/chunks/shared/single-file.js": "/chunks/shared/single-file.js?id=7886247bb35deada28a2",
|
||||
"/chunks/sign-in.js": "/chunks/sign-in.js?id=0709543b76769c50a873",
|
||||
@@ -98,5 +98,15 @@
|
||||
"/chunks/sign-in.5fb05f1c4d2f285ebf61.hot-update.js": "/chunks/sign-in.5fb05f1c4d2f285ebf61.hot-update.js",
|
||||
"/chunks/sign-in.64892e5fdc888eba9b23.hot-update.js": "/chunks/sign-in.64892e5fdc888eba9b23.hot-update.js",
|
||||
"/chunks/sign-in.62aa097b63d9b34e26cd.hot-update.js": "/chunks/sign-in.62aa097b63d9b34e26cd.hot-update.js",
|
||||
"/chunks/platform.cc7392304bf1bf06dc6c.hot-update.js": "/chunks/platform.cc7392304bf1bf06dc6c.hot-update.js"
|
||||
"/chunks/platform.cc7392304bf1bf06dc6c.hot-update.js": "/chunks/platform.cc7392304bf1bf06dc6c.hot-update.js",
|
||||
"/js/main.c485ebce07a04a22b7c9.hot-update.js": "/js/main.c485ebce07a04a22b7c9.hot-update.js",
|
||||
"/js/main.7a0c892ef84793506a82.hot-update.js": "/js/main.7a0c892ef84793506a82.hot-update.js",
|
||||
"/js/main.a19fe043abb3a32f0608.hot-update.js": "/js/main.a19fe043abb3a32f0608.hot-update.js",
|
||||
"/js/main.d571f0bdb43cf090c45d.hot-update.js": "/js/main.d571f0bdb43cf090c45d.hot-update.js",
|
||||
"/js/main.2b5b1fcef9e9ba3a7ae7.hot-update.js": "/js/main.2b5b1fcef9e9ba3a7ae7.hot-update.js",
|
||||
"/js/main.b416b2d7971524a86f46.hot-update.js": "/js/main.b416b2d7971524a86f46.hot-update.js",
|
||||
"/chunks/profile.bbadcc644cb3b3e11ae7.hot-update.js": "/chunks/profile.bbadcc644cb3b3e11ae7.hot-update.js",
|
||||
"/chunks/profile.c0f226e939dbf079715a.hot-update.js": "/chunks/profile.c0f226e939dbf079715a.hot-update.js",
|
||||
"/chunks/platform.529c72b59492c1c39e5c.hot-update.js": "/chunks/platform.529c72b59492c1c39e5c.hot-update.js",
|
||||
"/chunks/shared/authenticate.79f7d04085475dc9cf9e.hot-update.js": "/chunks/shared/authenticate.79f7d04085475dc9cf9e.hot-update.js"
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@
|
||||
|
||||
// Send request to get share link
|
||||
axios
|
||||
.post('/api/share/' + this.shareOptions.id, {
|
||||
.post('/api/share/' + this.shareOptions.token, {
|
||||
permission: this.shareOptions.permission,
|
||||
protected: this.shareOptions.isProtected,
|
||||
expiration: this.shareOptions.expiration,
|
||||
|
||||
2
resources/js/helpers.js
vendored
2
resources/js/helpers.js
vendored
@@ -68,7 +68,7 @@ const Helpers = {
|
||||
|
||||
Vue.prototype.$updateText = debounce(function (route, name, value, allowEmpty = false) {
|
||||
|
||||
if ((value === '' || value === ' ') && !allowEmpty) return
|
||||
if ((value === '' || value === ' ' || typeof value === 'object') && !allowEmpty) return
|
||||
|
||||
axios.post(this.$store.getters.api + route, {name, value, _method: 'patch'})
|
||||
.catch(() => {
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
password: 'secret',
|
||||
password: '',
|
||||
isLoading: false,
|
||||
}
|
||||
},
|
||||
|
||||
@@ -38,7 +38,7 @@ Route::group(['prefix' => 'browse'], function () {
|
||||
Route::get('/navigation/{shared}', VisitorNavigationFolderTreeController::class);
|
||||
Route::get('/search/{shared}', VisitorSearchFilesAndFoldersController::class);
|
||||
Route::get('/file/{shared}', VisitorShowFileController::class);
|
||||
Route::get('/share/{shared}', [ShareController::class, 'show']);
|
||||
Route::get('/share/{share}', [ShareController::class, 'show']);
|
||||
});
|
||||
|
||||
Route::get('/og-site/{shared}', WebCrawlerOpenGraphController::class);
|
||||
Route::get('/og-site/{share}', WebCrawlerOpenGraphController::class);
|
||||
|
||||
@@ -16,9 +16,9 @@ Route::get('/translations/{lang}', CurrentLocalizationController::class);
|
||||
|
||||
// Get og site for web crawlers
|
||||
if (Crawler::isCrawler()) {
|
||||
Route::get('/share/{shared}', WebCrawlerOpenGraphController::class);
|
||||
Route::get('/share/{share}', WebCrawlerOpenGraphController::class);
|
||||
} else {
|
||||
Route::get('/share/{shared}', SharePublicIndexController::class);
|
||||
Route::get('/share/{share}', SharePublicIndexController::class);
|
||||
}
|
||||
|
||||
// Index
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
namespace Domain\Sharing\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Domain\Zip\Models\Zip;
|
||||
use Domain\Sharing\Models\Share;
|
||||
@@ -18,9 +17,9 @@ class ShareController extends Controller
|
||||
* Get shared record
|
||||
*/
|
||||
public function show(
|
||||
Share $shared,
|
||||
Share $share,
|
||||
): ShareResource {
|
||||
return new ShareResource($shared);
|
||||
return new ShareResource($share);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,20 +56,21 @@ class ShareController extends Controller
|
||||
*/
|
||||
public function update(
|
||||
UpdateShareRequest $request,
|
||||
Share $shared,
|
||||
Share $share,
|
||||
): ShareResource {
|
||||
|
||||
// Update sharing record
|
||||
$shared->update([
|
||||
$share->update([
|
||||
'permission' => $request->input('permission'),
|
||||
'is_protected' => $request->input('protected'),
|
||||
'expire_in' => $request->input('expiration'),
|
||||
'password' => $request->input('password')
|
||||
? bcrypt($request->input('password'))
|
||||
: $shared->password,
|
||||
: $share->password,
|
||||
]);
|
||||
|
||||
// Return shared record
|
||||
return new ShareResource($shared);
|
||||
return new ShareResource($share);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,18 +20,18 @@ class SharePublicIndexController extends Controller
|
||||
}
|
||||
|
||||
public function __invoke(
|
||||
Share $shared,
|
||||
Share $share,
|
||||
): View | StreamedResponse {
|
||||
// Delete share_session if exist
|
||||
if ($shared->is_protected) {
|
||||
if ($share->is_protected) {
|
||||
cookie()->queue('share_session', '', -1);
|
||||
}
|
||||
|
||||
// Check if shared is image file and then show it
|
||||
if ($shared->type === 'file' && ! $shared->is_protected) {
|
||||
$image = File::whereUserId($shared->user_id)
|
||||
if ($share->type === 'file' && ! $share->is_protected) {
|
||||
$image = File::whereUserId($share->user_id)
|
||||
->whereType('image')
|
||||
->whereId($shared->item_id)
|
||||
->whereId($share->item_id)
|
||||
->first();
|
||||
|
||||
if ($image) {
|
||||
@@ -39,9 +39,9 @@ class SharePublicIndexController extends Controller
|
||||
$fileSize = (int) $image->getRawOriginal('filesize');
|
||||
|
||||
// Store user download size
|
||||
($this->recordDownload)($fileSize, $shared->user->id);
|
||||
($this->recordDownload)($fileSize, $share->user->id);
|
||||
|
||||
return $this->get_single_image($image, $shared->user_id);
|
||||
return $this->get_single_image($image, $share->user_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,30 +11,30 @@ class WebCrawlerOpenGraphController extends Controller
|
||||
* Get og site for web crawlers
|
||||
*/
|
||||
public function __invoke(
|
||||
Share $shared
|
||||
Share $share
|
||||
): View {
|
||||
$namespace = match ($shared->type) {
|
||||
$namespace = match ($share->type) {
|
||||
'folder' => 'Domain\\Folders\\Models\\Folder',
|
||||
'file' => 'Domain\\Files\\Models\\File',
|
||||
};
|
||||
|
||||
// Get file/folder record
|
||||
$item = ($namespace)::where('user_id', $shared->user->id)
|
||||
->where('id', $shared->item_id)
|
||||
$item = ($namespace)::where('user_id', $share->user->id)
|
||||
->where('id', $share->item_id)
|
||||
->first();
|
||||
|
||||
if ($item->thumbnail) {
|
||||
$item->setPublicUrl($shared->token);
|
||||
$item->setPublicUrl($share->token);
|
||||
}
|
||||
|
||||
return view('vuefilemanager.crawler.og-view')
|
||||
->with('settings', get_settings_in_json())
|
||||
->with('metadata', [
|
||||
'url' => url('/share', ['token' => $shared->token]),
|
||||
'is_protected' => $shared->is_protected,
|
||||
'user' => $shared->user->settings->name,
|
||||
'url' => url('/share', ['token' => $share->token]),
|
||||
'is_protected' => $share->is_protected,
|
||||
'user' => $share->user->settings->name,
|
||||
'name' => $item->name,
|
||||
'size' => $shared->type === 'folder'
|
||||
'size' => $share->type === 'folder'
|
||||
? $item->items
|
||||
: $item->filesize,
|
||||
'thumbnail' => $item->thumbnail ?? null,
|
||||
|
||||
@@ -43,12 +43,9 @@ class Share extends Model
|
||||
return ShareFactory::new();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate share link
|
||||
*/
|
||||
public function getLinkAttribute(): string
|
||||
{
|
||||
return url('/share', ['token' => $this->attributes['token']]);
|
||||
return url("/share/{$this->token}");
|
||||
}
|
||||
|
||||
public function user(): HasOne
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
use Carbon\Carbon;
|
||||
use ByteUnits\Metric;
|
||||
use App\Users\Models\User;
|
||||
use Domain\Files\Models\File;
|
||||
use Domain\Folders\Models\Folder;
|
||||
use Illuminate\Support\Str;
|
||||
use Domain\Sharing\Models\Share;
|
||||
use Illuminate\Support\Collection;
|
||||
@@ -249,14 +251,14 @@ if (! function_exists('is_demo_account')) {
|
||||
if (! function_exists('get_item')) {
|
||||
/**
|
||||
* Get folder or file item
|
||||
*
|
||||
* @param $type
|
||||
* @param $id
|
||||
* @return \Illuminate\Database\Eloquent\Builder|Model
|
||||
*/
|
||||
function get_item($type, $id)
|
||||
function get_item(string $type, string $id): Folder|File
|
||||
{
|
||||
$namespace = match ($type) {
|
||||
$model = $type === 'Folder'
|
||||
? 'folder'
|
||||
: 'file';
|
||||
|
||||
$namespace = match ($model) {
|
||||
'folder' => 'Domain\\Folders\\Models\\Folder',
|
||||
'file' => 'Domain\\Files\\Models\\File',
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user