vuefilemanager v1.5-alpha.1

This commit is contained in:
carodej
2020-04-29 11:32:08 +02:00
parent 2614efe601
commit 0f3cbaec3d
50 changed files with 426 additions and 355 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Http\Controllers;
use App\FileManagerFolder;
use App\Http\Tools\Guardian;
use App\Share;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Auth;
@@ -63,8 +64,7 @@ class FileAccessController extends Controller
if ( ! $request->user()->tokenCan('master') ) {
// Get shared token
$shared = Share::where(DB::raw('BINARY `token`'), $request->cookie('shared_token'))
->firstOrFail();
$shared = get_shared($request->cookie('shared_token'));
// Check access to file
$this->check_file_access($shared, $file);
@@ -84,7 +84,7 @@ class FileAccessController extends Controller
public function get_file_public($filename, $token)
{
// Get sharing record
$shared = Share::where(DB::raw('BINARY `token`'), $token)->firstOrFail();
$shared = get_shared($token);
// Abort if shared is protected
if ($shared->protected) {
@@ -137,7 +137,7 @@ class FileAccessController extends Controller
public function get_thumbnail_public($filename, $token)
{
// Get sharing record
$shared = Share::where(DB::raw('BINARY `token`'), $token)->firstOrFail();
$shared = get_shared($token);
// Abort if thumbnail is protected
if ($shared->protected) {
@@ -165,18 +165,7 @@ class FileAccessController extends Controller
{
// Check by parent folder permission
if ($shared->type === 'folder') {
// 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 (!in_array($file->folder_id, $accessible_folder_ids)) abort(403);
Guardian::check_item_access($file->folder_id, $shared);
}
// Check by single file permission

View File

@@ -127,7 +127,14 @@ class EditItemsController extends Controller
}
// Rename item
return Editor::rename_item($request, $unique_id, $shared);
$item = Editor::rename_item($request, $unique_id, $shared);
// Set public url
if ($item->type !== 'folder') {
$item->setPublicUrl($token);
}
return $item;
}
/**

View File

@@ -33,7 +33,7 @@ class FileSharingController extends Controller
->firstOrFail();
// Delete old access_token if exist
Cookie::queue('access_token', '', -1);
Cookie::queue('shared_access_token', '', -1);
// Set cookies
if ($shared->protected) {
@@ -61,7 +61,7 @@ class FileSharingController extends Controller
// Check password
if (!Hash::check($request->password, $shared->password)) {
abort(401, 'Sorry, your password is incorrect.');
abort(401, __('vuefilemanager.incorrect_password'));
}
// Get owner of shared content
@@ -71,12 +71,12 @@ class FileSharingController extends Controller
$scope = !is_null($shared->permission) ? $shared->permission : 'visitor';
// Generate token for visitor/editor
$access_token = $user->createToken('access_token', [$scope])->accessToken;
$access_token = $user->createToken('shared_access_token', [$scope])->accessToken;
// Return authorize token with shared options
return response(new ShareResource($shared), 200)
->cookie('shared_token', $shared->token, 43200)
->cookie('access_token', $access_token, 43200);
->cookie('shared_access_token', $access_token, 43200);
}
/**

View File

@@ -4,6 +4,7 @@ namespace App\Http;
use App\Http\Middleware\CookieAuth;
use App\Http\Middleware\LastCheck;
use App\Http\Middleware\SharedAuth;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
@@ -55,7 +56,8 @@ class Kernel extends HttpKernel
* @var array
*/
protected $routeMiddleware = [
'auth.cookie' => CookieAuth::class,
'auth.master' => CookieAuth::class,
'auth.shared' => SharedAuth::class,
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
@@ -81,6 +83,7 @@ class Kernel extends HttpKernel
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
CookieAuth::class,
SharedAuth::class,
\App\Http\Middleware\Authenticate::class,
\Illuminate\Routing\Middleware\ThrottleRequests::class,
\Illuminate\Session\Middleware\AuthenticateSession::class,

View File

@@ -23,8 +23,6 @@ class CookieAuth
$request->headers->add(['Authorization' => 'Bearer ' . $access_token]);
} else {
abort(401);
}
}
return $next($request);

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Http\Middleware;
use Closure;
class SharedAuth
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (!$request->bearerToken()) {
if ($request->hasCookie('shared_access_token')) {
$shared_access_token = $request->cookie('shared_access_token');
$request->headers->add(['Authorization' => 'Bearer ' . $shared_access_token]);
}
}
return $next($request);
}
}

4
public/css/app.css vendored
View File

@@ -1 +1,3 @@
@import url(https://fonts.googleapis.com/css2?family=Nunito:wght@200;300;400;600;700;900&display=swap);
@import url(https://fonts.googleapis.com/css2?family=Nunito:wght@200;
300;400;600;700;900&display=swap);#application-wrapper{display:flex;height:100%}#application-wrapper #content{position:relative;width:100%}

2
public/js/main.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -4,8 +4,14 @@
* Released under the MIT License.
*/
/*!
* vue-i18n v8.17.4
* (c) 2020 kazuya kawaguchi
* Released under the MIT License.
*/
/**
* vee-validate v3.2.5
* vee-validate v3.3.0
* (c) 2020 Abdelrahman Awad
* @license MIT
*/
@@ -20,7 +26,7 @@
*/
/**
* vuex v3.1.3
* vuex v3.3.0
* (c) 2020 Evan You
* @license MIT
*/

View File

@@ -1,97 +1,4 @@
{
"/js/main.js": "/js/main.js",
"/css/app.css": "/css/app.css",
"/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"
"/css/app.css": "/css/app.css"
}

View File

@@ -85,9 +85,6 @@
this.$store.commit('SET_CONFIG', this.$root.$data.config)
},
mounted() {
//events.$emit('share-item')
// Handle VueFileManager width
var VueFileManager = document.getElementById('vue-file-manager');
new ResizeSensor(VueFileManager, this.handleAppResize);

View File

@@ -56,7 +56,7 @@
this.button = this.$t('alerts.error_confirm')
this.emoji = '😢😢😢'
this.buttonStyle = 'danger'
this.buttonStyle = 'danger-solid'
if (args.emoji) {
this.emoji = args.emoji
@@ -109,7 +109,7 @@
top: 50%;
transform: translateY(-50%) scale(1);
margin: 0 auto;
padding: 40px;
padding: 20px;
box-shadow: $light_mode_popup_shadow;
border-radius: 8px;
text-align: center;

View File

@@ -34,7 +34,7 @@
{{ $t('context_menu.delete') }}
</li>
<li class="menu-option" @click="shareItem" v-if="item">
{{ item.shared ? 'Edit Sharing' : $t('context_menu.share') }}
{{ item.shared ? $t('context_menu.share_edit') : $t('context_menu.share') }}
</li>
<li class="menu-option" @click="ItemDetail" v-if="item">
{{ $t('context_menu.detail') }}
@@ -59,7 +59,7 @@
{{ $t('context_menu.move') }}
</li>
<li class="menu-option" @click="shareItem" v-if="item">
{{ item.shared ? 'Edit Sharing' : $t('context_menu.share') }}
{{ item.shared ? $t('context_menu.share_edit') : $t('context_menu.share') }}
</li>
<li class="menu-option" @click="ItemDetail" v-if="item">
{{ $t('context_menu.detail') }}

View File

@@ -28,17 +28,17 @@
<div class="toolbar-button-wrapper" v-if="$checkPermission(['master', 'editor'])">
<ToolbarButtonUpload
source="upload"
action="Upload file"
:action="$t('actions.upload')"
/>
<ToolbarButton
source="trash-alt"
action="Delete"
:action="$t('actions.delete')"
@click.native="deleteItems"
/>
<ToolbarButton
@click.native="createFolder"
source="folder-plus"
action="Create folder"
:action="$t('actions.create_folder')"
/>
</div>
@@ -46,7 +46,7 @@
<div class="toolbar-button-wrapper">
<ToolbarButton
:source="preview"
action="Change Preview"
:action="$t('actions.preview')"
@click.native="$store.dispatch('changePreviewType')"
/>
<ToolbarButton

View File

@@ -1,47 +1,55 @@
<template>
<div class="empty-message">
<div class="message">
<FontAwesomeIcon class="icon" :icon="icon" />
<p>{{ message }}</p>
</div>
</div>
<div class="empty-message">
<div class="message">
<FontAwesomeIcon class="icon" :icon="icon"/>
<p>{{ message }}</p>
</div>
</div>
</template>
<script>
export default {
name: 'EmptyMessage',
props: ['icon', 'message']
}
export default {
name: 'EmptyMessage',
props: ['icon', 'message']
}
</script>
<style scoped lang="scss">
@import "@assets/app.scss";
@import "@assets/app.scss";
.empty-message {
text-align: center;
display: flex;
align-items: center;
height: 100%;
.empty-message {
text-align: center;
display: flex;
align-items: center;
height: 100%;
.message {
margin: 0 auto;
.message {
margin: 0 auto;
p {
margin-top: 10px;
max-width: 130px;
@include font-size(14);
font-weight: 500;
color: $text-muted;
}
p {
margin-top: 10px;
max-width: 130px;
@include font-size(14);
font-weight: 500;
color: $text-muted;
}
.icon {
@include font-size(36);
color: $text;
.icon {
@include font-size(36);
color: $text;
path {
color: $text;
}
}
}
}
path {
fill: $text;
}
}
}
}
@media (prefers-color-scheme: dark) {
.empty-message .message .icon {
path {
fill: $dark_mode_text_secondary;
}
}
}
</style>

View File

@@ -4,7 +4,7 @@
<!--Shared empty message-->
<div class="text-content" v-if="$isThisLocation(['shared']) && ! isLoading">
<h1 class="title">You Haven't Shared Anything Yet</h1>
<h1 class="title">{{ $t('shared.empty_shared') }}</h1>
</div>
<!--Trash empty message-->

View File

@@ -203,26 +203,6 @@
// On items delete
events.$on('items:delete', () => {
this.$store.dispatch('deleteItem', this.fileInfoDetail)
//let ids = []
//let items = []
// Get ids
/*this.$children[0].$children.filter(item => {
if (item.isClicked) {
ids.push(item.data.unique_id)
items.push({
unique_id: item.data.unique_id,
type: item.data.type,
})
}
})*/
// Dispatch action
/*this.$store.dispatch('removeItems', [ids, items])*/
})
}
}
@@ -299,4 +279,10 @@
.file-leave-active {
position: absolute;
}
@media only screen and (max-width: 660px) {
.file-info-container {
display: none;
}
}
</style>

View File

@@ -1,7 +1,6 @@
<template>
<div class="file-info-content" v-if="fileInfoDetail">
<div class="file-headline" spellcheck="false">
<FilePreview />
<!--File info-->
@@ -29,8 +28,8 @@
<!--Latest change-->
<li v-if="$checkPermission(['master']) && fileInfoDetail.user_scope !== 'master'" class="list-info-item">
<b>Author</b>
<span>Public Participant</span>
<b>{{ $t('file_detail.author') }}</b>
<span>{{ $t('file_detail.author_participant') }}</span>
</li>
<!--Latest change-->
@@ -50,7 +49,7 @@
<!--Parent-->
<li v-if="$checkPermission('master') && fileInfoDetail.shared" class="list-info-item">
<b>Shared</b>
<b>{{ $t('file_detail.shared') }}</b>
<div class="action-button" @click="shareItemOptions">
<FontAwesomeIcon class="icon" :icon="sharedIcon" />
<span>{{ sharedInfo }}</span>
@@ -77,7 +76,7 @@
CopyInput,
},
computed: {
...mapGetters(['fileInfoDetail']),
...mapGetters(['fileInfoDetail', 'permissionOptions']),
filePreviewIcon() {
switch (this.fileInfoDetail.type) {
case 'folder':
@@ -98,16 +97,13 @@
}
},
sharedInfo() {
switch (this.fileInfoDetail.shared.permission) {
case 'editor':
return 'Can edit and upload files'
break
case 'visitor':
return 'Can only view and download'
break
default:
return 'Can download file'
}
// Get permission title
let title = this.permissionOptions.find(option => {
return option.value === this.fileInfoDetail.shared.permission
})
return title ? title.label : this.$t('shared.can_download')
},
sharedIcon() {
switch (this.fileInfoDetail.shared.permission) {
@@ -133,7 +129,6 @@
moveItem() {
// Move item fire popup
events.$emit('popup:open', {name: 'move', item: this.fileInfoDetail})
}
}
}
@@ -229,7 +224,7 @@
margin-right: 2px;
path {
fill: $theme_light;
fill: $theme;
}
}
}
@@ -313,5 +308,22 @@
}
}
}
.sharelink {
.lock-icon {
path {
fill: $dark_mode_text_primary;
}
&:hover {
path {
fill: $theme;
}
}
}
}
}
</style>

