diff --git a/app/Http/Controllers/Sharing/FileSharingController.php b/app/Http/Controllers/Sharing/FileSharingController.php index 321b39f5..fa0849b3 100644 --- a/app/Http/Controllers/Sharing/FileSharingController.php +++ b/app/Http/Controllers/Sharing/FileSharingController.php @@ -18,6 +18,7 @@ use App\FileManagerFolder; use App\FileManagerFile; use App\User; use App\Share; +use Illuminate\Support\Facades\Storage; class FileSharingController extends Controller { @@ -47,10 +48,51 @@ class FileSharingController extends Controller Cookie::queue('shared_token', $token, 43200); } + // Check if shared is image file and then show it + if ($shared->type === 'file' && ! $shared->protected) { + + $image = FileManagerFile::where('user_id', $shared->user_id) + ->where('type', 'image') + ->where('unique_id', $shared->item_id) + ->first(); + + if ($image) { + return $this->show_image($image); + } + } + // Return page index return view("index"); } + /** + * Get image from storage and show it + * + * @param $file + * @return \Symfony\Component\HttpFoundation\StreamedResponse + */ + private function show_image($file) + { + // Format pretty filename + $file_pretty_name = $file->name . '.' . $file->mimetype; + + // Get file path + $path = '/file-manager/' . $file->basename; + + // Check if file exist + if (!Storage::exists($path)) abort(404); + + $header = [ + "Content-Type" => Storage::mimeType($path), + "Content-Length" => Storage::size($path), + "Accept-Ranges" => "bytes", + "Content-Range" => "bytes 0-600/" . Storage::size($path), + ]; + + // Get file + return Storage::response($path, $file_pretty_name, $header); + } + /** * Check Password for protected item * diff --git a/app/Http/Controllers/User/AccountController.php b/app/Http/Controllers/User/AccountController.php index 07158d2a..6df745a9 100644 --- a/app/Http/Controllers/User/AccountController.php +++ b/app/Http/Controllers/User/AccountController.php @@ -28,10 +28,10 @@ class AccountController extends Controller ->first(); // Get folder tree - $tree = FileManagerFolder::with('folders:id,parent_id,unique_id,name') + $tree = FileManagerFolder::with(['folders.shared', 'shared:token,id,item_id,permission,protected']) ->where('parent_id', 0) ->where('user_id', $user->id) - ->get(['id', 'parent_id', 'unique_id', 'name']); + ->get(); return [ 'user' => $user->only(['name', 'email', 'avatar']), diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 84307b4c..dae1421f 100644 --- a/public/mix-manifest.json +++ b/public/mix-manifest.json @@ -1,4 +1,19 @@ { "/js/main.js": "/js/main.js", - "/css/app.css": "/css/app.css" + "/css/app.css": "/css/app.css", + "/js/main.e46fa96cd6ffd39a4562.hot-update.js": "/js/main.e46fa96cd6ffd39a4562.hot-update.js", + "/js/main.f2d49bc1541da0f12970.hot-update.js": "/js/main.f2d49bc1541da0f12970.hot-update.js", + "/js/main.1eef99df4b0f12424803.hot-update.js": "/js/main.1eef99df4b0f12424803.hot-update.js", + "/js/main.5ddffc9a7b267188676c.hot-update.js": "/js/main.5ddffc9a7b267188676c.hot-update.js", + "/js/main.390ae60e2291b0dbccc3.hot-update.js": "/js/main.390ae60e2291b0dbccc3.hot-update.js", + "/js/main.6f2959aac5b1dece64a9.hot-update.js": "/js/main.6f2959aac5b1dece64a9.hot-update.js", + "/js/main.46741bd43cbaa6ee89b1.hot-update.js": "/js/main.46741bd43cbaa6ee89b1.hot-update.js", + "/js/main.273e3c85d127556c963f.hot-update.js": "/js/main.273e3c85d127556c963f.hot-update.js", + "/js/main.262acc9e6f3602846eb5.hot-update.js": "/js/main.262acc9e6f3602846eb5.hot-update.js", + "/js/main.340ad852bdc54fb22ddd.hot-update.js": "/js/main.340ad852bdc54fb22ddd.hot-update.js", + "/js/main.0f01b236243cc4d2ab64.hot-update.js": "/js/main.0f01b236243cc4d2ab64.hot-update.js", + "/js/main.bc5704d8e53dc4abc11a.hot-update.js": "/js/main.bc5704d8e53dc4abc11a.hot-update.js", + "/js/main.d639deb26abe56ea8a48.hot-update.js": "/js/main.d639deb26abe56ea8a48.hot-update.js", + "/js/main.4a2927afd0488259ade3.hot-update.js": "/js/main.4a2927afd0488259ade3.hot-update.js", + "/js/main.11e163fdc882ac0dd7c2.hot-update.js": "/js/main.11e163fdc882ac0dd7c2.hot-update.js" } diff --git a/resources/js/components/FilesView/DesktopToolbar.vue b/resources/js/components/FilesView/DesktopToolbar.vue index 317f0ccc..8763ff91 100644 --- a/resources/js/components/FilesView/DesktopToolbar.vue +++ b/resources/js/components/FilesView/DesktopToolbar.vue @@ -37,7 +37,7 @@ :action="$t('actions.create_folder')" /> - +
el.unique_id == item.unique_id - ) + let checkData = state.data.find(el => el.unique_id == item.unique_id) + + state.fileInfoDetail = checkData ? checkData : state.currentFolder }, CHANGE_SEARCHING_STATE(state, searchState) { state.isSearching = searchState diff --git a/resources/js/store/modules/fileFunctions.js b/resources/js/store/modules/fileFunctions.js index 7070cd04..e268b75f 100644 --- a/resources/js/store/modules/fileFunctions.js +++ b/resources/js/store/modules/fileFunctions.js @@ -160,14 +160,19 @@ const actions = { .then(() => { // If is folder, update app data - if (data.type === 'folder' && data.unique_id === getters.currentFolder.unique_id) { + if (data.type === 'folder') { - if ( getters.currentFolder.location === 'public' ) { - dispatch('browseShared', [{folder: last(getters.browseHistory), back: true, init: false}]) - } else { - dispatch('getFolder', [{folder: last(getters.browseHistory), back: true, init: false}]) - dispatch('getAppData') + if (data.unique_id === getters.currentFolder.unique_id) { + + if ( getters.currentFolder.location === 'public' ) { + dispatch('browseShared', [{folder: last(getters.browseHistory), back: true, init: false}]) + } else { + dispatch('getFolder', [{folder: last(getters.browseHistory), back: true, init: false}]) + } } + + if ( getters.currentFolder.location !== 'public' ) + dispatch('getAppData') } }) .catch(() => isSomethingWrong()) diff --git a/resources/js/views/FilePages/Files.vue b/resources/js/views/FilePages/Files.vue index e4babad0..d050e166 100644 --- a/resources/js/views/FilePages/Files.vue +++ b/resources/js/views/FilePages/Files.vue @@ -166,6 +166,20 @@ overflow-x: auto; } + @media only screen and (max-width: 1024px) { + + .empty-note { + + &.navigator { + padding: 5px 20px 10px; + } + + &.favourites { + padding: 5px 18px 10px; + } + } + } + // Transition .folder-item-move { transition: transform 300s ease; diff --git a/resources/sass/vue-file-manager/_variables.scss b/resources/sass/vue-file-manager/_variables.scss index 3031751c..fdc320a1 100755 --- a/resources/sass/vue-file-manager/_variables.scss +++ b/resources/sass/vue-file-manager/_variables.scss @@ -1,6 +1,6 @@ // Colors $text: #1c1d1f; -$text-muted: #667b90; +$text-muted: rgba($text, 0.7); $theme: #00BC7E; diff --git a/webpack.mix.js b/webpack.mix.js index 241ee1d3..cdb98106 100644 --- a/webpack.mix.js +++ b/webpack.mix.js @@ -25,8 +25,8 @@ mix.js('resources/js/main.js', 'public/js') }) .options({ hmrOptions: { - //host: '172.20.10.5', - host: '192.168.1.131', + host: '172.20.10.5', + //host: '192.168.1.131', port: '8080' }, })