v1.5-alpha.9

This commit is contained in:
carodej
2020-05-18 09:32:34 +02:00
parent 8daa05f710
commit dfe4991177
12 changed files with 102 additions and 19 deletions

View File

@@ -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
*

View File

@@ -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']),

View File

@@ -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"
}

View File

@@ -37,7 +37,7 @@
:action="$t('actions.create_folder')"
/>
</div>
<div class="toolbar-button-wrapper"
v-if="$checkPermission(['master', 'editor'])">
<ToolbarButton
@@ -286,6 +286,14 @@
.button {
margin-left: 5px;
&.active {
/deep/ svg {
line, circle {
stroke: $theme;
}
}
}
&.is-inactive {
opacity: 0.25;
pointer-events: none;

View File

@@ -35,7 +35,7 @@
p {
margin-top: 10px;
max-width: 130px;
@include font-size(14);
@include font-size(13);
font-weight: 500;
color: $text-muted;
}

View File

@@ -225,7 +225,6 @@
}
.file-content {
height: 100%;
display: flex;
flex-wrap: nowrap;

View File

@@ -191,7 +191,7 @@
"confirm": "Confirm"
},
"shared": {
"empty_shared": "You Haven't Shared Anything Yet",
"empty_shared": "You haven't shared anything yet.",
"editor": "Can edit and upload files",
"visitor": "Can only view and download",
"can_download": "Can download file"

View File

@@ -250,9 +250,9 @@ const mutations = {
state.fileInfoDetail = item
},
GET_FILEINFO_DETAIL(state, item) {
state.fileInfoDetail = state.data.find(
el => 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

View File

@@ -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())

View File

@@ -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;

View File

@@ -1,6 +1,6 @@
// Colors
$text: #1c1d1f;
$text-muted: #667b90;
$text-muted: rgba($text, 0.7);
$theme: #00BC7E;

4
webpack.mix.js vendored
View File

@@ -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'
},
})