View File

@@ -52,7 +52,7 @@
<!--Shared Icon-->
<div v-if="$checkPermission('master') && data.shared" class="item-shared">
<FontAwesomeIcon class="shared-icon" icon="user-friends"/>
<FontAwesomeIcon class="shared-icon" icon="share"/>
</div>
<!--Participant owner Icon-->
@@ -86,7 +86,9 @@
name: 'FileItemGrid',
props: ['data'],
computed: {
...mapGetters(['FilePreviewType']),
...mapGetters([
'FilePreviewType', 'sharedDetail'
]),
isFolder() {
return this.data.type === 'folder'
},
@@ -97,7 +99,10 @@
return this.data.type === 'image'
},
canEditName() {
return !this.$isMobile() && !this.$isThisLocation(['trash', 'trash-root']) && !this.$checkPermission('visitor')
return !this.$isMobile()
&& !this.$isThisLocation(['trash', 'trash-root'])
&& !this.$checkPermission('visitor')
&& (this.sharedDetail && this.sharedDetail.type !== 'file')
},
canDrag() {
return !this.isDeleted && this.$checkPermission(['master', 'editor'])

View File

@@ -51,7 +51,7 @@
<!--Shared Icon-->
<div v-if="$checkPermission('master') && data.shared" class="item-shared">
<FontAwesomeIcon class="shared-icon" icon="user-friends"/>
<FontAwesomeIcon class="shared-icon" icon="share"/>
</div>
<!--Participant owner Icon-->

View File

@@ -31,7 +31,7 @@
{{ $t('context_menu.rename') }}
</li>
<li class="menu-option" @click="shareItem" v-if="fileInfoDetail">
{{ fileInfoDetail.shared ? 'Edit Sharing' : $t('context_menu.share') }}
{{ fileInfoDetail.shared ? $t('context_menu.share_edit') : $t('context_menu.share') }}
</li>
<li class="menu-option" @click="downloadItem" v-if="! isFolder">
{{ $t('context_menu.download') }}
@@ -53,7 +53,7 @@
{{ $t('context_menu.move') }}
</li>
<li class="menu-option" @click="shareItem" v-if="fileInfoDetail">
{{ fileInfoDetail.shared ? 'Edit Sharing' : $t('context_menu.share') }}
{{ fileInfoDetail.shared ? $t('context_menu.share_edit') : $t('context_menu.share') }}
</li>
<li class="menu-option" @click="downloadItem" v-if="! isFolder">
{{ $t('context_menu.download') }}

View File

@@ -22,7 +22,7 @@
.label {
@include font-size(12);
color: $theme_light;
color: $theme;
font-weight: 600;
text-decoration: underline;
}
@@ -33,7 +33,7 @@
margin-right: 2px;
path {
fill: $theme_light;
fill: $theme;
}
}
}

