mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-05-13 08:45:01 +00:00
editing with shared items in public
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A helper file for Laravel, to provide autocomplete information to your IDE
|
* A helper file for Laravel, to provide autocomplete information to your IDE
|
||||||
* Generated for Laravel 6.18.3 on 2020-04-27 09:19:35.
|
* Generated for Laravel 6.18.3 on 2020-04-28 07:53:27.
|
||||||
*
|
*
|
||||||
* This file should not be included in your code, only analyzed by your IDE!
|
* This file should not be included in your code, only analyzed by your IDE!
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ class BrowseController extends Controller
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function folder_tree() {
|
public function navigation_tree() {
|
||||||
|
|
||||||
$folders = FileManagerFolder::with('folders:id,parent_id,unique_id,name')
|
$folders = FileManagerFolder::with('folders:id,parent_id,unique_id,name')
|
||||||
->where('parent_id', 0)
|
->where('parent_id', 0)
|
||||||
|
|||||||
@@ -2,387 +2,327 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\FileFunctions;
|
namespace App\Http\Controllers\FileFunctions;
|
||||||
|
|
||||||
use App\Share;
|
use App\Http\Requests\FileFunctions\CreateFolderRequest;
|
||||||
use Illuminate\Support\Arr;
|
use App\Http\Requests\FileFunctions\DeleteItemRequest;
|
||||||
|
use App\Http\Requests\FileFunctions\RenameItemRequest;
|
||||||
|
use App\Http\Requests\FileFunctions\MoveItemRequest;
|
||||||
|
use App\Http\Requests\FileFunctions\UploadRequest;
|
||||||
|
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Intervention\Image\ImageManagerStatic as Image;
|
|
||||||
use Illuminate\Support\Facades\Validator;
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\Request;
|
use App\Http\Tools\Guardian;
|
||||||
use Illuminate\Support\Str;
|
use App\Http\Tools\Editor;
|
||||||
use App\FileManagerFolder;
|
use App\FileManagerFolder;
|
||||||
use App\FileManagerFile;
|
use App\FileManagerFile;
|
||||||
use Response;
|
use Exception;
|
||||||
|
|
||||||
|
|
||||||
class EditItemsController extends Controller
|
class EditItemsController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create new folder
|
* Create new folder for authenticated master|editor user
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param CreateFolderRequest $request
|
||||||
* @return array
|
* @return FileManagerFolder|Model
|
||||||
*/
|
*/
|
||||||
public function create_folder(Request $request)
|
public function user_create_folder(CreateFolderRequest $request)
|
||||||
{
|
{
|
||||||
// Check permission to create folder for authenticated public editor
|
// Check permission to create folder for authenticated editor
|
||||||
if ( ! $request->user()->tokenCan('master') ) {
|
if ($request->user()->tokenCan('editor')) {
|
||||||
$this->check_access($request, $request->parent_id);
|
|
||||||
|
// check if shared_token cookie exist
|
||||||
|
if (!$request->hasCookie('shared_token')) abort('401');
|
||||||
|
|
||||||
|
// Get shared token
|
||||||
|
$shared = get_shared($request->cookie('shared_token'));
|
||||||
|
|
||||||
|
// Check access to requested directory
|
||||||
|
Guardian::check_item_access($request->parent_id, $shared);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate request
|
// Create new folder
|
||||||
$validator = Validator::make($request->all(), [
|
return Editor::create_folder($request);
|
||||||
'parent_id' => 'required|integer',
|
}
|
||||||
'name' => 'string',
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Return error
|
/**
|
||||||
if ($validator->fails()) abort(400, 'Bad input');
|
* Create new folder for guest user with edit permission
|
||||||
|
*
|
||||||
|
* @param CreateFolderRequest $request
|
||||||
|
* @param $token
|
||||||
|
* @return FileManagerFolder|Model
|
||||||
|
*/
|
||||||
|
public function guest_create_folder(CreateFolderRequest $request, $token)
|
||||||
|
{
|
||||||
|
// Get shared record
|
||||||
|
$shared = get_shared($token);
|
||||||
|
|
||||||
// Get parent_id from request
|
// Check shared permission
|
||||||
$parent_id = $request->parent_id === 0 ? 0 : $request->parent_id;
|
if (!is_editor($shared)) abort(403);
|
||||||
|
|
||||||
|
// Check access to requested directory
|
||||||
|
Guardian::check_item_access($request->parent_id, $shared);
|
||||||
|
|
||||||
// Create folder
|
// Create folder
|
||||||
$folder = FileManagerFolder::create([
|
return Editor::create_folder($request, $shared);
|
||||||
'user_id' => Auth::id(),
|
|
||||||
'parent_id' => $parent_id,
|
|
||||||
'name' => $request->has('name') ? $request->input('name') : 'New Folder',
|
|
||||||
'type' => 'folder',
|
|
||||||
'unique_id' => $this->get_unique_id(),
|
|
||||||
'user_scope' => $request->user()->token()->scopes[0],
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Return new folder
|
|
||||||
return $folder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename item name
|
* Rename item for authenticated master|editor user
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param RenameItemRequest $request
|
||||||
|
* @param $unique_id
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function rename_item(Request $request, $unique_id)
|
public function user_rename_item(RenameItemRequest $request, $unique_id)
|
||||||
{
|
{
|
||||||
// Validate request
|
// Check permission to rename item for authenticated editor
|
||||||
$validator = Validator::make($request->all(), [
|
if ($request->user()->tokenCan('editor')) {
|
||||||
'name' => 'required|string',
|
|
||||||
'type' => 'required|string',
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Return error
|
// check if shared_token cookie exist
|
||||||
if ($validator->fails()) abort(400, 'Bad input');
|
if (!$request->hasCookie('shared_token')) abort('401');
|
||||||
|
|
||||||
// Get user id
|
// Get shared token
|
||||||
$user_id = Auth::id();
|
$shared = get_shared($request->cookie('shared_token'));
|
||||||
|
|
||||||
// Update folder name
|
// Get file|folder item
|
||||||
|
$item = get_item($request->type, $unique_id, Auth::id());
|
||||||
|
|
||||||
|
// Check access to requested directory
|
||||||
if ($request->type === 'folder') {
|
if ($request->type === 'folder') {
|
||||||
|
Guardian::check_item_access($item->unique_id, $shared);
|
||||||
$item = FileManagerFolder::where('unique_id', $unique_id)
|
|
||||||
->where('user_id', $user_id)
|
|
||||||
->firstOrFail();
|
|
||||||
|
|
||||||
// Check permission to rename for authenticated public editor
|
|
||||||
if ( ! $request->user()->tokenCan('master') ) {
|
|
||||||
$this->check_access($request, $item->unique_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
$item->name = $request->name;
|
|
||||||
$item->save();
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
Guardian::check_item_access($item->folder_id, $shared);
|
||||||
$item = FileManagerFile::where('unique_id', $unique_id)
|
}
|
||||||
->where('user_id', $user_id)
|
|
||||||
->firstOrFail();
|
|
||||||
|
|
||||||
// Check permission to rename for authenticated public editor
|
|
||||||
if ( ! $request->user()->tokenCan('master') ) {
|
|
||||||
$this->check_access($request, $item->folder_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$item->name = $request->name;
|
// Rename Item
|
||||||
$item->save();
|
return Editor::rename_item($request, $unique_id);
|
||||||
}
|
|
||||||
|
|
||||||
// Return updated item
|
|
||||||
return $item;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete item
|
* Rename item for guest user with edit permission
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param RenameItemRequest $request
|
||||||
* @param $unique_id
|
* @param $unique_id
|
||||||
* @throws \Exception
|
* @param $token
|
||||||
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function delete_item(Request $request, $unique_id)
|
public function guest_rename_item(RenameItemRequest $request, $unique_id, $token)
|
||||||
{
|
{
|
||||||
// Validate request
|
// Get shared record
|
||||||
$validator = Validator::make($request->all(), [
|
$shared = get_shared($token);
|
||||||
'type' => 'required|string',
|
|
||||||
'force_delete' => 'required|boolean',
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Return error
|
// Check shared permission
|
||||||
if ($validator->fails()) abort(400, 'Bad input');
|
if (!is_editor($shared)) abort(403);
|
||||||
|
|
||||||
// Get user id
|
// Get file|folder item
|
||||||
$user = Auth::user();
|
$item = get_item($request->type, $unique_id, $shared->user_id);
|
||||||
|
|
||||||
// Delete folder
|
// Check access to requested item
|
||||||
if ($request->type === 'folder') {
|
if ($request->type === 'folder') {
|
||||||
|
Guardian::check_item_access($item->unique_id, $shared);
|
||||||
// Get folder
|
|
||||||
$folder = FileManagerFolder::withTrashed()
|
|
||||||
->with(['folders'])
|
|
||||||
->where('user_id', $user->id)
|
|
||||||
->where('unique_id', $unique_id)
|
|
||||||
->first();
|
|
||||||
|
|
||||||
// Check permission to delete for authenticated public editor
|
|
||||||
if ( ! $request->user()->tokenCan('master') ) {
|
|
||||||
$this->check_access($request, $folder->unique_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Force delete children files
|
|
||||||
if ($request->force_delete) {
|
|
||||||
|
|
||||||
// Get children folder ids
|
|
||||||
$child_folders = filter_folders_ids($folder->trashed_folders, 'unique_id');
|
|
||||||
|
|
||||||
// Get children files
|
|
||||||
$files = FileManagerFile::onlyTrashed()
|
|
||||||
->where('user_id', $user->id)
|
|
||||||
->whereIn('folder_id', Arr::flatten([$unique_id, $child_folders]))
|
|
||||||
->get();
|
|
||||||
|
|
||||||
// Remove all children files
|
|
||||||
foreach ($files as $file) {
|
|
||||||
|
|
||||||
// Delete file
|
|
||||||
Storage::disk('local')->delete('/file-manager/' . $file->basename);
|
|
||||||
|
|
||||||
// Delete thumbnail if exist
|
|
||||||
if (!is_null($file->thumbnail)) Storage::disk('local')->delete('/file-manager/' . $file->getOriginal('thumbnail'));
|
|
||||||
|
|
||||||
// Delete file permanently
|
|
||||||
$file->forceDelete();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete folder record
|
|
||||||
$folder->forceDelete();
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
Guardian::check_item_access($item->folder_id, $shared);
|
||||||
// Remove folder from user favourites
|
|
||||||
$user->favourites()->detach($unique_id);
|
|
||||||
|
|
||||||
// Soft delete folder record
|
|
||||||
$folder->delete();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
|
|
||||||
$file = FileManagerFile::withTrashed()
|
|
||||||
->where('user_id', $user->id)
|
|
||||||
->where('unique_id', $unique_id)
|
|
||||||
->first();
|
|
||||||
|
|
||||||
// Check permission to delete for authenticated public editor
|
|
||||||
if ( ! $request->user()->tokenCan('master') ) {
|
|
||||||
$this->check_access($request, $file->folder_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->force_delete) {
|
// Rename item
|
||||||
|
return Editor::rename_item($request, $unique_id, $shared);
|
||||||
// Delete file
|
|
||||||
Storage::disk('local')->delete('/file-manager/' . $file->basename);
|
|
||||||
|
|
||||||
// Delete thumbnail if exist
|
|
||||||
if ($file->thumbnail) Storage::disk('local')->delete('/file-manager/' . $file->getOriginal('thumbnail'));
|
|
||||||
|
|
||||||
// Delete file permanently
|
|
||||||
$file->forceDelete();
|
|
||||||
} else {
|
|
||||||
|
|
||||||
// Soft delete file
|
|
||||||
$file->delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Upload items
|
* Delete item for authenticated master|editor user
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param DeleteItemRequest $request
|
||||||
* @return array
|
* @param $unique_id
|
||||||
|
* @return ResponseFactory|\Illuminate\Http\Response
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function upload_item(Request $request)
|
public function user_delete_item(DeleteItemRequest $request, $unique_id)
|
||||||
{
|
{
|
||||||
// Check permission to upload for authenticated public editor
|
// Check permission to delete item for authenticated editor
|
||||||
if ( ! $request->user()->tokenCan('master') ) {
|
if ($request->user()->tokenCan('editor')) {
|
||||||
$this->check_access($request, $request->parent_id);
|
|
||||||
|
// Prevent force delete for non-master users
|
||||||
|
if ($request->force_delete) abort('401');
|
||||||
|
|
||||||
|
// check if shared_token cookie exist
|
||||||
|
if (!$request->hasCookie('shared_token')) abort('401');
|
||||||
|
|
||||||
|
// Get shared token
|
||||||
|
$shared = get_shared($request->cookie('shared_token'));
|
||||||
|
|
||||||
|
// Get file|folder item
|
||||||
|
$item = get_item($request->type, $unique_id, Auth::id());
|
||||||
|
|
||||||
|
// Check access to requested directory
|
||||||
|
if ($request->type === 'folder') {
|
||||||
|
Guardian::check_item_access($item->unique_id, $shared);
|
||||||
|
} else {
|
||||||
|
Guardian::check_item_access($item->folder_id, $shared);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete item
|
||||||
|
Editor::delete_item($request, $unique_id);
|
||||||
|
|
||||||
|
// Return response
|
||||||
|
return response(null, 204);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete item for guest user with edit permission
|
||||||
|
*
|
||||||
|
* @param DeleteItemRequest $request
|
||||||
|
* @param $unique_id
|
||||||
|
* @param $token
|
||||||
|
* @return ResponseFactory|\Illuminate\Http\Response
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function guest_delete_item(DeleteItemRequest $request, $unique_id, $token)
|
||||||
|
{
|
||||||
|
// Get shared record
|
||||||
|
$shared = get_shared($token);
|
||||||
|
|
||||||
|
// Check shared permission
|
||||||
|
if (!is_editor($shared)) abort(403);
|
||||||
|
|
||||||
|
// Get file|folder item
|
||||||
|
$item = get_item($request->type, $unique_id, $shared->user_id);
|
||||||
|
|
||||||
|
// Check access to requested item
|
||||||
|
if ($request->type === 'folder') {
|
||||||
|
Guardian::check_item_access($item->unique_id, $shared);
|
||||||
|
} else {
|
||||||
|
Guardian::check_item_access($item->folder_id, $shared);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete item
|
||||||
|
Editor::delete_item($request, $unique_id, $shared);
|
||||||
|
|
||||||
|
// Return response
|
||||||
|
return response(null, 204);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete file for authenticated master|editor user
|
||||||
|
*
|
||||||
|
* @param UploadRequest $request
|
||||||
|
* @return FileManagerFile|Model
|
||||||
|
*/
|
||||||
|
public function user_upload(UploadRequest $request)
|
||||||
|
{
|
||||||
// Check if user can upload
|
// Check if user can upload
|
||||||
if (config('vuefilemanager.limit_storage_by_capacity') && user_storage_percentage() >= 100) {
|
if (config('vuefilemanager.limit_storage_by_capacity') && user_storage_percentage() >= 100) {
|
||||||
abort(423, 'You exceed your storage limit!');
|
abort(423, 'You exceed your storage limit!');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate request
|
// Check permission to upload for authenticated editor
|
||||||
$validator = Validator::make($request->all(), [
|
if ($request->user()->tokenCan('editor')) {
|
||||||
'parent_id' => 'required|integer',
|
|
||||||
'file' => 'required|file',
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Return error
|
// check if shared_token cookie exist
|
||||||
if ($validator->fails()) abort(400, 'Bad input');
|
if (!$request->hasCookie('shared_token')) abort('401');
|
||||||
|
|
||||||
// Get parent_id from request
|
// Get shared token
|
||||||
$folder_id = $request->parent_id === 0 ? 0 : $request->parent_id;
|
$shared = get_shared($request->cookie('shared_token'));
|
||||||
$file = $request->file('file');
|
|
||||||
|
|
||||||
// File
|
// Check access to requested directory
|
||||||
$filename = Str::random() . '-' . str_replace(' ', '', $file->getClientOriginalName());
|
Guardian::check_item_access($request->parent_id, $shared);
|
||||||
$filetype = get_file_type($file);
|
|
||||||
$thumbnail = null;
|
|
||||||
$filesize = $file->getSize();
|
|
||||||
$directory = 'file-manager';
|
|
||||||
|
|
||||||
// create directory if not exist
|
|
||||||
if (!Storage::disk('local')->exists($directory)) {
|
|
||||||
Storage::disk('local')->makeDirectory($directory);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store to disk
|
// Return new uploaded file
|
||||||
Storage::disk('local')->putFileAs($directory, $file, $filename, 'public');
|
return Editor::upload($request);
|
||||||
|
|
||||||
// Create image thumbnail
|
|
||||||
if ($filetype == 'image') {
|
|
||||||
|
|
||||||
$thumbnail = 'thumbnail-' . $filename;
|
|
||||||
|
|
||||||
// Create intervention image
|
|
||||||
$image = Image::make($file->getRealPath())->orientate();
|
|
||||||
|
|
||||||
$image->resize(256, null, function ($constraint) {
|
|
||||||
$constraint->aspectRatio();
|
|
||||||
})->stream();
|
|
||||||
|
|
||||||
// Store thumbnail to s3
|
|
||||||
Storage::disk('local')->put($directory . '/' . $thumbnail, $image);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store file
|
/**
|
||||||
$new_file = FileManagerFile::create([
|
* Delete file for guest user with edit permission
|
||||||
'user_id' => Auth::id(),
|
*
|
||||||
'name' => pathinfo($file->getClientOriginalName())['filename'],
|
* @param UploadRequest $request
|
||||||
'basename' => $filename,
|
* @param $token
|
||||||
'folder_id' => $folder_id,
|
* @return FileManagerFile|Model
|
||||||
'mimetype' => $file->getClientOriginalExtension(),
|
*/
|
||||||
'filesize' => $filesize,
|
public function guest_upload(UploadRequest $request, $token)
|
||||||
'type' => $filetype,
|
{
|
||||||
'thumbnail' => $thumbnail,
|
// Get shared record
|
||||||
'unique_id' => $this->get_unique_id(),
|
$shared = get_shared($token);
|
||||||
'user_scope' => $request->user()->token()->scopes[0],
|
|
||||||
]);
|
// Check shared permission
|
||||||
|
if (!is_editor($shared)) abort(403);
|
||||||
|
|
||||||
|
// Check access to requested directory
|
||||||
|
Guardian::check_item_access($request->parent_id, $shared);
|
||||||
|
|
||||||
|
// Return new uploaded file
|
||||||
|
$new_file = Editor::upload($request, $shared);
|
||||||
|
|
||||||
|
// Set public access url
|
||||||
|
$new_file->setPublicUrl($token);
|
||||||
|
|
||||||
return $new_file;
|
return $new_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move item
|
* Move item for authenticated master|editor user
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param MoveItemRequest $request
|
||||||
* @param $unique_id
|
* @param $unique_id
|
||||||
* @return \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response
|
* @return ResponseFactory|\Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function move_item(Request $request, $unique_id)
|
public function user_move(MoveItemRequest $request, $unique_id)
|
||||||
{
|
{
|
||||||
// Validate request
|
// Check permission to upload for authenticated editor
|
||||||
$validator = Validator::make($request->all(), [
|
if ($request->user()->tokenCan('editor')) {
|
||||||
'to_unique_id' => 'required|integer',
|
|
||||||
'from_type' => 'required|string',
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Return error
|
// check if shared_token cookie exist
|
||||||
if ($validator->fails()) abort(400, 'Bad input');
|
if (!$request->hasCookie('shared_token')) abort('401');
|
||||||
|
|
||||||
// Get user id
|
// Get shared token
|
||||||
$user_id = Auth::id();
|
$shared = get_shared($request->cookie('shared_token'));
|
||||||
|
|
||||||
if ($request->from_type === 'folder') {
|
// Check access to requested directory
|
||||||
|
Guardian::check_item_access($request->to_unique_id, $shared);
|
||||||
// Move folder
|
|
||||||
$item = FileManagerFolder::where('user_id', $user_id)
|
|
||||||
->where('unique_id', $unique_id)
|
|
||||||
->firstOrFail();
|
|
||||||
|
|
||||||
$item->parent_id = $request->to_unique_id;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
// Move file under new folder
|
|
||||||
$item = FileManagerFile::where('user_id', $user_id)
|
|
||||||
->where('unique_id', $unique_id)
|
|
||||||
->firstOrFail();
|
|
||||||
|
|
||||||
$item->folder_id = $request->to_unique_id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$item->update();
|
// Move item
|
||||||
|
Editor::move($request, $unique_id);
|
||||||
|
|
||||||
return response('Done!', 204);
|
return response('Done!', 204);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get unique id
|
* Move item for guest user with edit permission
|
||||||
*
|
*
|
||||||
* @return int
|
* @param MoveItemRequest $request
|
||||||
|
* @param $unique_id
|
||||||
|
* @param $token
|
||||||
|
* @return ResponseFactory|\Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
private function get_unique_id(): int
|
public function guest_move(MoveItemRequest $request, $unique_id, $token)
|
||||||
{
|
{
|
||||||
// Get files and folders
|
// Get shared record
|
||||||
$folders = FileManagerFolder::withTrashed()->get();
|
$shared = get_shared($token);
|
||||||
$files = FileManagerFile::withTrashed()->get();
|
|
||||||
|
|
||||||
// Get last ids
|
// Check shared permission
|
||||||
$folders_unique = $folders->isEmpty() ? 0 : $folders->last()->unique_id;
|
if (!is_editor($shared)) abort(403);
|
||||||
$files_unique = $files->isEmpty() ? 0 : $files->last()->unique_id;
|
|
||||||
|
|
||||||
// Count new unique id
|
$moving_unique_id = $unique_id;
|
||||||
$unique_id = $folders_unique > $files_unique ? $folders_unique + 1 : $files_unique + 1;
|
|
||||||
|
|
||||||
return $unique_id;
|
if ($request->from_type !== 'folder') {
|
||||||
}
|
$file = FileManagerFile::where('unique_id', $unique_id)
|
||||||
|
->where('user_id', $shared->user_id)
|
||||||
/**
|
|
||||||
* Check if user has access to requested folder
|
|
||||||
*
|
|
||||||
* @param $request
|
|
||||||
*/
|
|
||||||
protected function check_access($request, $parent_id): void
|
|
||||||
{
|
|
||||||
// check if shared_token cookie exist
|
|
||||||
if (! $request->hasCookie('shared_token')) abort('401');
|
|
||||||
|
|
||||||
// Get shared token
|
|
||||||
$shared = Share::where(DB::raw('BINARY `token`'), $request->cookie('shared_token'))
|
|
||||||
->firstOrFail();
|
->firstOrFail();
|
||||||
|
|
||||||
// Get all children folders
|
$moving_unique_id = $file->folder_id;
|
||||||
$foldersIds = FileManagerFolder::with('folders:id,parent_id,unique_id,name')
|
}
|
||||||
->where('user_id', $shared->user_id)
|
|
||||||
->where('parent_id', $shared->item_id)
|
|
||||||
->get();
|
|
||||||
|
|
||||||
// Get all authorized parent folders by shared folder as root of tree
|
// Check access to requested item
|
||||||
$accessible_folder_ids = Arr::flatten([filter_folders_ids($foldersIds), $shared->item_id]);
|
Guardian::check_item_access([
|
||||||
|
$request->to_unique_id, $moving_unique_id
|
||||||
|
], $shared);
|
||||||
|
|
||||||
// Check user access
|
// Move item
|
||||||
if (!in_array($parent_id, $accessible_folder_ids)) abort(403);
|
Editor::move($request, $unique_id, $shared);
|
||||||
|
|
||||||
|
return response('Done!', 204);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,6 +89,7 @@ class ShareController extends Controller
|
|||||||
*
|
*
|
||||||
* @param $token
|
* @param $token
|
||||||
* @return ResponseFactory|\Illuminate\Http\Response
|
* @return ResponseFactory|\Illuminate\Http\Response
|
||||||
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function destroy($token)
|
public function destroy($token)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Sharing;
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Requests\Share\AuthenticateShareRequest;
|
use App\Http\Requests\Share\AuthenticateShareRequest;
|
||||||
use App\Http\Resources\ShareResource;
|
use App\Http\Resources\ShareResource;
|
||||||
|
use App\Http\Tools\Guardian;
|
||||||
use Illuminate\Contracts\View\Factory;
|
use Illuminate\Contracts\View\Factory;
|
||||||
use Illuminate\Support\Facades\Cookie;
|
use Illuminate\Support\Facades\Cookie;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
@@ -91,7 +92,7 @@ class FileSharingController extends Controller
|
|||||||
$shared = Share::where('token', $request->cookie('shared_token'))->firstOrFail();
|
$shared = Share::where('token', $request->cookie('shared_token'))->firstOrFail();
|
||||||
|
|
||||||
// Check if user can get directory
|
// Check if user can get directory
|
||||||
$this->check_folder_access($unique_id, $shared);
|
Guardian::check_item_access($unique_id, $shared);
|
||||||
|
|
||||||
// Get files and folders
|
// Get files and folders
|
||||||
list($folders, $files) = $this->get_items($unique_id, $shared);
|
list($folders, $files) = $this->get_items($unique_id, $shared);
|
||||||
@@ -117,7 +118,7 @@ class FileSharingController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if user can get directory
|
// Check if user can get directory
|
||||||
$this->check_folder_access($unique_id, $shared);
|
Guardian::check_item_access($unique_id, $shared);
|
||||||
|
|
||||||
// Get files and folders
|
// Get files and folders
|
||||||
list($folders, $files) = $this->get_items($unique_id, $shared);
|
list($folders, $files) = $this->get_items($unique_id, $shared);
|
||||||
@@ -177,24 +178,64 @@ class FileSharingController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if user has access to requested folder
|
* Get navigation tree
|
||||||
*
|
*
|
||||||
* @param $folder_unique_id
|
* @param Request $request
|
||||||
* @param $shared
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function check_folder_access($unique_id, $shared): void
|
public function get_private_navigation_tree(Request $request)
|
||||||
{
|
{
|
||||||
// Get all children folders
|
// Get sharing record
|
||||||
$foldersIds = FileManagerFolder::with('folders:id,parent_id,unique_id,name')
|
$shared = Share::where('token', $request->cookie('shared_token'))->firstOrFail();
|
||||||
->where('user_id', $shared->user_id)
|
|
||||||
|
// Check if user can get directory
|
||||||
|
Guardian::check_item_access($shared->item_id, $shared);
|
||||||
|
|
||||||
|
// Get folders
|
||||||
|
$folders = FileManagerFolder::with('folders:id,parent_id,unique_id,name')
|
||||||
->where('parent_id', $shared->item_id)
|
->where('parent_id', $shared->item_id)
|
||||||
->get();
|
->where('user_id', $shared->user_id)
|
||||||
|
->get(['id', 'parent_id', 'unique_id', 'name']);
|
||||||
|
|
||||||
// Get all authorized parent folders by shared folder as root of tree
|
// Return folder tree
|
||||||
$accessible_folder_ids = Arr::flatten([filter_folders_ids($foldersIds), $shared->item_id]);
|
return [
|
||||||
|
[
|
||||||
|
'unique_id' => $shared->item_id,
|
||||||
|
'name' => __('vuefilemanager.home'),
|
||||||
|
'location' => 'public',
|
||||||
|
'folders' => $folders,
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
// Check user access
|
/**
|
||||||
if (!in_array($unique_id, $accessible_folder_ids)) abort(401);
|
* Get navigation tree
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function get_public_navigation_tree($token)
|
||||||
|
{
|
||||||
|
// Get sharing record
|
||||||
|
$shared = Share::where('token', $token)->firstOrFail();
|
||||||
|
|
||||||
|
// Check if user can get directory
|
||||||
|
Guardian::check_item_access($shared->item_id, $shared);
|
||||||
|
|
||||||
|
// Get folders
|
||||||
|
$folders = FileManagerFolder::with('folders:id,parent_id,unique_id,name')
|
||||||
|
->where('parent_id', $shared->item_id)
|
||||||
|
->where('user_id', $shared->user_id)
|
||||||
|
->get(['id', 'parent_id', 'unique_id', 'name']);
|
||||||
|
|
||||||
|
// Return folder tree
|
||||||
|
return [
|
||||||
|
[
|
||||||
|
'unique_id' => $shared->item_id,
|
||||||
|
'name' => __('vuefilemanager.home'),
|
||||||
|
'location' => 'public',
|
||||||
|
'folders' => $folders,
|
||||||
|
]
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\FileFunctions;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class CreateFolderRequest extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine if the user is authorized to make this request.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function authorize()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'parent_id' => 'required|integer',
|
||||||
|
'name' => 'string',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\FileFunctions;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class DeleteItemRequest extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine if the user is authorized to make this request.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function authorize()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'type' => 'required|string',
|
||||||
|
'force_delete' => 'required|boolean',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\FileFunctions;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class MoveItemRequest extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine if the user is authorized to make this request.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function authorize()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'to_unique_id' => 'required|integer',
|
||||||
|
'from_type' => 'required|string',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\FileFunctions;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class RenameItemRequest extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine if the user is authorized to make this request.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function authorize()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => 'required|string',
|
||||||
|
'type' => 'required|string',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\FileFunctions;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class UploadRequest extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine if the user is authorized to make this request.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function authorize()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'parent_id' => 'required|integer',
|
||||||
|
'file' => 'required|file',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,272 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Tools;
|
||||||
|
|
||||||
|
use App;
|
||||||
|
use App\FileManagerFile;
|
||||||
|
use App\FileManagerFolder;
|
||||||
|
use App\Http\Requests\FileFunctions\RenameItemRequest;
|
||||||
|
use App\User;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Intervention\Image\ImageManagerStatic as Image;
|
||||||
|
|
||||||
|
|
||||||
|
class Editor
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create new directory
|
||||||
|
*
|
||||||
|
* @param $request
|
||||||
|
* @param null $shared
|
||||||
|
* @return FileManagerFolder|\Illuminate\Database\Eloquent\Model
|
||||||
|
*/
|
||||||
|
public static function create_folder($request, $shared = null)
|
||||||
|
{
|
||||||
|
// Get variables
|
||||||
|
$user_scope = is_null($shared) ? $request->user()->token()->scopes[0] : 'editor';
|
||||||
|
$name = $request->has('name') ? $request->input('name') : 'New Folder';
|
||||||
|
$user_id = is_null($shared) ? Auth::id() : $shared->user_id;
|
||||||
|
|
||||||
|
// Create folder
|
||||||
|
$folder = FileManagerFolder::create([
|
||||||
|
'parent_id' => $request->parent_id,
|
||||||
|
'unique_id' => get_unique_id(),
|
||||||
|
'user_scope' => $user_scope,
|
||||||
|
'user_id' => $user_id,
|
||||||
|
'type' => 'folder',
|
||||||
|
'name' => $name,
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Return new folder
|
||||||
|
return $folder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rename item name
|
||||||
|
*
|
||||||
|
* @param RenameItemRequest $request
|
||||||
|
* @param $unique_id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public static function rename_item($request, $unique_id, $shared = null)
|
||||||
|
{
|
||||||
|
// Get user id
|
||||||
|
$user_id = is_null($shared) ? Auth::id() : $shared->user_id;
|
||||||
|
|
||||||
|
// Get item
|
||||||
|
$item = get_item($request->type, $unique_id, $user_id);
|
||||||
|
|
||||||
|
// Rename item
|
||||||
|
$item->update([
|
||||||
|
'name' => $request->name
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Return updated item
|
||||||
|
return $item;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete file or folder
|
||||||
|
*
|
||||||
|
* @param $request
|
||||||
|
* @param $unique_id
|
||||||
|
* @param null $shared
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
|
public static function delete_item($request, $unique_id, $shared = null)
|
||||||
|
{
|
||||||
|
// Get user id
|
||||||
|
$user = is_null($shared) ? Auth::user() : User::findOrFail($shared->user_id);
|
||||||
|
|
||||||
|
// Delete folder
|
||||||
|
if ($request->type === 'folder') {
|
||||||
|
|
||||||
|
// Get folder
|
||||||
|
$folder = FileManagerFolder::withTrashed()
|
||||||
|
->with(['folders'])
|
||||||
|
->where('user_id', $user->id)
|
||||||
|
->where('unique_id', $unique_id)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
// TODO: delete folder shared record
|
||||||
|
|
||||||
|
// Force delete children files
|
||||||
|
if ($request->force_delete) {
|
||||||
|
|
||||||
|
// Get children folder ids
|
||||||
|
$child_folders = filter_folders_ids($folder->trashed_folders, 'unique_id');
|
||||||
|
|
||||||
|
// Get children files
|
||||||
|
$files = FileManagerFile::onlyTrashed()
|
||||||
|
->where('user_id', $user->id)
|
||||||
|
->whereIn('folder_id', Arr::flatten([$unique_id, $child_folders]))
|
||||||
|
->get();
|
||||||
|
|
||||||
|
// Remove all children files
|
||||||
|
foreach ($files as $file) {
|
||||||
|
|
||||||
|
// Delete file
|
||||||
|
Storage::disk('local')->delete('/file-manager/' . $file->basename);
|
||||||
|
|
||||||
|
// Delete thumbnail if exist
|
||||||
|
if (!is_null($file->thumbnail)) Storage::disk('local')->delete('/file-manager/' . $file->getOriginal('thumbnail'));
|
||||||
|
|
||||||
|
// Delete file permanently
|
||||||
|
$file->forceDelete();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete folder record
|
||||||
|
$folder->forceDelete();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Soft delete items
|
||||||
|
if (!$request->force_delete) {
|
||||||
|
|
||||||
|
// Remove folder from user favourites
|
||||||
|
$user->favourites()->detach($unique_id);
|
||||||
|
|
||||||
|
// Soft delete folder record
|
||||||
|
$folder->delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete item
|
||||||
|
if ($request->type !== 'folder') {
|
||||||
|
|
||||||
|
// Get file
|
||||||
|
$file = FileManagerFile::withTrashed()
|
||||||
|
->where('user_id', $user->id)
|
||||||
|
->where('unique_id', $unique_id)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
// TODO: delete file shared record
|
||||||
|
|
||||||
|
// Force delete file
|
||||||
|
if ($request->force_delete) {
|
||||||
|
|
||||||
|
// Delete file
|
||||||
|
Storage::disk('local')->delete('/file-manager/' . $file->basename);
|
||||||
|
|
||||||
|
// Delete thumbnail if exist
|
||||||
|
if ($file->thumbnail) Storage::disk('local')->delete('/file-manager/' . $file->getOriginal('thumbnail'));
|
||||||
|
|
||||||
|
// Delete file permanently
|
||||||
|
$file->forceDelete();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Soft delete file
|
||||||
|
if (!$request->force_delete) {
|
||||||
|
|
||||||
|
// Soft delete file
|
||||||
|
$file->delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Upload file
|
||||||
|
*
|
||||||
|
* @param $request
|
||||||
|
* @param $unique_id
|
||||||
|
* @param null $shared
|
||||||
|
* @return FileManagerFile|\Illuminate\Database\Eloquent\Model
|
||||||
|
*/
|
||||||
|
public static function upload($request, $shared = null)
|
||||||
|
{
|
||||||
|
// Get user data
|
||||||
|
$user_scope = is_null($shared) ? $request->user()->token()->scopes[0] : 'editor';
|
||||||
|
$user_id = is_null($shared) ? Auth::id() : $shared->user_id;
|
||||||
|
|
||||||
|
// Get parent_id from request
|
||||||
|
$folder_id = $request->parent_id === 0 ? 0 : $request->parent_id;
|
||||||
|
$file = $request->file('file');
|
||||||
|
|
||||||
|
// File
|
||||||
|
$filename = Str::random() . '-' . str_replace(' ', '', $file->getClientOriginalName());
|
||||||
|
$filetype = get_file_type($file);
|
||||||
|
$filesize = $file->getSize();
|
||||||
|
$directory = 'file-manager';
|
||||||
|
$thumbnail = null;
|
||||||
|
|
||||||
|
// create directory if not exist
|
||||||
|
if (!Storage::disk('local')->exists($directory)) {
|
||||||
|
Storage::disk('local')->makeDirectory($directory);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store to disk
|
||||||
|
Storage::disk('local')->putFileAs($directory, $file, $filename, 'public');
|
||||||
|
|
||||||
|
// Create image thumbnail
|
||||||
|
if ($filetype == 'image') {
|
||||||
|
|
||||||
|
// Get thumbnail name
|
||||||
|
$thumbnail = 'thumbnail-' . $filename;
|
||||||
|
|
||||||
|
// Create intervention image
|
||||||
|
$image = Image::make($file->getRealPath())->orientate();
|
||||||
|
|
||||||
|
// Resize image
|
||||||
|
$image->resize(256, null, function ($constraint) {
|
||||||
|
$constraint->aspectRatio();
|
||||||
|
})->stream();
|
||||||
|
|
||||||
|
// Store thumbnail to disk
|
||||||
|
Storage::disk('local')->put($directory . '/' . $thumbnail, $image);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store file
|
||||||
|
$options = [
|
||||||
|
'name' => pathinfo($file->getClientOriginalName())['filename'],
|
||||||
|
'mimetype' => $file->getClientOriginalExtension(),
|
||||||
|
'unique_id' => get_unique_id(),
|
||||||
|
'user_scope' => $user_scope,
|
||||||
|
'folder_id' => $folder_id,
|
||||||
|
'thumbnail' => $thumbnail,
|
||||||
|
'basename' => $filename,
|
||||||
|
'filesize' => $filesize,
|
||||||
|
'type' => $filetype,
|
||||||
|
'user_id' => $user_id,
|
||||||
|
];
|
||||||
|
|
||||||
|
// Return new file
|
||||||
|
return FileManagerFile::create($options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move folder or file to new location
|
||||||
|
*
|
||||||
|
* @param $request
|
||||||
|
* @param $unique_id
|
||||||
|
* @param null $shared
|
||||||
|
*/
|
||||||
|
public static function move($request, $unique_id, $shared = null)
|
||||||
|
{
|
||||||
|
// Get user id
|
||||||
|
$user_id = is_null($shared) ? Auth::id() : $shared->user_id;
|
||||||
|
|
||||||
|
if ($request->from_type === 'folder') {
|
||||||
|
|
||||||
|
// Move folder
|
||||||
|
$item = FileManagerFolder::where('user_id', $user_id)
|
||||||
|
->where('unique_id', $unique_id)
|
||||||
|
->firstOrFail();
|
||||||
|
|
||||||
|
$item->update([
|
||||||
|
'parent_id' => $request->to_unique_id
|
||||||
|
]);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Move file under new folder
|
||||||
|
$item = FileManagerFile::where('user_id', $user_id)
|
||||||
|
->where('unique_id', $unique_id)
|
||||||
|
->firstOrFail();
|
||||||
|
|
||||||
|
$item->update([
|
||||||
|
'folder_id' => $request->to_unique_id
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Tools;
|
||||||
|
|
||||||
|
use App;
|
||||||
|
use App\FileManagerFolder;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
|
|
||||||
|
class Guardian
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Check access to requested directory
|
||||||
|
*
|
||||||
|
* @param integer|array $requested_id
|
||||||
|
* @param string $shared Shared record detail
|
||||||
|
*/
|
||||||
|
public static function check_item_access($requested_id, $shared)
|
||||||
|
{
|
||||||
|
// Get all children folders
|
||||||
|
$foldersIds = FileManagerFolder::with('folders:id,parent_id,unique_id,name')
|
||||||
|
->where('user_id', $shared->user_id)
|
||||||
|
->where('parent_id', $shared->item_id)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
// Get all authorized parent folders by shared folder as root of tree
|
||||||
|
$accessible_folder_ids = Arr::flatten([filter_folders_ids($foldersIds), $shared->item_id]);
|
||||||
|
|
||||||
|
// Check user access
|
||||||
|
if ( is_array($requested_id) ) {
|
||||||
|
foreach ($requested_id as $id) {
|
||||||
|
if (!in_array($id, $accessible_folder_ids))
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! is_array($requested_id)) {
|
||||||
|
if (! in_array($requested_id, $accessible_folder_ids))
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+73
-2
@@ -1,11 +1,83 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use App\FileManagerFile;
|
||||||
|
use App\FileManagerFolder;
|
||||||
|
use App\Share;
|
||||||
use ByteUnits\Metric;
|
use ByteUnits\Metric;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Intervention\Image\ImageManagerStatic as Image;
|
use Intervention\Image\ImageManagerStatic as Image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get folder or file item
|
||||||
|
*
|
||||||
|
* @param $type
|
||||||
|
* @param $unique_id
|
||||||
|
* @param $user_id
|
||||||
|
* @return \Illuminate\Database\Eloquent\Builder|Model
|
||||||
|
*/
|
||||||
|
function get_item($type, $unique_id, $user_id) {
|
||||||
|
|
||||||
|
if ($type === 'folder') {
|
||||||
|
|
||||||
|
// Return folder item
|
||||||
|
return FileManagerFolder::where('unique_id', $unique_id)
|
||||||
|
->where('user_id', $user_id)
|
||||||
|
->firstOrFail();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return file item
|
||||||
|
return FileManagerFile::where('unique_id', $unique_id)
|
||||||
|
->where('user_id', $user_id)
|
||||||
|
->firstOrFail();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get shared token
|
||||||
|
*
|
||||||
|
* @param $token
|
||||||
|
* @return \Illuminate\Database\Eloquent\Builder|Model
|
||||||
|
*/
|
||||||
|
function get_shared($token) {
|
||||||
|
|
||||||
|
return Share::where(DB::raw('BINARY `token`'), $token)
|
||||||
|
->firstOrFail();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if shared permission is editor
|
||||||
|
*
|
||||||
|
* @param $shared
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
function is_editor($shared) {
|
||||||
|
|
||||||
|
return $shared->permission === 'editor';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get unique id
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
function get_unique_id(): int
|
||||||
|
{
|
||||||
|
// Get files and folders
|
||||||
|
$folders = FileManagerFolder::withTrashed()->get();
|
||||||
|
$files = FileManagerFile::withTrashed()->get();
|
||||||
|
|
||||||
|
// Get last ids
|
||||||
|
$folders_unique = $folders->isEmpty() ? 0 : $folders->last()->unique_id;
|
||||||
|
$files_unique = $files->isEmpty() ? 0 : $files->last()->unique_id;
|
||||||
|
|
||||||
|
// Count new unique id
|
||||||
|
$unique_id = $folders_unique > $files_unique ? $folders_unique + 1 : $files_unique + 1;
|
||||||
|
|
||||||
|
return $unique_id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store user avatar to storage
|
* Store user avatar to storage
|
||||||
@@ -102,8 +174,7 @@ function get_storage_fill_percentage($used, $capacity)
|
|||||||
*/
|
*/
|
||||||
function user_storage_percentage()
|
function user_storage_percentage()
|
||||||
{
|
{
|
||||||
|
$user = Auth::user();
|
||||||
$user = \Illuminate\Support\Facades\Auth::user();
|
|
||||||
|
|
||||||
return get_storage_fill_percentage($user->used_capacity, config('vuefilemanager.user_storage_capacity'));
|
return get_storage_fill_percentage($user->used_capacity, config('vuefilemanager.user_storage_capacity'));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,97 @@
|
|||||||
{
|
{
|
||||||
"/js/main.js": "/js/main.js",
|
"/js/main.js": "/js/main.js",
|
||||||
"/css/app.css": "/css/app.css",
|
"/css/app.css": "/css/app.css",
|
||||||
"/js/main.9a27394a2df24ee693e3.hot-update.js": "/js/main.9a27394a2df24ee693e3.hot-update.js"
|
"/js/main.9a27394a2df24ee693e3.hot-update.js": "/js/main.9a27394a2df24ee693e3.hot-update.js",
|
||||||
|
"/js/main.26f701f7b52599858cce.hot-update.js": "/js/main.26f701f7b52599858cce.hot-update.js",
|
||||||
|
"/js/main.5121a1dc87cc3f3442cd.hot-update.js": "/js/main.5121a1dc87cc3f3442cd.hot-update.js",
|
||||||
|
"/js/main.8b54f2c597a60d415870.hot-update.js": "/js/main.8b54f2c597a60d415870.hot-update.js",
|
||||||
|
"/js/main.53935909cecacef877d0.hot-update.js": "/js/main.53935909cecacef877d0.hot-update.js",
|
||||||
|
"/js/main.6e0d2ac0add6c3e6dc84.hot-update.js": "/js/main.6e0d2ac0add6c3e6dc84.hot-update.js",
|
||||||
|
"/js/main.bcef9d636d3dfe572ecc.hot-update.js": "/js/main.bcef9d636d3dfe572ecc.hot-update.js",
|
||||||
|
"/js/main.07de0a9dbfed267ff7b2.hot-update.js": "/js/main.07de0a9dbfed267ff7b2.hot-update.js",
|
||||||
|
"/js/main.549012c4fffc95472aa6.hot-update.js": "/js/main.549012c4fffc95472aa6.hot-update.js",
|
||||||
|
"/js/main.ea575a8d60a5a25453e4.hot-update.js": "/js/main.ea575a8d60a5a25453e4.hot-update.js",
|
||||||
|
"/js/main.880f1e5ff9834e6633ec.hot-update.js": "/js/main.880f1e5ff9834e6633ec.hot-update.js",
|
||||||
|
"/js/main.9cd0cd846091e6779623.hot-update.js": "/js/main.9cd0cd846091e6779623.hot-update.js",
|
||||||
|
"/js/main.435761e62a7eba7f7511.hot-update.js": "/js/main.435761e62a7eba7f7511.hot-update.js",
|
||||||
|
"/js/main.8ef42b97a65fa42e754c.hot-update.js": "/js/main.8ef42b97a65fa42e754c.hot-update.js",
|
||||||
|
"/js/main.801802ad6742f1431b33.hot-update.js": "/js/main.801802ad6742f1431b33.hot-update.js",
|
||||||
|
"/js/main.712419afb068ad058a73.hot-update.js": "/js/main.712419afb068ad058a73.hot-update.js",
|
||||||
|
"/js/main.559f1d43ac058be060f7.hot-update.js": "/js/main.559f1d43ac058be060f7.hot-update.js",
|
||||||
|
"/js/main.d8b716639ab25f3dc50a.hot-update.js": "/js/main.d8b716639ab25f3dc50a.hot-update.js",
|
||||||
|
"/js/main.efd3e8d2d7598c6c5ad5.hot-update.js": "/js/main.efd3e8d2d7598c6c5ad5.hot-update.js",
|
||||||
|
"/js/main.a337a75d4abd0a14c156.hot-update.js": "/js/main.a337a75d4abd0a14c156.hot-update.js",
|
||||||
|
"/js/main.40d1dab8fa1b64701590.hot-update.js": "/js/main.40d1dab8fa1b64701590.hot-update.js",
|
||||||
|
"/js/main.7fc88aadbaf4dddd1177.hot-update.js": "/js/main.7fc88aadbaf4dddd1177.hot-update.js",
|
||||||
|
"/js/main.68350763e369b5ff2093.hot-update.js": "/js/main.68350763e369b5ff2093.hot-update.js",
|
||||||
|
"/js/main.6284a84d480e86837360.hot-update.js": "/js/main.6284a84d480e86837360.hot-update.js",
|
||||||
|
"/js/main.25ee0aa3ee03e3e8b38f.hot-update.js": "/js/main.25ee0aa3ee03e3e8b38f.hot-update.js",
|
||||||
|
"/js/main.2e26a22377d42ebff156.hot-update.js": "/js/main.2e26a22377d42ebff156.hot-update.js",
|
||||||
|
"/js/main.b59bbae58419a6b486cf.hot-update.js": "/js/main.b59bbae58419a6b486cf.hot-update.js",
|
||||||
|
"/js/main.d2355590570597337ecf.hot-update.js": "/js/main.d2355590570597337ecf.hot-update.js",
|
||||||
|
"/js/main.60d4eefa65e064d28377.hot-update.js": "/js/main.60d4eefa65e064d28377.hot-update.js",
|
||||||
|
"/js/main.4167e6ccc3b10d70c878.hot-update.js": "/js/main.4167e6ccc3b10d70c878.hot-update.js",
|
||||||
|
"/js/main.1d8dd28c32fe1ebb0f90.hot-update.js": "/js/main.1d8dd28c32fe1ebb0f90.hot-update.js",
|
||||||
|
"/js/main.ad773a1236560dfa16b9.hot-update.js": "/js/main.ad773a1236560dfa16b9.hot-update.js",
|
||||||
|
"/js/main.34c776e9045fb0e219c3.hot-update.js": "/js/main.34c776e9045fb0e219c3.hot-update.js",
|
||||||
|
"/js/main.092895cf0d85296ec513.hot-update.js": "/js/main.092895cf0d85296ec513.hot-update.js",
|
||||||
|
"/js/main.a46dde16305495525978.hot-update.js": "/js/main.a46dde16305495525978.hot-update.js",
|
||||||
|
"/js/main.b9df9d4300e51d62c760.hot-update.js": "/js/main.b9df9d4300e51d62c760.hot-update.js",
|
||||||
|
"/js/main.ef40152e201f13bc6b7b.hot-update.js": "/js/main.ef40152e201f13bc6b7b.hot-update.js",
|
||||||
|
"/js/main.03e94dd396114f5ce51f.hot-update.js": "/js/main.03e94dd396114f5ce51f.hot-update.js",
|
||||||
|
"/js/main.ae8691214086a1aafe6d.hot-update.js": "/js/main.ae8691214086a1aafe6d.hot-update.js",
|
||||||
|
"/js/main.42070d8db8abc6c57f08.hot-update.js": "/js/main.42070d8db8abc6c57f08.hot-update.js",
|
||||||
|
"/js/main.ff4a9feafb80b24156ea.hot-update.js": "/js/main.ff4a9feafb80b24156ea.hot-update.js",
|
||||||
|
"/js/main.a75b114c09bd29e14d0c.hot-update.js": "/js/main.a75b114c09bd29e14d0c.hot-update.js",
|
||||||
|
"/js/main.3c80fdca8d8a4151fec5.hot-update.js": "/js/main.3c80fdca8d8a4151fec5.hot-update.js",
|
||||||
|
"/js/main.ce2a2b97c841955d6004.hot-update.js": "/js/main.ce2a2b97c841955d6004.hot-update.js",
|
||||||
|
"/js/main.32b5fdecf37fed13cd9a.hot-update.js": "/js/main.32b5fdecf37fed13cd9a.hot-update.js",
|
||||||
|
"/js/main.7a89ccb6115f0faacdfb.hot-update.js": "/js/main.7a89ccb6115f0faacdfb.hot-update.js",
|
||||||
|
"/js/main.92699644dc4433d69518.hot-update.js": "/js/main.92699644dc4433d69518.hot-update.js",
|
||||||
|
"/js/main.95ab80867410adfb44d4.hot-update.js": "/js/main.95ab80867410adfb44d4.hot-update.js",
|
||||||
|
"/js/main.15ec5d8a6721629ca107.hot-update.js": "/js/main.15ec5d8a6721629ca107.hot-update.js",
|
||||||
|
"/js/main.7c08936d73cc17d9f314.hot-update.js": "/js/main.7c08936d73cc17d9f314.hot-update.js",
|
||||||
|
"/js/main.3d44fb777bb96f9cfdb7.hot-update.js": "/js/main.3d44fb777bb96f9cfdb7.hot-update.js",
|
||||||
|
"/js/main.98249452457878999097.hot-update.js": "/js/main.98249452457878999097.hot-update.js",
|
||||||
|
"/js/main.254701868eb16ecc7ceb.hot-update.js": "/js/main.254701868eb16ecc7ceb.hot-update.js",
|
||||||
|
"/js/main.73bb5ad5ec65301443bd.hot-update.js": "/js/main.73bb5ad5ec65301443bd.hot-update.js",
|
||||||
|
"/js/main.d3e2774f2e315b7c16b5.hot-update.js": "/js/main.d3e2774f2e315b7c16b5.hot-update.js",
|
||||||
|
"/js/main.e1c6df6a9c86ceb0f997.hot-update.js": "/js/main.e1c6df6a9c86ceb0f997.hot-update.js",
|
||||||
|
"/js/main.84e6dd621e31be103cb9.hot-update.js": "/js/main.84e6dd621e31be103cb9.hot-update.js",
|
||||||
|
"/js/main.f9b77ba27f8c37a3cab6.hot-update.js": "/js/main.f9b77ba27f8c37a3cab6.hot-update.js",
|
||||||
|
"/js/main.4568b1ac1065ffb6734b.hot-update.js": "/js/main.4568b1ac1065ffb6734b.hot-update.js",
|
||||||
|
"/js/main.34dd57888d1ba88b8b51.hot-update.js": "/js/main.34dd57888d1ba88b8b51.hot-update.js",
|
||||||
|
"/js/main.427a9203ec38e951d238.hot-update.js": "/js/main.427a9203ec38e951d238.hot-update.js",
|
||||||
|
"/js/main.c0ef7695de0e2fb4df8f.hot-update.js": "/js/main.c0ef7695de0e2fb4df8f.hot-update.js",
|
||||||
|
"/js/main.d1ac8bf7abe8c3cab86f.hot-update.js": "/js/main.d1ac8bf7abe8c3cab86f.hot-update.js",
|
||||||
|
"/js/main.89cd5452893cfa0c4306.hot-update.js": "/js/main.89cd5452893cfa0c4306.hot-update.js",
|
||||||
|
"/js/main.9efa7621633482f41475.hot-update.js": "/js/main.9efa7621633482f41475.hot-update.js",
|
||||||
|
"/js/main.64f6c551250c31f1a04f.hot-update.js": "/js/main.64f6c551250c31f1a04f.hot-update.js",
|
||||||
|
"/js/main.afa8179642bbf412e95a.hot-update.js": "/js/main.afa8179642bbf412e95a.hot-update.js",
|
||||||
|
"/js/main.5c4a761e3d1b8ae3e586.hot-update.js": "/js/main.5c4a761e3d1b8ae3e586.hot-update.js",
|
||||||
|
"/js/main.0ceed72f1427b5958022.hot-update.js": "/js/main.0ceed72f1427b5958022.hot-update.js",
|
||||||
|
"/js/main.6131813f3daf3dbf18df.hot-update.js": "/js/main.6131813f3daf3dbf18df.hot-update.js",
|
||||||
|
"/js/main.1d7089edabf59ca7143b.hot-update.js": "/js/main.1d7089edabf59ca7143b.hot-update.js",
|
||||||
|
"/js/main.835a0e8499a6e9ce3eb6.hot-update.js": "/js/main.835a0e8499a6e9ce3eb6.hot-update.js",
|
||||||
|
"/js/main.34ca6eeac2f66555a259.hot-update.js": "/js/main.34ca6eeac2f66555a259.hot-update.js",
|
||||||
|
"/js/main.b103b99817043bcec0ee.hot-update.js": "/js/main.b103b99817043bcec0ee.hot-update.js",
|
||||||
|
"/js/main.2f39160d1e959ee8065e.hot-update.js": "/js/main.2f39160d1e959ee8065e.hot-update.js",
|
||||||
|
"/js/main.9ebf2fb72f11bfa290af.hot-update.js": "/js/main.9ebf2fb72f11bfa290af.hot-update.js",
|
||||||
|
"/js/main.a55c90d56d628ca5983b.hot-update.js": "/js/main.a55c90d56d628ca5983b.hot-update.js",
|
||||||
|
"/js/main.c77fe61a6e467daa6312.hot-update.js": "/js/main.c77fe61a6e467daa6312.hot-update.js",
|
||||||
|
"/js/main.2b72fda2d2b42a05b446.hot-update.js": "/js/main.2b72fda2d2b42a05b446.hot-update.js",
|
||||||
|
"/js/main.ae606d26a4b1b2344ca2.hot-update.js": "/js/main.ae606d26a4b1b2344ca2.hot-update.js",
|
||||||
|
"/js/main.5bd37eed26fa598948d5.hot-update.js": "/js/main.5bd37eed26fa598948d5.hot-update.js",
|
||||||
|
"/js/main.130254a5160e0ef992a1.hot-update.js": "/js/main.130254a5160e0ef992a1.hot-update.js",
|
||||||
|
"/js/main.5fa2ead36e925d546d3d.hot-update.js": "/js/main.5fa2ead36e925d546d3d.hot-update.js",
|
||||||
|
"/js/main.dba558d979b0090f27dd.hot-update.js": "/js/main.dba558d979b0090f27dd.hot-update.js",
|
||||||
|
"/js/main.44e728d411a734bc1a30.hot-update.js": "/js/main.44e728d411a734bc1a30.hot-update.js",
|
||||||
|
"/js/main.9301a0253ea88d48eaec.hot-update.js": "/js/main.9301a0253ea88d48eaec.hot-update.js",
|
||||||
|
"/js/main.c32533dd170b4ad36995.hot-update.js": "/js/main.c32533dd170b4ad36995.hot-update.js",
|
||||||
|
"/js/main.70d54b5f4ad55603282c.hot-update.js": "/js/main.70d54b5f4ad55603282c.hot-update.js",
|
||||||
|
"/js/main.ae3ebc3222124628f432.hot-update.js": "/js/main.ae3ebc3222124628f432.hot-update.js",
|
||||||
|
"/js/main.cd30cc7c96f7330f1e28.hot-update.js": "/js/main.cd30cc7c96f7330f1e28.hot-update.js",
|
||||||
|
"/js/main.6d71eff38004e48494e6.hot-update.js": "/js/main.6d71eff38004e48494e6.hot-update.js",
|
||||||
|
"/js/main.e0368145878abbdceab2.hot-update.js": "/js/main.e0368145878abbdceab2.hot-update.js",
|
||||||
|
"/js/main.63bc86c9bdf936a03d56.hot-update.js": "/js/main.63bc86c9bdf936a03d56.hot-update.js"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,13 +31,13 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MobileMenu from '@/components/VueFileManagerComponents/FilesView/MobileMenu'
|
import MobileMenu from '@/components/FilesView/MobileMenu'
|
||||||
import ShareCreate from '@/components/VueFileManagerComponents/Others/ShareCreate'
|
import ShareCreate from '@/components/Others/ShareCreate'
|
||||||
import ShareEdit from '@/components/VueFileManagerComponents/Others/ShareEdit'
|
import ShareEdit from '@/components/Others/ShareEdit'
|
||||||
import MoveItem from '@/components/VueFileManagerComponents/Others/MoveItem'
|
import MoveItem from '@/components/Others/MoveItem'
|
||||||
import Vignette from '@/components/VueFileManagerComponents/Others/Vignette'
|
import Vignette from '@/components/Others/Vignette'
|
||||||
import Sidebar from '@/components/VueFileManagerComponents/Sidebar/Sidebar'
|
import Sidebar from '@/components/Sidebar/Sidebar'
|
||||||
import Alert from '@/components/VueFileManagerComponents/FilesView/Alert'
|
import Alert from '@/components/FilesView/Alert'
|
||||||
import {ResizeSensor} from 'css-element-queries'
|
import {ResizeSensor} from 'css-element-queries'
|
||||||
import { includes } from 'lodash'
|
import { includes } from 'lodash'
|
||||||
import {mapGetters} from 'vuex'
|
import {mapGetters} from 'vuex'
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ButtonBase from '@/components/VueFileManagerComponents/FilesView/ButtonBase'
|
import ButtonBase from '@/components/FilesView/ButtonBase'
|
||||||
import {events} from '@/bus'
|
import {events} from '@/bus'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
+7
-9
@@ -46,7 +46,7 @@
|
|||||||
<div class="toolbar-button-wrapper">
|
<div class="toolbar-button-wrapper">
|
||||||
<ToolbarButton
|
<ToolbarButton
|
||||||
:source="preview"
|
:source="preview"
|
||||||
action=""
|
action="Change Preview"
|
||||||
@click.native="$store.dispatch('changePreviewType')"
|
@click.native="$store.dispatch('changePreviewType')"
|
||||||
/>
|
/>
|
||||||
<ToolbarButton
|
<ToolbarButton
|
||||||
@@ -62,10 +62,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ToolbarButtonUpload from '@/components/VueFileManagerComponents/FilesView/ToolbarButtonUpload'
|
import ToolbarButtonUpload from '@/components/FilesView/ToolbarButtonUpload'
|
||||||
import UploadProgress from '@/components/VueFileManagerComponents/FilesView/UploadProgress'
|
import UploadProgress from '@/components/FilesView/UploadProgress'
|
||||||
import ToolbarButton from '@/components/VueFileManagerComponents/FilesView/ToolbarButton'
|
import ToolbarButton from '@/components/FilesView/ToolbarButton'
|
||||||
import SearchBar from '@/components/VueFileManagerComponents/FilesView/SearchBar'
|
import SearchBar from '@/components/FilesView/SearchBar'
|
||||||
import {mapGetters} from 'vuex'
|
import {mapGetters} from 'vuex'
|
||||||
import {events} from '@/bus'
|
import {events} from '@/bus'
|
||||||
|
|
||||||
@@ -97,9 +97,6 @@
|
|||||||
preview() {
|
preview() {
|
||||||
return this.FilePreviewType === 'list' ? 'th' : 'th-list'
|
return this.FilePreviewType === 'list' ? 'th' : 'th-list'
|
||||||
},
|
},
|
||||||
isTrash() {
|
|
||||||
return this.currentFolder.location === 'trash' || this.currentFolder.location === 'trash-root'
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -130,7 +127,8 @@
|
|||||||
events.$emit('items:delete')
|
events.$emit('items:delete')
|
||||||
},
|
},
|
||||||
createFolder() {
|
createFolder() {
|
||||||
if (! this.isTrash) this.$createFolder()
|
if (! this.$isThisLocation(['trash', 'trash-root']))
|
||||||
|
this.$createFolder()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
+2
-2
@@ -35,8 +35,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ButtonUpload from '@/components/VueFileManagerComponents/FilesView/ButtonUpload'
|
import ButtonUpload from '@/components/FilesView/ButtonUpload'
|
||||||
import Spinner from '@/components/VueFileManagerComponents/FilesView/Spinner'
|
import Spinner from '@/components/FilesView/Spinner'
|
||||||
import {mapGetters} from 'vuex'
|
import {mapGetters} from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
+8
-8
@@ -83,14 +83,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MobileToolbar from '@/components/VueFileManagerComponents/FilesView/MobileToolbar'
|
import MobileToolbar from '@/components/FilesView/MobileToolbar'
|
||||||
import MobileActions from '@/components/VueFileManagerComponents/FilesView/MobileActions'
|
import MobileActions from '@/components/FilesView/MobileActions'
|
||||||
import FileInfoPanel from '@/components/VueFileManagerComponents/FilesView/FileInfoPanel'
|
import FileInfoPanel from '@/components/FilesView/FileInfoPanel'
|
||||||
import FileItemList from '@/components/VueFileManagerComponents/FilesView/FileItemList'
|
import FileItemList from '@/components/FilesView/FileItemList'
|
||||||
import FileItemGrid from '@/components/VueFileManagerComponents/FilesView/FileItemGrid'
|
import FileItemGrid from '@/components/FilesView/FileItemGrid'
|
||||||
import EmptyMessage from '@/components/VueFileManagerComponents/FilesView/EmptyMessage'
|
import EmptyMessage from '@/components/FilesView/EmptyMessage'
|
||||||
import EmptyPage from '@/components/VueFileManagerComponents/FilesView/EmptyPage'
|
import EmptyPage from '@/components/FilesView/EmptyPage'
|
||||||
import SearchBar from '@/components/VueFileManagerComponents/FilesView/SearchBar'
|
import SearchBar from '@/components/FilesView/SearchBar'
|
||||||
import {mapGetters} from 'vuex'
|
import {mapGetters} from 'vuex'
|
||||||
import {events} from '@/bus'
|
import {events} from '@/bus'
|
||||||
|
|
||||||
+2
-2
@@ -65,8 +65,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import FilePreview from '@/components/VueFileManagerComponents/FilesView/FilePreview'
|
import FilePreview from '@/components/FilesView/FilePreview'
|
||||||
import CopyInput from '@/components/VueFileManagerComponents/Others/Forms/CopyInput'
|
import CopyInput from '@/components/Others/Forms/CopyInput'
|
||||||
import {mapGetters} from 'vuex'
|
import {mapGetters} from 'vuex'
|
||||||
import {events} from "@/bus"
|
import {events} from "@/bus"
|
||||||
|
|
||||||
+12
-2
@@ -7,7 +7,7 @@
|
|||||||
>
|
>
|
||||||
<!--Grid preview-->
|
<!--Grid preview-->
|
||||||
<div
|
<div
|
||||||
:draggable="! isDeleted"
|
:draggable="canDrag"
|
||||||
@dragstart="$emit('dragstart')"
|
@dragstart="$emit('dragstart')"
|
||||||
@drop="
|
@drop="
|
||||||
$emit('drop')
|
$emit('drop')
|
||||||
@@ -49,11 +49,17 @@
|
|||||||
</b>
|
</b>
|
||||||
|
|
||||||
<div class="item-info">
|
<div class="item-info">
|
||||||
|
|
||||||
<!--Shared Icon-->
|
<!--Shared Icon-->
|
||||||
<div v-if="$checkPermission('master') && data.shared" class="item-shared">
|
<div v-if="$checkPermission('master') && data.shared" class="item-shared">
|
||||||
<FontAwesomeIcon class="shared-icon" icon="user-friends"/>
|
<FontAwesomeIcon class="shared-icon" icon="user-friends"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!--Participant owner Icon-->
|
||||||
|
<div v-if="$checkPermission('master') && data.user_scope !== 'master'" class="item-shared">
|
||||||
|
<FontAwesomeIcon class="shared-icon" icon="user-edit"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!--Filesize-->
|
<!--Filesize-->
|
||||||
<span v-if="! isFolder" class="item-size">{{ data.filesize }}</span>
|
<span v-if="! isFolder" class="item-size">{{ data.filesize }}</span>
|
||||||
|
|
||||||
@@ -77,7 +83,7 @@
|
|||||||
import {events} from '@/bus'
|
import {events} from '@/bus'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'FileItem',
|
name: 'FileItemGrid',
|
||||||
props: ['data'],
|
props: ['data'],
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['FilePreviewType']),
|
...mapGetters(['FilePreviewType']),
|
||||||
@@ -93,6 +99,9 @@
|
|||||||
canEditName() {
|
canEditName() {
|
||||||
return !this.$isMobile() && !this.$isThisLocation(['trash', 'trash-root']) && !this.$checkPermission('visitor')
|
return !this.$isMobile() && !this.$isThisLocation(['trash', 'trash-root']) && !this.$checkPermission('visitor')
|
||||||
},
|
},
|
||||||
|
canDrag() {
|
||||||
|
return !this.isDeleted && this.$checkPermission(['master', 'editor'])
|
||||||
|
},
|
||||||
timeStamp() {
|
timeStamp() {
|
||||||
return this.data.deleted_at ? this.$t('item_thumbnail.deleted_at', this.data.deleted_at) : this.data.created_at
|
return this.data.deleted_at ? this.$t('item_thumbnail.deleted_at', this.data.deleted_at) : this.data.created_at
|
||||||
},
|
},
|
||||||
@@ -364,6 +373,7 @@
|
|||||||
height: 110px;
|
height: 110px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.folder-icon {
|
.folder-icon {
|
||||||
+9
-8
@@ -1,12 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
@click.stop="clickedItem" @dblclick="goToItem"
|
|
||||||
class="file-wrapper"
|
class="file-wrapper"
|
||||||
|
@click.stop="clickedItem"
|
||||||
|
@dblclick="goToItem"
|
||||||
spellcheck="false"
|
spellcheck="false"
|
||||||
>
|
>
|
||||||
<!--List preview-->
|
<!--List preview-->
|
||||||
<div
|
<div
|
||||||
:draggable="! isDeleted"
|
:draggable="canDrag"
|
||||||
@dragstart="$emit('dragstart')"
|
@dragstart="$emit('dragstart')"
|
||||||
@drop="
|
@drop="
|
||||||
$emit('drop')
|
$emit('drop')
|
||||||
@@ -84,7 +85,7 @@
|
|||||||
import {events} from '@/bus'
|
import {events} from '@/bus'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'FileItem',
|
name: 'FileItemList',
|
||||||
props: ['data'],
|
props: ['data'],
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['FilePreviewType']),
|
...mapGetters(['FilePreviewType']),
|
||||||
@@ -100,6 +101,9 @@
|
|||||||
canEditName() {
|
canEditName() {
|
||||||
return ! this.$isMobile() && ! this.$isThisLocation(['trash', 'trash-root']) && ! this.$checkPermission('visitor')
|
return ! this.$isMobile() && ! this.$isThisLocation(['trash', 'trash-root']) && ! this.$checkPermission('visitor')
|
||||||
},
|
},
|
||||||
|
canDrag() {
|
||||||
|
return ! this.isDeleted && this.$checkPermission(['master', 'editor'])
|
||||||
|
},
|
||||||
timeStamp() {
|
timeStamp() {
|
||||||
return this.data.deleted_at ? this.$t('item_thumbnail.deleted_at', {time: this.data.deleted_at}) : this.data.created_at
|
return this.data.deleted_at ? this.$t('item_thumbnail.deleted_at', {time: this.data.deleted_at}) : this.data.created_at
|
||||||
},
|
},
|
||||||
@@ -169,11 +173,7 @@
|
|||||||
// Get target classname
|
// Get target classname
|
||||||
let itemClass = e.target.className
|
let itemClass = e.target.className
|
||||||
|
|
||||||
if (
|
if (['name', 'icon', 'file-link', 'file-icon-text'].includes(itemClass))
|
||||||
['name', 'icon', 'file-link', 'file-icon-text'].includes(
|
|
||||||
itemClass
|
|
||||||
)
|
|
||||||
)
|
|
||||||
return
|
return
|
||||||
},
|
},
|
||||||
goToItem() {
|
goToItem() {
|
||||||
@@ -380,6 +380,7 @@
|
|||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
width: 50px;
|
width: 50px;
|
||||||
height: 50px;
|
height: 50px;
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+5
-5
@@ -12,7 +12,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--ContextMenu for Base location with MASTER permission-->
|
<!--ContextMenu for Base location with MASTER permission-->
|
||||||
<div v-if="$isThisLocation(['base', 'shared']) && $checkPermission(['master', 'editor'])" class="mobile-actions">
|
<div v-if="$isThisLocation(['base', 'shared', 'public']) && $checkPermission(['master', 'editor'])" class="mobile-actions">
|
||||||
<MobileActionButton @click.native="createFolder" icon="folder-plus">
|
<MobileActionButton @click.native="createFolder" icon="folder-plus">
|
||||||
{{ $t('context_menu.add_folder') }}
|
{{ $t('context_menu.add_folder') }}
|
||||||
</MobileActionButton>
|
</MobileActionButton>
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--ContextMenu for Base location with VISITOR permission-->
|
<!--ContextMenu for Base location with VISITOR permission-->
|
||||||
<div v-if="$isThisLocation(['base', 'shared']) && $checkPermission('visitor')" class="mobile-actions">
|
<div v-if="$isThisLocation(['base', 'shared', 'public']) && $checkPermission('visitor')" class="mobile-actions">
|
||||||
<MobileActionButton @click.native="switchPreview" :icon="previewIcon">
|
<MobileActionButton @click.native="switchPreview" :icon="previewIcon">
|
||||||
{{ previewText }}
|
{{ previewText }}
|
||||||
</MobileActionButton>
|
</MobileActionButton>
|
||||||
@@ -37,9 +37,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MobileActionButtonUpload from '@/components/VueFileManagerComponents/FilesView/MobileActionButtonUpload'
|
import MobileActionButtonUpload from '@/components/FilesView/MobileActionButtonUpload'
|
||||||
import MobileActionButton from '@/components/VueFileManagerComponents/FilesView/MobileActionButton'
|
import MobileActionButton from '@/components/FilesView/MobileActionButton'
|
||||||
import UploadProgress from '@/components/VueFileManagerComponents/FilesView/UploadProgress'
|
import UploadProgress from '@/components/FilesView/UploadProgress'
|
||||||
import {mapGetters} from 'vuex'
|
import {mapGetters} from 'vuex'
|
||||||
import {debounce} from 'lodash'
|
import {debounce} from 'lodash'
|
||||||
import {events} from '@/bus'
|
import {events} from '@/bus'
|
||||||
+2
-2
@@ -64,7 +64,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!--Mobile for Base location with EDITOR permission-->
|
<!--Mobile for Base location with EDITOR permission-->
|
||||||
<ul v-if="$isThisLocation(['base']) && $checkPermission('editor')" class="menu-options">
|
<ul v-if="$isThisLocation(['base', 'public']) && $checkPermission('editor')" class="menu-options">
|
||||||
<li class="menu-option" @click="renameItem" v-if="fileInfoDetail">
|
<li class="menu-option" @click="renameItem" v-if="fileInfoDetail">
|
||||||
{{ $t('context_menu.rename') }}
|
{{ $t('context_menu.rename') }}
|
||||||
</li>
|
</li>
|
||||||
@@ -77,7 +77,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!--Mobile for Base location with VISITOR permission-->
|
<!--Mobile for Base location with VISITOR permission-->
|
||||||
<ul v-if="$isThisLocation(['base']) && $checkPermission('visitor')" class="menu-options">
|
<ul v-if="$isThisLocation(['base', 'public']) && $checkPermission('visitor')" class="menu-options">
|
||||||
<li class="menu-option" @click="downloadItem" v-if="! isFolder">
|
<li class="menu-option" @click="downloadItem" v-if="! isFolder">
|
||||||
{{ $t('context_menu.download') }}
|
{{ $t('context_menu.download') }}
|
||||||
</li>
|
</li>
|
||||||
+5
-5
@@ -14,8 +14,8 @@
|
|||||||
<div class="directory-name">{{ directoryName }}</div>
|
<div class="directory-name">{{ directoryName }}</div>
|
||||||
|
|
||||||
<!--More Actions-->
|
<!--More Actions-->
|
||||||
<div class="more-actions-button" @click="showSidebarMenu">
|
<div class="more-actions-button">
|
||||||
<div class="tap-area">
|
<div class="tap-area" @click="showSidebarMenu" v-if="$checkPermission('master')">
|
||||||
<FontAwesomeIcon icon="bars" v-if="isSmallAppSize"></FontAwesomeIcon>
|
<FontAwesomeIcon icon="bars" v-if="isSmallAppSize"></FontAwesomeIcon>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -23,9 +23,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ToolbarButtonUpload from '@/components/VueFileManagerComponents/FilesView/ToolbarButtonUpload'
|
import ToolbarButtonUpload from '@/components/FilesView/ToolbarButtonUpload'
|
||||||
import ToolbarButton from '@/components/VueFileManagerComponents/FilesView/ToolbarButton'
|
import ToolbarButton from '@/components/FilesView/ToolbarButton'
|
||||||
import SearchBar from '@/components/VueFileManagerComponents/FilesView/SearchBar'
|
import SearchBar from '@/components/FilesView/SearchBar'
|
||||||
import {mapGetters} from 'vuex'
|
import {mapGetters} from 'vuex'
|
||||||
import {events} from '@/bus'
|
import {events} from '@/bus'
|
||||||
|
|
||||||
+1
-1
@@ -10,7 +10,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ProgressBar from '@/components/VueFileManagerComponents/FilesView/ProgressBar'
|
import ProgressBar from '@/components/FilesView/ProgressBar'
|
||||||
import {mapGetters} from 'vuex'
|
import {mapGetters} from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
+12
-12
@@ -4,15 +4,15 @@
|
|||||||
<PopupHeader :title="$t('popup_move_item.title')" />
|
<PopupHeader :title="$t('popup_move_item.title')" />
|
||||||
|
|
||||||
<!--Content-->
|
<!--Content-->
|
||||||
<PopupContent type="height-limited" v-if="app && pickedItem">
|
<PopupContent type="height-limited" v-if="pickedItem">
|
||||||
|
|
||||||
<!--Show Spinner when loading folders-->
|
<!--Show Spinner when loading folders-->
|
||||||
<Spinner v-if="isLoadingTree"/>
|
<Spinner v-if="isLoadingTree"/>
|
||||||
|
|
||||||
<!--Folder tree-->
|
<!--Folder tree-->
|
||||||
<div v-if="! isLoadingTree">
|
<div v-if="! isLoadingTree && navigation">
|
||||||
<ThumbnailItem class="item-thumbnail" :item="pickedItem" info="location"/>
|
<ThumbnailItem class="item-thumbnail" :item="pickedItem" info="location"/>
|
||||||
<TreeMenu :depth="1" :nodes="items" v-for="items in app.folders" :key="items.unique_id"/>
|
<TreeMenu :depth="1" :nodes="items" v-for="items in navigation" :key="items.unique_id"/>
|
||||||
</div>
|
</div>
|
||||||
</PopupContent>
|
</PopupContent>
|
||||||
|
|
||||||
@@ -35,14 +35,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import PopupWrapper from '@/components/VueFileManagerComponents/Others/Popup/PopupWrapper'
|
import PopupWrapper from '@/components/Others/Popup/PopupWrapper'
|
||||||
import PopupActions from '@/components/VueFileManagerComponents/Others/Popup/PopupActions'
|
import PopupActions from '@/components/Others/Popup/PopupActions'
|
||||||
import PopupContent from '@/components/VueFileManagerComponents/Others/Popup/PopupContent'
|
import PopupContent from '@/components/Others/Popup/PopupContent'
|
||||||
import PopupHeader from '@/components/VueFileManagerComponents/Others/Popup/PopupHeader'
|
import PopupHeader from '@/components/Others/Popup/PopupHeader'
|
||||||
import ThumbnailItem from '@/components/VueFileManagerComponents/Others/ThumbnailItem'
|
import ThumbnailItem from '@/components/Others/ThumbnailItem'
|
||||||
import ButtonBase from '@/components/VueFileManagerComponents/FilesView/ButtonBase'
|
import ButtonBase from '@/components/FilesView/ButtonBase'
|
||||||
import Spinner from '@/components/VueFileManagerComponents/FilesView/Spinner'
|
import Spinner from '@/components/FilesView/Spinner'
|
||||||
import TreeMenu from '@/components/VueFileManagerComponents/Others/TreeMenu'
|
import TreeMenu from '@/components/Others/TreeMenu'
|
||||||
import {mapGetters} from 'vuex'
|
import {mapGetters} from 'vuex'
|
||||||
import {events} from '@/bus'
|
import {events} from '@/bus'
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
Spinner,
|
Spinner,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['app']),
|
...mapGetters(['navigation']),
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
+9
-9
@@ -65,16 +65,16 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import PopupWrapper from '@/components/VueFileManagerComponents/Others/Popup/PopupWrapper'
|
import PopupWrapper from '@/components/Others/Popup/PopupWrapper'
|
||||||
import PopupActions from '@/components/VueFileManagerComponents/Others/Popup/PopupActions'
|
import PopupActions from '@/components/Others/Popup/PopupActions'
|
||||||
import PopupContent from '@/components/VueFileManagerComponents/Others/Popup/PopupContent'
|
import PopupContent from '@/components/Others/Popup/PopupContent'
|
||||||
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
|
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
|
||||||
import PopupHeader from '@/components/VueFileManagerComponents/Others/Popup/PopupHeader'
|
import PopupHeader from '@/components/Others/Popup/PopupHeader'
|
||||||
import SwitchInput from '@/components/VueFileManagerComponents/Others/Forms/SwitchInput'
|
import SwitchInput from '@/components/Others/Forms/SwitchInput'
|
||||||
import SelectInput from '@/components/VueFileManagerComponents/Others/Forms/SelectInput'
|
import SelectInput from '@/components/Others/Forms/SelectInput'
|
||||||
import ThumbnailItem from '@/components/VueFileManagerComponents/Others/ThumbnailItem'
|
import ThumbnailItem from '@/components/Others/ThumbnailItem'
|
||||||
import CopyInput from '@/components/VueFileManagerComponents/Others/Forms/CopyInput'
|
import CopyInput from '@/components/Others/Forms/CopyInput'
|
||||||
import ButtonBase from '@/components/VueFileManagerComponents/FilesView/ButtonBase'
|
import ButtonBase from '@/components/FilesView/ButtonBase'
|
||||||
import {required} from 'vee-validate/dist/rules'
|
import {required} from 'vee-validate/dist/rules'
|
||||||
import {mapGetters} from 'vuex'
|
import {mapGetters} from 'vuex'
|
||||||
import {events} from '@/bus'
|
import {events} from '@/bus'
|
||||||
+10
-10
@@ -67,17 +67,17 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import PopupWrapper from '@/components/VueFileManagerComponents/Others/Popup/PopupWrapper'
|
import PopupWrapper from '@/components/Others/Popup/PopupWrapper'
|
||||||
import PopupActions from '@/components/VueFileManagerComponents/Others/Popup/PopupActions'
|
import PopupActions from '@/components/Others/Popup/PopupActions'
|
||||||
import PopupContent from '@/components/VueFileManagerComponents/Others/Popup/PopupContent'
|
import PopupContent from '@/components/Others/Popup/PopupContent'
|
||||||
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
|
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
|
||||||
import PopupHeader from '@/components/VueFileManagerComponents/Others/Popup/PopupHeader'
|
import PopupHeader from '@/components/Others/Popup/PopupHeader'
|
||||||
import SwitchInput from '@/components/VueFileManagerComponents/Others/Forms/SwitchInput'
|
import SwitchInput from '@/components/Others/Forms/SwitchInput'
|
||||||
import SelectInput from '@/components/VueFileManagerComponents/Others/Forms/SelectInput'
|
import SelectInput from '@/components/Others/Forms/SelectInput'
|
||||||
import ThumbnailItem from '@/components/VueFileManagerComponents/Others/ThumbnailItem'
|
import ThumbnailItem from '@/components/Others/ThumbnailItem'
|
||||||
import ActionButton from '@/components/VueFileManagerComponents/Others/ActionButton'
|
import ActionButton from '@/components/Others/ActionButton'
|
||||||
import CopyInput from '@/components/VueFileManagerComponents/Others/Forms/CopyInput'
|
import CopyInput from '@/components/Others/Forms/CopyInput'
|
||||||
import ButtonBase from '@/components/VueFileManagerComponents/FilesView/ButtonBase'
|
import ButtonBase from '@/components/FilesView/ButtonBase'
|
||||||
import {required} from 'vee-validate/dist/rules'
|
import {required} from 'vee-validate/dist/rules'
|
||||||
import {mapGetters} from 'vuex'
|
import {mapGetters} from 'vuex'
|
||||||
import {events} from '@/bus'
|
import {events} from '@/bus'
|
||||||
+1
-1
@@ -13,7 +13,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import TreeMenu from '@/components/VueFileManagerComponents/Others/TreeMenu'
|
import TreeMenu from '@/components/Others/TreeMenu'
|
||||||
import {events} from "@/bus"
|
import {events} from "@/bus"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
+5
-5
@@ -73,11 +73,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import FileListItemThumbnail from '@/components/VueFileManagerComponents/Sidebar/FileListItemThumbnail'
|
import FileListItemThumbnail from '@/components/Sidebar/FileListItemThumbnail'
|
||||||
import UserHeadline from '@/components/VueFileManagerComponents/Sidebar/UserHeadline'
|
import UserHeadline from '@/components/Sidebar/UserHeadline'
|
||||||
import ButtonBase from '@/components/VueFileManagerComponents/FilesView/ButtonBase'
|
import ButtonBase from '@/components/FilesView/ButtonBase'
|
||||||
import StorageSize from '@/components/VueFileManagerComponents/Sidebar/StorageSize'
|
import StorageSize from '@/components/Sidebar/StorageSize'
|
||||||
import TextLabel from '@/components/VueFileManagerComponents/Others/TextLabel'
|
import TextLabel from '@/components/Others/TextLabel'
|
||||||
import {mapGetters} from 'vuex'
|
import {mapGetters} from 'vuex'
|
||||||
import {events} from '@/bus'
|
import {events} from '@/bus'
|
||||||
|
|
||||||
+1
-1
@@ -9,7 +9,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ProgressBar from '@/components/VueFileManagerComponents/FilesView/ProgressBar'
|
import ProgressBar from '@/components/FilesView/ProgressBar'
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
Vendored
-1
@@ -5,7 +5,6 @@ import store from '@/store'
|
|||||||
import Index from './views/Auth/SignIn'
|
import Index from './views/Auth/SignIn'
|
||||||
import SignUp from './views/Auth/SignUp'
|
import SignUp from './views/Auth/SignUp'
|
||||||
import SharedContent from './views/Shared/SharedContent'
|
import SharedContent from './views/Shared/SharedContent'
|
||||||
import VerifyByPassword from './views/Shared/VerifyByPassword'
|
|
||||||
import ForgottenPassword from './views/Auth/ForgottenPassword'
|
import ForgottenPassword from './views/Auth/ForgottenPassword'
|
||||||
import CreateNewPassword from './views/Auth/CreateNewPassword'
|
import CreateNewPassword from './views/Auth/CreateNewPassword'
|
||||||
|
|
||||||
|
|||||||
Vendored
+3
-3
@@ -1,6 +1,6 @@
|
|||||||
const defaultState = {
|
const defaultState = {
|
||||||
fileInfoPanelVisible: localStorage.getItem('file_info_visibility') == 'true' || false,
|
fileInfoPanelVisible: localStorage.getItem('file_info_visibility') == 'true' || false,
|
||||||
FilePreviewType: localStorage.getItem('FilePreviewType') || 'list',
|
FilePreviewType: localStorage.getItem('preview_type') || 'list',
|
||||||
appSize: undefined,
|
appSize: undefined,
|
||||||
config: undefined,
|
config: undefined,
|
||||||
}
|
}
|
||||||
@@ -20,8 +20,8 @@ const actions = {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if ( this.$isThisLocation('public') ) {
|
if ( getters.currentFolder.location === 'public' ) {
|
||||||
dispatch('browseShared', [this.currentFolder(), false, true])
|
dispatch('browseShared', [getters.currentFolder, false, true])
|
||||||
} else {
|
} else {
|
||||||
dispatch('getFolder', [getters.currentFolder, false, true])
|
dispatch('getFolder', [getters.currentFolder, false, true])
|
||||||
}
|
}
|
||||||
|
|||||||
+39
@@ -11,6 +11,7 @@ const defaultState = {
|
|||||||
homeDirectory: undefined,
|
homeDirectory: undefined,
|
||||||
uploadingFileProgress: 0,
|
uploadingFileProgress: 0,
|
||||||
filesViewWidth: undefined,
|
filesViewWidth: undefined,
|
||||||
|
navigation: undefined,
|
||||||
isSearching: false,
|
isSearching: false,
|
||||||
browseHistory: [],
|
browseHistory: [],
|
||||||
isLoading: true,
|
isLoading: true,
|
||||||
@@ -177,9 +178,46 @@ const actions = {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
getFolderTree: ({commit, getters}) => {
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
|
// Get route
|
||||||
|
let route = undefined
|
||||||
|
|
||||||
|
if (getters.sharedDetail && getters.sharedDetail.protected)
|
||||||
|
route = '/api/navigation/private'
|
||||||
|
else if (getters.sharedDetail && ! getters.sharedDetail.protected)
|
||||||
|
route = '/api/navigation/public/' + router.currentRoute.params.token
|
||||||
|
else
|
||||||
|
route = '/api/navigation'
|
||||||
|
|
||||||
|
axios
|
||||||
|
.get(route)
|
||||||
|
.then(response => {
|
||||||
|
resolve(response)
|
||||||
|
|
||||||
|
commit('UPDATE_FOLDER_TREE', response.data)
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
reject(error)
|
||||||
|
|
||||||
|
// Show error message
|
||||||
|
events.$emit('alert:open', {
|
||||||
|
title: i18n.t('popup_error.title'),
|
||||||
|
message: i18n.t('popup_error.message'),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const mutations = {
|
const mutations = {
|
||||||
|
UPDATE_FOLDER_TREE(state, tree) {
|
||||||
|
state.navigation = tree
|
||||||
|
},
|
||||||
LOADING_STATE(state, val) {
|
LOADING_STATE(state, val) {
|
||||||
state.isLoading = val
|
state.isLoading = val
|
||||||
},
|
},
|
||||||
@@ -274,6 +312,7 @@ const getters = {
|
|||||||
currentFolder: state => state.currentFolder,
|
currentFolder: state => state.currentFolder,
|
||||||
browseHistory: state => state.browseHistory,
|
browseHistory: state => state.browseHistory,
|
||||||
isSearching: state => state.isSearching,
|
isSearching: state => state.isSearching,
|
||||||
|
navigation: state => state.navigation,
|
||||||
isLoading: state => state.isLoading,
|
isLoading: state => state.isLoading,
|
||||||
data: state => state.data,
|
data: state => state.data,
|
||||||
}
|
}
|
||||||
|
|||||||
+37
-9
@@ -1,11 +1,19 @@
|
|||||||
import axios from 'axios'
|
|
||||||
import {events} from '@/bus'
|
|
||||||
import i18n from '@/i18n/index'
|
import i18n from '@/i18n/index'
|
||||||
|
import router from '@/router'
|
||||||
|
import {events} from '@/bus'
|
||||||
|
import axios from 'axios'
|
||||||
|
|
||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
moveItem: ({commit, getters}, [item_from, to_item]) => {
|
moveItem: ({commit, getters}, [item_from, to_item]) => {
|
||||||
|
|
||||||
|
// Get route
|
||||||
|
let route = getters.sharedDetail && ! getters.sharedDetail.protected
|
||||||
|
? '/api/move/' + item_from.unique_id + '/public/' + router.currentRoute.params.token
|
||||||
|
: '/api/move/' + item_from.unique_id
|
||||||
|
|
||||||
axios
|
axios
|
||||||
.patch(getters.api + '/move-item/' + item_from.unique_id, {
|
.patch(route, {
|
||||||
from_type: item_from.type,
|
from_type: item_from.type,
|
||||||
to_unique_id: to_item.unique_id
|
to_unique_id: to_item.unique_id
|
||||||
})
|
})
|
||||||
@@ -16,11 +24,15 @@ const actions = {
|
|||||||
.catch(() => isSomethingWrong())
|
.catch(() => isSomethingWrong())
|
||||||
},
|
},
|
||||||
createFolder: ({commit, getters}, folderName) => {
|
createFolder: ({commit, getters}, folderName) => {
|
||||||
const parent_id = getters.currentFolder ? getters.currentFolder.unique_id : 0
|
|
||||||
|
// Get route
|
||||||
|
let route = getters.sharedDetail && ! getters.sharedDetail.protected
|
||||||
|
? '/api/create-folder/public/' + router.currentRoute.params.token
|
||||||
|
: '/api/create-folder'
|
||||||
|
|
||||||
axios
|
axios
|
||||||
.post(getters.api + '/create-folder', {
|
.post(route, {
|
||||||
parent_id: parent_id,
|
parent_id: getters.currentFolder.unique_id,
|
||||||
name: folderName
|
name: folderName
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
@@ -34,8 +46,13 @@ const actions = {
|
|||||||
if (getters.permission === 'master' && data.type === 'folder')
|
if (getters.permission === 'master' && data.type === 'folder')
|
||||||
commit('UPDATE_NAME_IN_FAVOURITES', data)
|
commit('UPDATE_NAME_IN_FAVOURITES', data)
|
||||||
|
|
||||||
|
// Get route
|
||||||
|
let route = getters.sharedDetail && ! getters.sharedDetail.protected
|
||||||
|
? '/api/rename-item/' + data.unique_id + '/public/' + router.currentRoute.params.token
|
||||||
|
: '/api/rename-item/' + data.unique_id
|
||||||
|
|
||||||
axios
|
axios
|
||||||
.patch(getters.api + '/rename-item/' + data.unique_id, {
|
.patch(route, {
|
||||||
name: data.name,
|
name: data.name,
|
||||||
type: data.type,
|
type: data.type,
|
||||||
})
|
})
|
||||||
@@ -46,8 +63,14 @@ const actions = {
|
|||||||
},
|
},
|
||||||
uploadFiles: ({commit, getters}, files) => {
|
uploadFiles: ({commit, getters}, files) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
|
// Get route
|
||||||
|
let route = getters.sharedDetail && ! getters.sharedDetail.protected
|
||||||
|
? '/api/upload/public/' + router.currentRoute.params.token
|
||||||
|
: '/api/upload'
|
||||||
|
|
||||||
axios
|
axios
|
||||||
.post(getters.api + '/upload-file', files, {
|
.post(route, files, {
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'multipart/form-data'
|
'Content-Type': 'multipart/form-data'
|
||||||
},
|
},
|
||||||
@@ -114,8 +137,13 @@ const actions = {
|
|||||||
// Remove file preview
|
// Remove file preview
|
||||||
commit('CLEAR_FILEINFO_DETAIL')
|
commit('CLEAR_FILEINFO_DETAIL')
|
||||||
|
|
||||||
|
// Get route
|
||||||
|
let route = getters.sharedDetail && ! getters.sharedDetail.protected
|
||||||
|
? '/api/remove-item/' + data.unique_id + '/public/' + router.currentRoute.params.token
|
||||||
|
: '/api/remove-item/' + data.unique_id
|
||||||
|
|
||||||
axios
|
axios
|
||||||
.delete(getters.api + '/remove-item/' + data.unique_id, {
|
.delete(route, {
|
||||||
data: {
|
data: {
|
||||||
type: data.type,
|
type: data.type,
|
||||||
force_delete: data.deleted_at ? true : false
|
force_delete: data.deleted_at ? true : false
|
||||||
|
|||||||
-25
@@ -68,37 +68,12 @@ const actions = {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getFolderTree: (context) => {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
axios
|
|
||||||
.get(context.getters.api + '/folder-tree')
|
|
||||||
.then(response => {
|
|
||||||
resolve(response)
|
|
||||||
|
|
||||||
context.commit('UPDATE_FOLDER_TREE', response.data)
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
reject(error)
|
|
||||||
|
|
||||||
// Show error message
|
|
||||||
events.$emit('alert:open', {
|
|
||||||
title: i18n.t('popup_error.title'),
|
|
||||||
message: i18n.t('popup_error.message'),
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const mutations = {
|
const mutations = {
|
||||||
RETRIEVE_APP_DATA(state, app) {
|
RETRIEVE_APP_DATA(state, app) {
|
||||||
state.app = app
|
state.app = app
|
||||||
},
|
},
|
||||||
UPDATE_FOLDER_TREE(state, tree) {
|
|
||||||
state.app.folders = tree
|
|
||||||
},
|
|
||||||
SET_PERMISSION(state, role) {
|
SET_PERMISSION(state, role) {
|
||||||
state.permission = role
|
state.permission = role
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -66,10 +66,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import AuthContentWrapper from '@/components/VueFileManagerComponents/Auth/AuthContentWrapper'
|
import AuthContentWrapper from '@/components/Auth/AuthContentWrapper'
|
||||||
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
|
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
|
||||||
import AuthContent from '@/components/VueFileManagerComponents/Auth/AuthContent'
|
import AuthContent from '@/components/Auth/AuthContent'
|
||||||
import AuthButton from '@/components/VueFileManagerComponents/Auth/AuthButton'
|
import AuthButton from '@/components/Auth/AuthButton'
|
||||||
import {required} from 'vee-validate/dist/rules'
|
import {required} from 'vee-validate/dist/rules'
|
||||||
import {mapGetters} from 'vuex'
|
import {mapGetters} from 'vuex'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|||||||
@@ -42,10 +42,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import AuthContentWrapper from '@/components/VueFileManagerComponents/Auth/AuthContentWrapper'
|
import AuthContentWrapper from '@/components/Auth/AuthContentWrapper'
|
||||||
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
|
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
|
||||||
import AuthContent from '@/components/VueFileManagerComponents/Auth/AuthContent'
|
import AuthContent from '@/components/Auth/AuthContent'
|
||||||
import AuthButton from '@/components/VueFileManagerComponents/Auth/AuthButton'
|
import AuthButton from '@/components/Auth/AuthButton'
|
||||||
import {required} from 'vee-validate/dist/rules'
|
import {required} from 'vee-validate/dist/rules'
|
||||||
import {mapGetters} from 'vuex'
|
import {mapGetters} from 'vuex'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|||||||
@@ -60,10 +60,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import AuthContentWrapper from '@/components/VueFileManagerComponents/Auth/AuthContentWrapper'
|
import AuthContentWrapper from '@/components/Auth/AuthContentWrapper'
|
||||||
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
|
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
|
||||||
import AuthContent from '@/components/VueFileManagerComponents/Auth/AuthContent'
|
import AuthContent from '@/components/Auth/AuthContent'
|
||||||
import AuthButton from '@/components/VueFileManagerComponents/Auth/AuthButton'
|
import AuthButton from '@/components/Auth/AuthButton'
|
||||||
import {required} from 'vee-validate/dist/rules'
|
import {required} from 'vee-validate/dist/rules'
|
||||||
import {mapGetters} from 'vuex'
|
import {mapGetters} from 'vuex'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|||||||
@@ -66,10 +66,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import AuthContentWrapper from '@/components/VueFileManagerComponents/Auth/AuthContentWrapper'
|
import AuthContentWrapper from '@/components/Auth/AuthContentWrapper'
|
||||||
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
|
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
|
||||||
import AuthContent from '@/components/VueFileManagerComponents/Auth/AuthContent'
|
import AuthContent from '@/components/Auth/AuthContent'
|
||||||
import AuthButton from '@/components/VueFileManagerComponents/Auth/AuthButton'
|
import AuthButton from '@/components/Auth/AuthButton'
|
||||||
import {required} from 'vee-validate/dist/rules'
|
import {required} from 'vee-validate/dist/rules'
|
||||||
import {mapGetters} from 'vuex'
|
import {mapGetters} from 'vuex'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import DesktopToolbar from '@/components/VueFileManagerComponents/FilesView/DesktopToolbar'
|
import DesktopToolbar from '@/components/FilesView/DesktopToolbar'
|
||||||
import FileBrowser from '@/components/VueFileManagerComponents/FilesView/FileBrowser'
|
import FileBrowser from '@/components/FilesView/FileBrowser'
|
||||||
import ContextMenu from '@/components/VueFileManagerComponents/FilesView/ContextMenu'
|
import ContextMenu from '@/components/FilesView/ContextMenu'
|
||||||
import {ResizeSensor} from 'css-element-queries'
|
import {ResizeSensor} from 'css-element-queries'
|
||||||
import {mapGetters} from 'vuex'
|
import {mapGetters} from 'vuex'
|
||||||
import {events} from '@/bus'
|
import {events} from '@/bus'
|
||||||
|
|||||||
@@ -74,10 +74,10 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
|
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
|
||||||
import UserImageInput from '@/components/VueFileManagerComponents/Others/UserImageInput'
|
import UserImageInput from '@/components/Others/UserImageInput'
|
||||||
import ButtonBase from '@/components/VueFileManagerComponents/FilesView/ButtonBase'
|
import ButtonBase from '@/components/FilesView/ButtonBase'
|
||||||
import PageHeader from '@/components/VueFileManagerComponents/Others/PageHeader'
|
import PageHeader from '@/components/Others/PageHeader'
|
||||||
import ThemeLabel from '@/components/VueFileManagerComponents/Others/ThemeLabel'
|
import ThemeLabel from '@/components/Others/ThemeLabel'
|
||||||
import {required} from 'vee-validate/dist/rules'
|
import {required} from 'vee-validate/dist/rules'
|
||||||
import {mapGetters} from 'vuex'
|
import {mapGetters} from 'vuex'
|
||||||
import {debounce} from 'lodash'
|
import {debounce} from 'lodash'
|
||||||
|
|||||||
@@ -44,6 +44,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-if="sharedDetail.type === 'folder'" @contextmenu.prevent.capture="contextMenu($event, undefined)" @click="fileViewClick">
|
<div v-if="sharedDetail.type === 'folder'" @contextmenu.prevent.capture="contextMenu($event, undefined)" @click="fileViewClick">
|
||||||
|
|
||||||
|
<!--Move item setup-->
|
||||||
|
<MoveItem />
|
||||||
|
|
||||||
<!--Mobile Menu-->
|
<!--Mobile Menu-->
|
||||||
<MobileMenu/>
|
<MobileMenu/>
|
||||||
|
|
||||||
@@ -61,18 +64,19 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import DesktopToolbar from '@/components/VueFileManagerComponents/FilesView/DesktopToolbar'
|
import DesktopToolbar from '@/components/FilesView/DesktopToolbar'
|
||||||
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
|
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
|
||||||
import FileItemGrid from '@/components/VueFileManagerComponents/FilesView/FileItemGrid'
|
import FileItemGrid from '@/components/FilesView/FileItemGrid'
|
||||||
import FileBrowser from '@/components/VueFileManagerComponents/FilesView/FileBrowser'
|
import FileBrowser from '@/components/FilesView/FileBrowser'
|
||||||
import ContextMenu from '@/components/VueFileManagerComponents/FilesView/ContextMenu'
|
import ContextMenu from '@/components/FilesView/ContextMenu'
|
||||||
import ButtonBase from '@/components/VueFileManagerComponents/FilesView/ButtonBase'
|
import ButtonBase from '@/components/FilesView/ButtonBase'
|
||||||
import MobileMenu from '@/components/VueFileManagerComponents/FilesView/MobileMenu'
|
import MobileMenu from '@/components/FilesView/MobileMenu'
|
||||||
import AuthContent from '@/components/VueFileManagerComponents/Auth/AuthContent'
|
import AuthContent from '@/components/Auth/AuthContent'
|
||||||
import AuthButton from '@/components/VueFileManagerComponents/Auth/AuthButton'
|
import AuthButton from '@/components/Auth/AuthButton'
|
||||||
import Spinner from '@/components/VueFileManagerComponents/FilesView/Spinner'
|
import Spinner from '@/components/FilesView/Spinner'
|
||||||
import Vignette from '@/components/VueFileManagerComponents/Others/Vignette'
|
import MoveItem from '@/components/Others/MoveItem'
|
||||||
import Alert from '@/components/VueFileManagerComponents/FilesView/Alert'
|
import Vignette from '@/components/Others/Vignette'
|
||||||
|
import Alert from '@/components/FilesView/Alert'
|
||||||
import {required} from 'vee-validate/dist/rules'
|
import {required} from 'vee-validate/dist/rules'
|
||||||
import {ResizeSensor} from 'css-element-queries'
|
import {ResizeSensor} from 'css-element-queries'
|
||||||
import {mapGetters} from 'vuex'
|
import {mapGetters} from 'vuex'
|
||||||
@@ -92,6 +96,7 @@
|
|||||||
AuthButton,
|
AuthButton,
|
||||||
MobileMenu,
|
MobileMenu,
|
||||||
ButtonBase,
|
ButtonBase,
|
||||||
|
MoveItem,
|
||||||
required,
|
required,
|
||||||
Vignette,
|
Vignette,
|
||||||
Spinner,
|
Spinner,
|
||||||
|
|||||||
@@ -1,88 +0,0 @@
|
|||||||
<template>
|
|
||||||
<AuthContentWrapper ref="auth">
|
|
||||||
|
|
||||||
<!--Verify share link by password-->
|
|
||||||
<AuthContent name="password" :visible="true">
|
|
||||||
|
|
||||||
</AuthContent>
|
|
||||||
</AuthContentWrapper>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import AuthContentWrapper from '@/components/VueFileManagerComponents/Auth/AuthContentWrapper'
|
|
||||||
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
|
|
||||||
import AuthContent from '@/components/VueFileManagerComponents/Auth/AuthContent'
|
|
||||||
import AuthButton from '@/components/VueFileManagerComponents/Auth/AuthButton'
|
|
||||||
import {required} from 'vee-validate/dist/rules'
|
|
||||||
import {mapGetters} from 'vuex'
|
|
||||||
import axios from 'axios'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'SharedContent',
|
|
||||||
components: {
|
|
||||||
AuthContentWrapper,
|
|
||||||
ValidationProvider,
|
|
||||||
ValidationObserver,
|
|
||||||
AuthContent,
|
|
||||||
AuthButton,
|
|
||||||
required,
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
...mapGetters(['config']),
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
checkedAccount: undefined,
|
|
||||||
password: 'tvojpenis',
|
|
||||||
isLoading: false,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
async sharedProtected() {
|
|
||||||
|
|
||||||
// Validate fields
|
|
||||||
const isValid = await this.$refs.sharedProtected.validate();
|
|
||||||
|
|
||||||
if (!isValid) return;
|
|
||||||
|
|
||||||
// Start loading
|
|
||||||
this.isLoading = true
|
|
||||||
|
|
||||||
// Send request to get verify account
|
|
||||||
axios
|
|
||||||
.post('/api/shared/authenticate/' + this.$route.params.token, {
|
|
||||||
password: this.password
|
|
||||||
})
|
|
||||||
.then(response => {
|
|
||||||
|
|
||||||
// End loading
|
|
||||||
this.isLoading = false
|
|
||||||
|
|
||||||
// Commit shared item options
|
|
||||||
this.$store.commit('SET_PERMISSION', response.data.permission)
|
|
||||||
|
|
||||||
// Redirect to file browser page
|
|
||||||
this.$router.push({name: 'SharedContent', params: {token: this.$route.params.token}})
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
|
|
||||||
if (error.response.status == 401) {
|
|
||||||
|
|
||||||
this.$refs.sharedProtected.setErrors({
|
|
||||||
'Password': [error.response.data.message]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// End loading
|
|
||||||
this.isLoading = false
|
|
||||||
})
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
@import "@assets/app.scss";
|
|
||||||
@import '@assets/vue-file-manager/_forms';
|
|
||||||
@import '@assets/vue-file-manager/_auth';
|
|
||||||
</style>
|
|
||||||
+21
-14
@@ -19,6 +19,20 @@
|
|||||||
// Public routes
|
// Public routes
|
||||||
Route::group(['middleware' => ['api']], function () {
|
Route::group(['middleware' => ['api']], function () {
|
||||||
|
|
||||||
|
// Edit Functions
|
||||||
|
Route::delete('/remove-item/{unique_id}/public/{token}', 'FileFunctions\EditItemsController@guest_delete_item');
|
||||||
|
Route::patch('/rename-item/{unique_id}/public/{token}', 'FileFunctions\EditItemsController@guest_rename_item');
|
||||||
|
Route::post('/create-folder/public/{token}', 'FileFunctions\EditItemsController@guest_create_folder');
|
||||||
|
Route::patch('/move/{unique_id}/public/{token}', 'FileFunctions\EditItemsController@guest_move');
|
||||||
|
Route::post('/upload/public/{token}', 'FileFunctions\EditItemsController@guest_upload');
|
||||||
|
|
||||||
|
// Sharing page browsing
|
||||||
|
Route::get('/folders/{unique_id}/public/{token}', 'Sharing\FileSharingController@get_public_folders');
|
||||||
|
Route::get('/navigation/public/{token}', 'Sharing\FileSharingController@get_public_navigation_tree');
|
||||||
|
Route::post('/shared/authenticate/{token}', 'Sharing\FileSharingController@authenticate');
|
||||||
|
Route::get('/files/{token}/public', 'Sharing\FileSharingController@file_public');
|
||||||
|
Route::get('/shared/{token}', 'FileFunctions\ShareController@show');
|
||||||
|
|
||||||
// User reset password
|
// User reset password
|
||||||
Route::post('/password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail');
|
Route::post('/password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail');
|
||||||
Route::post('/password/reset', 'Auth\ResetPasswordController@reset');
|
Route::post('/password/reset', 'Auth\ResetPasswordController@reset');
|
||||||
@@ -27,12 +41,6 @@ Route::group(['middleware' => ['api']], function () {
|
|||||||
Route::post('/user/check', 'Auth\AuthController@check_account');
|
Route::post('/user/check', 'Auth\AuthController@check_account');
|
||||||
Route::post('/user/register', 'Auth\AuthController@register');
|
Route::post('/user/register', 'Auth\AuthController@register');
|
||||||
Route::post('/user/login', 'Auth\AuthController@login');
|
Route::post('/user/login', 'Auth\AuthController@login');
|
||||||
|
|
||||||
// Sharing
|
|
||||||
Route::get('/folders/{unique_id}/public/{token}', 'Sharing\FileSharingController@get_public_folders');
|
|
||||||
Route::post('/shared/authenticate/{token}', 'Sharing\FileSharingController@authenticate');
|
|
||||||
Route::get('/files/{token}/public', 'Sharing\FileSharingController@file_public');
|
|
||||||
Route::get('/shared/{token}', 'FileFunctions\ShareController@show');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// User master Routes
|
// User master Routes
|
||||||
@@ -45,15 +53,12 @@ Route::group(['middleware' => ['auth:api', 'auth.cookie', 'scope:master']], func
|
|||||||
|
|
||||||
// Browse
|
// Browse
|
||||||
Route::get('/file-detail/{unique_id}', 'FileBrowser\BrowseController@file_detail');
|
Route::get('/file-detail/{unique_id}', 'FileBrowser\BrowseController@file_detail');
|
||||||
|
Route::get('/navigation', 'FileBrowser\BrowseController@navigation_tree');
|
||||||
Route::get('/folders/{unique_id}', 'FileBrowser\BrowseController@folder');
|
Route::get('/folders/{unique_id}', 'FileBrowser\BrowseController@folder');
|
||||||
Route::get('/folder-tree', 'FileBrowser\BrowseController@folder_tree');
|
|
||||||
Route::get('/shared-all', 'FileBrowser\BrowseController@shared');
|
Route::get('/shared-all', 'FileBrowser\BrowseController@shared');
|
||||||
Route::get('/search', 'FileBrowser\BrowseController@search');
|
Route::get('/search', 'FileBrowser\BrowseController@search');
|
||||||
Route::get('/trash', 'FileBrowser\BrowseController@trash');
|
Route::get('/trash', 'FileBrowser\BrowseController@trash');
|
||||||
|
|
||||||
// Edit functions
|
|
||||||
Route::patch('/move-item/{unique_id}', 'FileFunctions\EditItemsController@move_item');
|
|
||||||
|
|
||||||
// Trash
|
// Trash
|
||||||
Route::patch('/restore-item/{unique_id}', 'FileFunctions\TrashController@restore');
|
Route::patch('/restore-item/{unique_id}', 'FileFunctions\TrashController@restore');
|
||||||
Route::delete('/empty-trash', 'FileFunctions\TrashController@clear');
|
Route::delete('/empty-trash', 'FileFunctions\TrashController@clear');
|
||||||
@@ -76,6 +81,7 @@ Route::group(['middleware' => ['auth:api', 'auth.cookie', 'scope:visitor,editor'
|
|||||||
|
|
||||||
// Browse folders & files
|
// Browse folders & files
|
||||||
Route::get('/folders/{unique_id}/private', 'Sharing\FileSharingController@get_private_folders');
|
Route::get('/folders/{unique_id}/private', 'Sharing\FileSharingController@get_private_folders');
|
||||||
|
Route::get('/navigation/private', 'Sharing\FileSharingController@get_private_navigation_tree');
|
||||||
Route::get('/files/private', 'Sharing\FileSharingController@file_private');
|
Route::get('/files/private', 'Sharing\FileSharingController@file_private');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -83,8 +89,9 @@ Route::group(['middleware' => ['auth:api', 'auth.cookie', 'scope:visitor,editor'
|
|||||||
Route::group(['middleware' => ['auth:api', 'auth.cookie', 'scope:master,editor']], function () {
|
Route::group(['middleware' => ['auth:api', 'auth.cookie', 'scope:master,editor']], function () {
|
||||||
|
|
||||||
// Edit items
|
// Edit items
|
||||||
Route::delete('/remove-item/{unique_id}', 'FileFunctions\EditItemsController@delete_item');
|
Route::delete('/remove-item/{unique_id}', 'FileFunctions\EditItemsController@user_delete_item');
|
||||||
Route::patch('/rename-item/{unique_id}', 'FileFunctions\EditItemsController@rename_item');
|
Route::patch('/rename-item/{unique_id}', 'FileFunctions\EditItemsController@user_rename_item');
|
||||||
Route::post('/create-folder', 'FileFunctions\EditItemsController@create_folder');
|
Route::post('/create-folder', 'FileFunctions\EditItemsController@user_create_folder');
|
||||||
Route::post('/upload-file', 'FileFunctions\EditItemsController@upload_item');
|
Route::patch('/move/{unique_id}', 'FileFunctions\EditItemsController@user_move');
|
||||||
|
Route::post('/upload', 'FileFunctions\EditItemsController@user_upload');
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user