View File

@@ -75,4 +75,16 @@
}
}
}
@media (prefers-color-scheme: dark) {
.copy-input {
input {
color: $dark_mode_text_primary;
&:disabled {
}
}
}
}
</style>

View File

@@ -14,7 +14,7 @@
<!--If is empty-->
<div class="not-selected" v-if="! selected">
<span class="option-value placehoder">Selected your permision</span>
<span class="option-value placehoder">{{ placeholder }}</span>
</div>
<FontAwesomeIcon icon="chevron-down" class="chevron"/>
@@ -37,7 +37,7 @@
<script>
export default {
name:'SelectInput',
props: ['options', 'isError', 'default'],
props: ['options', 'isError', 'default', 'placeholder'],
data() {
return {
selected: undefined,

View File

@@ -28,7 +28,6 @@
},
methods: {
changeState() {
this.isSwitched = ! this.isSwitched
this.$emit('input', this.isSwitched)
}
@@ -90,4 +89,10 @@
}
}
}
@media (prefers-color-scheme: dark) {
.switch {
background: $dark_mode_foreground;
}
}
</style>

View File

@@ -31,7 +31,8 @@
// Open called popup
events.$on('popup:open', ({name}) => {
if (this.name === name) this.isVisibleWrapper = true
if (this.name === name)
this.isVisibleWrapper = true
})
// Close popup

View File

@@ -1,7 +1,7 @@
<template>
<PopupWrapper name="share-create">
<!--Title-->
<PopupHeader :title="'Share Your ' + itemTypeTitle" />
<PopupHeader :title="$t('popup_share_create.title', {item: itemTypeTitle})" />
<!--Content-->
<PopupContent>
@@ -14,22 +14,22 @@
<!--Permision Select-->
<ValidationProvider v-if="isFolder" tag="div" mode="passive" class="input-wrapper" name="Permission" rules="required" v-slot="{ errors }">
<label class="input-label">Permission:</label>
<SelectInput v-model="shareOptions.permission" :options="permissionOptions" :isError="errors[0]"/>
<label class="input-label">{{ $t('shared_form.label_permission') }}:</label>
<SelectInput v-model="shareOptions.permission" :options="permissionOptions" :placeholder="$t('shared_form.placeholder_permission')" :isError="errors[0]"/>
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
<!--Password Switch-->
<div class="input-wrapper">
<div class="inline-wrapper">
<label class="input-label">Password Protected:</label>
<label class="input-label">{{ $t('shared_form.label_password_protection') }}:</label>
<SwitchInput v-model="shareOptions.isPassword" class="switch" :state="0"/>
</div>
</div>
<!--Set password-->
<ValidationProvider v-if="shareOptions.isPassword" tag="div" mode="passive" class="input-wrapper password" name="Password" rules="required" v-slot="{ errors }">
<input v-model="shareOptions.password" :class="{'is-error': errors[0]}" type="text" placeholder="Type your password">
<input v-model="shareOptions.password" :class="{'is-error': errors[0]}" type="text" :placeholder="$t('page_sign_in.placeholder_password')">
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</ValidationObserver>
@@ -37,7 +37,7 @@
<!--Copy generated link-->
<div v-if="isGeneratedShared" class="form-wrapper">
<div class="input-wrapper">
<label class="input-label">Share url:</label>
<label class="input-label">{{ $t('shared_form.label_shared_url') }}:</label>
<CopyInput size="small" :value="shareLink" />
</div>
</div>
@@ -65,10 +65,10 @@
</template>
<script>
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
import PopupWrapper from '@/components/Others/Popup/PopupWrapper'
import PopupActions from '@/components/Others/Popup/PopupActions'
import PopupContent from '@/components/Others/Popup/PopupContent'
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
import PopupHeader from '@/components/Others/Popup/PopupHeader'
import SwitchInput from '@/components/Others/Forms/SwitchInput'
import SelectInput from '@/components/Others/Forms/SelectInput'
@@ -99,13 +99,13 @@
computed: {
...mapGetters(['app', 'permissionOptions']),
itemTypeTitle() {
return this.pickedItem && this.pickedItem.type === 'folder' ? 'Folder' : 'File'
return this.pickedItem && this.pickedItem.type === 'folder' ? this.$t('types.folder') : this.$t('types.file')
},
isFolder() {
return this.pickedItem && this.pickedItem.type === 'folder'
},
submitButtonText() {
return this.isGeneratedShared ? 'Awesome, Im done!' : 'Generate Link'
return this.isGeneratedShared ? this.$t('shared_form.button_done') : this.$t('shared_form.button_generate')
}
},
data() {

View File

@@ -1,7 +1,7 @@
<template>
<PopupWrapper name="share-edit">
<!--Title-->
<PopupHeader title="Update sharing options" />
<PopupHeader :title="$t('popup_share_edit.title')" />
<!--Content-->
<PopupContent v-if="pickedItem && pickedItem.shared">
@@ -14,29 +14,29 @@
<!--Share link-->
<div class="input-wrapper">
<label class="input-label">Share url:</label>
<label class="input-label">{{ $t('shared_form.label_shared_url') }}:</label>
<CopyInput size="small" :value="pickedItem.shared.link" />
</div>
<!--Permision Select-->
<ValidationProvider v-if="isFolder" tag="div" mode="passive" class="input-wrapper" name="Permission" rules="required" v-slot="{ errors }">
<label class="input-label">Permission:</label>
<SelectInput v-model="shareOptions.permission" :options="permissionOptions" :default="shareOptions.permission" :isError="errors[0]"/>
<label class="input-label">{{ $t('shared_form.label_permission') }}:</label>
<SelectInput v-model="shareOptions.permission" :options="permissionOptions" :default="shareOptions.permission" :placeholder="$t('shared_form.placeholder_permission')" :isError="errors[0]"/>
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
<!--Password Switch-->
<div class="input-wrapper">
<div class="inline-wrapper">
<label class="input-label">Password Protected:</label>
<label class="input-label">{{ $t('shared_form.label_password_protection') }}:</label>
<SwitchInput v-model="shareOptions.isProtected" :state="shareOptions.isProtected" class="switch"/>
</div>
<ActionButton v-if="(pickedItem.shared.protected && canChangePassword) && shareOptions.isProtected" @click.native="changePassword" icon="pencil-alt">Change Password</ActionButton>
<ActionButton v-if="(pickedItem.shared.protected && canChangePassword) && shareOptions.isProtected" @click.native="changePassword" icon="pencil-alt">{{ $t('popup_share_edit.change_pass') }}</ActionButton>
</div>
<!--Set password-->
<ValidationProvider v-if="shareOptions.isProtected && ! canChangePassword" tag="div" mode="passive" class="input-wrapper password" name="Password" rules="required" v-slot="{ errors }">
<input v-model="shareOptions.password" :class="{'is-error': errors[0]}" type="text" placeholder="Type your password">
<input v-model="shareOptions.password" :class="{'is-error': errors[0]}" type="text" :placeholder="$t('page_sign_in.placeholder_password')">
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
@@ -60,17 +60,17 @@
button-style="theme"
:loading="isLoading"
:disabled="isLoading"
>Ok
>{{ $t('popup_share_edit.save') }}
</ButtonBase>
</PopupActions>
</PopupWrapper>
</template>
<script>
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
import PopupWrapper from '@/components/Others/Popup/PopupWrapper'
import PopupActions from '@/components/Others/Popup/PopupActions'
import PopupContent from '@/components/Others/Popup/PopupContent'
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
import PopupHeader from '@/components/Others/Popup/PopupHeader'
import SwitchInput from '@/components/Others/Forms/SwitchInput'
import SelectInput from '@/components/Others/Forms/SelectInput'
@@ -106,7 +106,7 @@
return this.pickedItem && this.pickedItem.type === 'folder'
},
destroyButtonText() {
return this.isConfirmedDestroy ? 'Confirm' : 'Stop Sharing'
return this.isConfirmedDestroy ? this.$t('popup_share_edit.confirm') : this.$t('popup_share_edit.stop')
},
destroyButtonStyle() {
return this.isConfirmedDestroy ? 'danger-solid' : 'secondary'
@@ -144,7 +144,6 @@
axios
.delete('/api/share/' + this.pickedItem.shared.token)
.then(() => {
// Remove item from file browser
if ( this.isSharedLocation ) {
this.$store.commit('REMOVE_ITEM', this.pickedItem.unique_id)
@@ -154,7 +153,7 @@
this.$store.commit('FLUSH_SHARED', this.pickedItem.unique_id)
// End deleting spinner button
this.isDeleting = false
setTimeout(() => this.isDeleting = false, 150)
this.$closePopup()
})

View File

@@ -159,7 +159,7 @@
.small {
.file-item {
padding: 0 15px;
margin-bottom: 15px;
margin-bottom: 25px;
}
}

View File

@@ -24,7 +24,7 @@
<span class="name" >{{ file.name }}</span>
<!--Other attributes-->
<span v-if="! isFolder" class="item-size">{{ file.filesize }}, {{ file.created_at }}</span>
<span v-if="! isFolder" class="item-size">{{ file.filesize }}</span>
<span v-if="isFolder" class="item-length">{{ file.items == 0 ? $t('folder.empty') : $tc('folder.item_counts', folderItems) }}, {{ file.created_at }}</span>
</div>

View File

@@ -18,7 +18,7 @@
</li>
<li class="menu-list-item" :class="{'is-active': isSharedLocation}" @click="getShared">
<FontAwesomeIcon class="icon" icon="share"/>
<span class="label">Shared</span>
<span class="label">{{ $t('locations.shared') }}</span>
</li>
<li class="menu-list-item" :class="{'is-active': isTrashLocation}" @click="getTrash">
<FontAwesomeIcon class="icon" icon="trash-alt"/>
@@ -394,7 +394,7 @@
@media (prefers-color-scheme: dark) {
#sidebar {
background: $dark_mode_foreground;
background: $dark_mode_background;
}
.menu-list-wrapper {

View File

@@ -176,7 +176,7 @@
@media (prefers-color-scheme: dark) {
.user-headline {
background: $dark_mode_foreground;
background: $dark_mode_background;
padding: 0;
&:hover {
@@ -197,6 +197,10 @@
.menu-option {
color: $dark_mode_text_primary;
a {
color: $dark_mode_text_primary;
}
&:hover {
background: $dark_mode_foreground;
}

View File

@@ -55,6 +55,7 @@ const Helpers = {
// Prevent submit empty files
if (files && files.length == 0) return
// Check storage size
if (! this.$isThisLocation(['public']) && this.$store.getters.app.storage.percentage >= 100) {
events.$emit('alert:open', {
emoji: '😬😬😬',
@@ -88,7 +89,8 @@ const Helpers = {
formData.append('parent_id', rootFolder)
// Upload data
await store.dispatch('uploadFiles', formData).then(() => {
await store.dispatch('uploadFiles', formData)
.then(() => {
// Progress file log
store.commit('UPDATE_FILE_COUNT_PROGRESS', {
current: fileCountSucceed,
@@ -104,7 +106,7 @@ const Helpers = {
}
}).catch(error => {
/*if (error.response.status === 423) {
if (error.response.status === 423) {
events.$emit('alert:open', {
emoji: '😬😬😬',
@@ -119,7 +121,7 @@ const Helpers = {
title: this.$t('popup_error.title'),
message: this.$t('popup_error.message'),
})
}*/
}
})
}
}
@@ -132,7 +134,8 @@ const Helpers = {
// Get files
const files = [...event.dataTransfer.items].map(item => item.getAsFile());
if (this.$store.getters.app.storage.percentage >= 100) {
// Check storage size
if (! this.$isThisLocation(['public']) && this.$store.getters.app.storage.percentage >= 100) {
events.$emit('alert:open', {
emoji: '😬😬😬',
title: this.$t('popup_exceed_limit.title'),
@@ -141,6 +144,7 @@ const Helpers = {
return
}
let fileCountSucceed = 1
store.commit('UPDATE_FILE_COUNT_PROGRESS', {

View File

@@ -2,14 +2,14 @@ import Vue from 'vue';
import VueI18n from 'vue-i18n';
import en from './lang/en.json'
import sk from './lang/sk.json'
//import sk from './lang/sk.json'
Vue.use(VueI18n);
const i18n = new VueI18n({
locale: config.locale,
messages: Object.assign({
en, sk
en
}),
});

View File

@@ -24,6 +24,13 @@
"button_create_account": "Create Account",
"have_an_account": "Do you have an account?"
},
"page_shared": {
"subtitle": "Please type the password to get shared content:",
"title": "Your Share Link is Protected",
"placeholder_pass": "Type password",
"download_file": "Download File",
"submit": "Submit"
},
"page_create_password": {
"title": "Only One Step to Log In",
"subtitle": "Create your new password here:",
@@ -71,11 +78,15 @@
"nothing_was_found": "Nothing was found"
},
"locations": {
"home": "Home",
"trash": "Trash"
"shared": "Shared",
"trash": "Trash",
"home": "Home"
},
"file_detail": {
"author_participant": "Public Participant",
"created_at": "Created at",
"shared": "Shared",
"author": "Author",
"where": "Where",
"size": "Size"
},
@@ -117,6 +128,7 @@
"profile_settings": "Profile Settings",
"create_folder": "Create Folder",
"empty_trash": "Empty Trash",
"share_edit": "Edit Sharing",
"add_folder": "Add Folder",
"download": "Download",
"log_out": "Log Out",
@@ -129,6 +141,7 @@
"move": "Move"
},
"sidebar": {
"shared": "Shared",
"locations": "Locations",
"favourites": "Favourites",
"favourites_empty": "Drag here your favourite folder.",
@@ -162,5 +175,39 @@
"popup_exceed_limit": {
"title": "Whooops, you exceed your storage limit :(",
"message": "Please contact your administrator to change your limit."
},
"popup_share_create": {
"title": "Share Your {item}"
},
"popup_share_edit": {
"title": "Update sharing options",
"change_pass": "Change Password",
"save": "Save Changes",
"stop": "Stop Sharing",
"confirm": "Confirm"
},
"shared": {
"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"
},
"shared_form": {
"placeholder_permission": "Select your permission",
"label_password_protection": "Password Protected",
"button_done": "Awesome, Im done!",
"button_generate": "Generate Link",
"label_permission": "Permission",
"label_shared_url": "Share url"
},
"actions": {
"create_folder": "Create folder",
"preview": "Change preview",
"upload": "Upload file",
"delete": "Delete item"
},
"types": {
"folder": "Folder",
"file": "File"
}
}

View File

@@ -24,6 +24,13 @@
"button_create_account": "Vytvoriť účet",
"have_an_account": "Máš už účet?"
},
"page_shared": {
"subtitle": "Prosím vložte heslo pre získanie prístupu k obsahu:",
"title": "Zdieľaný odkaz je chránený",
"placeholder_pass": "Vložte heslo",
"download_file": "Stiahnúť súbor",
"submit": "Potvrdiť"
},
"page_create_password": {
"title": "Iba jeden krok pre prihlásenie",
"subtitle": "Vytvorte si nové heslo tu:",
@@ -71,12 +78,16 @@
"nothing_was_found": "Nič sa nenašlo"
},
"locations": {
"shared": "Zdieľané",
"home": "Domov",
"trash": "Kôš"
},
"file_detail": {
"author_participant": "Verejný účastník",
"created_at": "Vytvorené",
"where": "Umiestnenie",
"shared": "Zdieľané",
"author": "Autor",
"size": "Veľkosť"
},
"empty_page": {
@@ -116,19 +127,21 @@
"add_to_favourites": "Pridať do obľúbených",
"profile_settings": "Nastavenia profilu",
"create_folder": "Vytvoriť priečinok",
"share_edit": "Upraviť zdieľanie",
"empty_trash": "Vyprázdniť kôš",
"add_folder": "Nový priečinok",
"download": "Stiahnúť",
"log_out": "Odhlásiť sa",
"download": "Stiahnúť",
"rename": "Premenovať",
"restore": "Obnoviť",
"upload": "Nahrať",
"detail": "Detail",
"rename": "Premenovať",
"delete": "Vymazať",
"share": "Zdieľať",
"move": "Presunúť"
},
"sidebar": {
"shared": "Zdieľané",
"locations": "Umiestnenie",
"favourites": "Obľúbené",
"favourites_empty": "Presuňte sem svoj obľúbený priečinok.",
@@ -162,5 +175,39 @@
"popup_exceed_limit": {
"title": "Ups, presiahli ste limit úložiska",
"message": "Prosím, kontaktujte administrátora pre navyšenie limitu."
},
"popup_share_create": {
"title": "Zdieľaj {item}"
},
"popup_share_edit": {
"title": "Upraviť nastavenia zdieľania",
"change_pass": "Zmeniť heslo",
"save": "Uložiť zmeny",
"stop": "Zastaviť zdieľanie",
"confirm": "Potvrdiť"
},
"shared": {
"empty_shared": "Zatiaľ ste nič nezdieľali",
"editor": "Môže upravovať a nahrávať súbory",
"visitor": "Môže len vidieť a sťahovať súbory",
"can_download": "Môže stiahnúť súbor"
},
"shared_form": {
"placeholder_permission": "Zvoľte oprávnenia",
"label_password_protection": "Chrániť heslom",
"button_done": "Super, som hotový!",
"button_generate": "Vygenerovať link",
"label_permission": "Oprávnenie",
"label_shared_url": "Zdieľací odkaz"
},
"actions": {
"create_folder": "Vytvoriť priečinok",
"preview": "Zmeniť náhľad",
"upload": "Nahrať súbory",
"delete": "Vymazať položku"
},
"types": {
"folder": "Priečinok",
"file": "Súbor"
}
}

View File

@@ -1,6 +1,5 @@
import Vue from 'vue'
import Router from 'vue-router'
import store from '@/store'
import Index from './views/Auth/SignIn'
import SignUp from './views/Auth/SignUp'

View File

@@ -43,7 +43,9 @@ const actions = {
location: folder.deleted_at || folder.location === 'trash' ? 'trash' : 'base'
}
let url = currentFolder.location === 'trash' ? '/folders/' + currentFolder.unique_id + '?trash=true' : '/folders/' + currentFolder.unique_id
let url = currentFolder.location === 'trash'
? '/folders/' + currentFolder.unique_id + '?trash=true'
: '/folders/' + currentFolder.unique_id
axios
.get(context.getters.api + url)
@@ -61,12 +63,22 @@ const actions = {
if (!init) context.commit('ADD_BROWSER_HISTORY', currentFolder)
}
})
.catch(() => {
// Show error message
events.$emit('alert:open', {
title: i18n.t('popup_error.title'),
message: i18n.t('popup_error.message'),
})
.catch(error => {
// Redirect if unauthenticated
if ([401, 403].includes(error.response.status)) {
context.commit('SET_AUTHORIZED', false)
router.push({name: 'SignIn'})
} else {
// Show error message
events.$emit('alert:open', {
title: i18n.t('popup_error.title'),
message: i18n.t('popup_error.message'),
})
}
})
},
getShared: (context, back = false) => {
@@ -187,7 +199,7 @@ const actions = {
if (getters.sharedDetail && getters.sharedDetail.protected)
route = '/api/navigation/private'
else if (getters.sharedDetail && ! getters.sharedDetail.protected)
else if (getters.sharedDetail && !getters.sharedDetail.protected)
route = '/api/navigation/public/' + router.currentRoute.params.token
else
route = '/api/navigation'
@@ -209,8 +221,6 @@ const actions = {
})
})
})
},
}

View File

@@ -3,7 +3,6 @@ import router from '@/router'
import {events} from '@/bus'
import axios from 'axios'
const actions = {
moveItem: ({commit, getters}, [item_from, to_item]) => {
@@ -86,9 +85,11 @@ const actions = {
if (response.data.folder_id == getters.currentFolder.unique_id)
commit('ADD_NEW_ITEMS', response.data)
commit('UPDATE_RECENT_UPLOAD', response.data)
commit('UPLOADING_FILE_PROGRESS', 0)
if (getters.permission === 'master')
commit('UPDATE_RECENT_UPLOAD', response.data)
resolve(response)
})
.catch(error => {

View File

@@ -6,12 +6,12 @@ import axios from 'axios'
const defaultState = {
permissionOptions: [
{
label: 'Can edit and upload files',
label: i18n.t('shared.editor'),
value: 'editor',
icon: 'user-edit',
},
{
label: 'Can only view and download',
label: i18n.t('shared.visitor'),
value: 'visitor',
icon: 'user',
},
@@ -74,7 +74,9 @@ const actions = {
},
getSingleFile: ({commit, state}) => {
let route = state.sharedDetail.protected ? '/api/files/private' : '/api/files/' + router.currentRoute.params.token + '/public'
let route = state.sharedDetail.protected
? '/api/files/private'
: '/api/files/' + router.currentRoute.params.token + '/public'
axios.get(route)
.then(response => {

View File

@@ -5,12 +5,12 @@ import router from '@/router'
const defaultState = {
authorized: undefined,
permission: 'master', // master | editor | visitor,
permission: 'master', // master | editor | visitor
app: undefined,
}
const actions = {
getAppData: ({commit, dispatch, getters}) => {
getAppData: ({commit, getters}) => {
axios
.get(getters.api + '/user')
@@ -19,8 +19,11 @@ const actions = {
}).catch((error) => {
if (error.response.status == 401) {
// Redirect if unauthenticated
if ([401, 403].includes(error.response.status)) {
commit('SET_AUTHORIZED', false)
router.push({name: 'SignIn'})
}
}
)

View File

@@ -47,36 +47,18 @@
},
mounted() {
// Set default directory
if (this.config.directory) {
// Set start directory
this.$store.commit('SET_START_DIRECTORY', this.config.directory)
// Load folder
this.$store.dispatch('getFolder', [
{
unique_id: this.config.directory.unique_id,
name: this.config.directory.name,
location: 'base',
},
false,
true
])
} else {
let homeDirectory = {
unique_id: 0,
name: 'Home',
location: 'base',
}
// Set start directory
this.$store.commit('SET_START_DIRECTORY', homeDirectory)
// Load folder
this.$store.dispatch('getFolder', [homeDirectory, false, true])
let homeDirectory = {
name: this.$t('locations.home'),
location: 'base',
unique_id: 0,
}
// Set start directory
this.$store.commit('SET_START_DIRECTORY', homeDirectory)
// Load folder
this.$store.dispatch('getFolder', [homeDirectory, false, true])
var filesView = document.getElementById('files-view');
new ResizeSensor(filesView, this.handleContentResize);
}

View File

@@ -85,7 +85,7 @@
import axios from 'axios'
export default {
name: 'UserSettings',
name: 'Profile',
components: {
ValidationProvider,
ValidationObserver,

View File

@@ -16,17 +16,17 @@
<!--Verify share link by password-->
<AuthContent class="center" name="password" :visible="true">
<img class="logo" :src="config.app_logo" :alt="config.app_name">
<h1>Your Share Link is Protected</h1>
<h2>Please type the password to get shared content:</h2>
<h1>{{ $t('page_shared.title') }}</h1>
<h2>{{ $t('page_shared.subtitle') }}</h2>
<ValidationObserver @submit.prevent="authenticateProtected" ref="authenticateProtected" v-slot="{ invalid }" tag="form" class="form inline-form">
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="Password" rules="required" v-slot="{ errors }">
<input v-model="password" placeholder="Type password" type="password" :class="{'is-error': errors[0]}"/>
<input v-model="password" :placeholder="$t('page_shared.placeholder_pass')" type="password" :class="{'is-error': errors[0]}"/>
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
<AuthButton icon="chevron-right" text="Submit" :loading="isLoading" :disabled="isLoading" />
<AuthButton icon="chevron-right" :text="$t('page_shared.submit')" :loading="isLoading" :disabled="isLoading" />
</ValidationObserver>
</AuthContent>
</div>
@@ -38,7 +38,7 @@
<FileItemGrid v-if="sharedFile" :data="sharedFile"/>
<ButtonBase @click.native="download" class="download-button" button-style="theme">
Download File
{{ $t('page_shared.download_file') }}
</ButtonBase>
</div>
</div>
@@ -64,8 +64,8 @@
</template>
<script>
import DesktopToolbar from '@/components/FilesView/DesktopToolbar'
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
import DesktopToolbar from '@/components/FilesView/DesktopToolbar'
import FileItemGrid from '@/components/FilesView/FileItemGrid'
import FileBrowser from '@/components/FilesView/FileBrowser'
import ContextMenu from '@/components/FilesView/ContextMenu'
@@ -129,7 +129,7 @@
axios
.post('/api/shared/authenticate/' + this.$route.params.token, {
password: this.password
}).then(response => {
}).then(() => {
// End loading
this.isLoading = false
@@ -140,20 +140,46 @@
// Get protected files
this.getFiles();
})
}).catch(error => {
/*.catch((error) => {
/!*if (error.response.status == 401) {
if (error.response.status == 401) {
this.$refs.authenticateProtected.setErrors({
'Password': [error.response.data.message]
});
}*!/
}
// End loading
this.isLoading = false
})*/
})
},
getFiles() {
// Show folder
if (this.sharedDetail.type === 'folder') {
let homeDirectory = {
unique_id: this.sharedDetail.item_id,
name: this.$t('locations.home'),
location: 'public',
}
// Set start directory
this.$store.commit('SET_START_DIRECTORY', homeDirectory)
// Load folder
this.$store.dispatch('browseShared', [homeDirectory, false, true])
.then(() => {
var filesView = document.getElementById('files-view')
new ResizeSensor(filesView, this.handleContentResize)
})
}
// Get file
if (this.sharedDetail.type === 'file') {
this.$store.dispatch('getSingleFile')
}
},
download() {
this.$downloadFile(this.sharedFile.file_url, this.sharedFile.name + '.' + this.sharedFile.mimetype)
@@ -176,33 +202,6 @@
else if (filesView >= 960)
this.$store.commit('SET_FILES_VIEW_SIZE', 'full-scale')
},
getFiles() {
// Show folder
if (this.sharedDetail.type === 'folder') {
let homeDirectory = {
unique_id: this.sharedDetail.item_id,
name: 'Home',
}
// Set start directory
this.$store.commit('SET_START_DIRECTORY', homeDirectory)
// Load folder
this.$store.dispatch('browseShared', [homeDirectory, false, true])
.then(() => {
var filesView = document.getElementById('files-view')
new ResizeSensor(filesView, this.handleContentResize)
})
}
// Get file
if (this.sharedDetail.type === 'file') {
this.$store.dispatch('getSingleFile')
}
}
},
created() {

View File

@@ -1,7 +1,8 @@
<?php
return [
'user_not_fount' => 'We can\'t find a user with that e-mail address.',
'home' => 'Home',
'time' => '%d. %B. %Y at %H:%M',
];
return [
'user_not_fount' => 'We can\'t find a user with that e-mail address.',
'home' => 'Home',
'time' => '%d. %B. %Y at %H:%M',
'incorrect_password' => 'Sorry, your password is incorrect.',
];

View File

@@ -1,7 +1,8 @@
<?php
return [
'user_not_fount' => 'Uživateľ s touto emailovou adresou sa nenašiel.',
'home' => 'Domov',
'time' => '%d. %B. %Y o %H:%M',
'user_not_fount' => 'Uživateľ s touto emailovou adresou sa nenašiel.',
'home' => 'Domov',
'time' => '%d. %B. %Y o %H:%M',
'incorrect_password' => 'Prepáč, zadané heslo je nesprávne',
];

View File

@@ -34,7 +34,7 @@
}
.icon {
background: $theme_light;
background: $theme;
padding: 14px 18px;
border-top-right-radius: 8px;
border-bottom-right-radius: 8px;
@@ -54,4 +54,10 @@
font-weight: 700;
margin-bottom: 5px;
display: block;
}
@media (prefers-color-scheme: dark) {
.input-label {
color: $dark_mode_text_primary;
}
}

View File

@@ -3,7 +3,6 @@ $text: #1b2539;
$text-muted: #667b90;
$theme: #00BC7E;
$theme_light: #4ECDA5;
$light_mode_border: rgba(0, 0, 0, 0.02);
$danger: #fd397a;

View File

@@ -44,7 +44,7 @@ Route::group(['middleware' => ['api']], function () {
});
// User master Routes
Route::group(['middleware' => ['auth:api', 'auth.cookie', 'scope:master']], function () {
Route::group(['middleware' => ['auth:api', 'auth.master', 'scope:master']], function () {
// User
Route::post('/user/password', 'User\AccountController@change_password');
@@ -77,7 +77,7 @@ Route::group(['middleware' => ['auth:api', 'auth.cookie', 'scope:master']], func
});
// Protected sharing routes for authenticated user
Route::group(['middleware' => ['auth:api', 'auth.cookie', 'scope:visitor,editor']], function () {
Route::group(['middleware' => ['auth:api', 'auth.shared', 'scope:visitor,editor']], function () {
// Browse folders & files
Route::get('/folders/{unique_id}/private', 'Sharing\FileSharingController@get_private_folders');
@@ -86,7 +86,7 @@ Route::group(['middleware' => ['auth:api', 'auth.cookie', 'scope:visitor,editor'
});
// User master,editor routes
Route::group(['middleware' => ['auth:api', 'auth.cookie', 'scope:master,editor']], function () {
Route::group(['middleware' => ['auth:api', 'auth.shared', 'auth.master', 'scope:master,editor']], function () {
// Edit items
Route::delete('/remove-item/{unique_id}', 'FileFunctions\EditItemsController@user_delete_item');

View File

@@ -17,7 +17,7 @@ Route::get('/avatars/{avatar}', 'FileAccessController@get_avatar')->name('avatar
Route::get('/file/{name}/public/{token}', 'FileAccessController@get_file_public');
// User master,editor,visitor access to image thumbnails and file downloads
Route::group(['middleware' => ['auth:api', 'auth.cookie', 'scope:master,editor,visitor']], function () {
Route::group(['middleware' => ['auth:api', 'auth.shared', 'auth.master', 'scope:master,editor,visitor']], function () {
Route::get('/thumbnail/{name}', 'FileAccessController@get_thumbnail')->name('thumbnail');
Route::get('/file/{name}', 'FileAccessController@get_file')->name('file');
});