mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-07 11:12:14 +00:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
30783d0e5d | ||
|
|
3a296f0f9c | ||
|
|
c0d5a771a5 | ||
|
|
8fc7272e38 | ||
|
|
8b8dc34ba6 | ||
|
|
966145d384 | ||
|
|
2b4060cb7b | ||
|
|
9455a361dc | ||
|
|
190fc651ae | ||
|
|
1c62da4e7c | ||
|
|
ae3be12934 | ||
|
|
c55d3f5350 | ||
|
|
7273d60154 | ||
|
|
587daa5ffe |
@@ -355,6 +355,25 @@ function format_gigabytes($gigabytes)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Format string to formated megabytes string
|
||||
*
|
||||
* @param $megabytes
|
||||
* @return string
|
||||
*/
|
||||
function format_megabytes($megabytes)
|
||||
{
|
||||
if ($megabytes >= 1000) {
|
||||
return $megabytes / 1000 . 'GB';
|
||||
}
|
||||
|
||||
if ($megabytes >= 1000000) {
|
||||
return $megabytes / 1000000 . 'TB';
|
||||
}
|
||||
|
||||
return $megabytes . 'MB';
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert megabytes to bytes
|
||||
*
|
||||
@@ -530,6 +549,12 @@ function get_pretty_name($basename, $name, $mimetype)
|
||||
return $name . '.' . $mimetype;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read exif data from jpeg image file
|
||||
*
|
||||
* @param $file
|
||||
* @return array
|
||||
*/
|
||||
function get_image_meta_data($file)
|
||||
{
|
||||
if(get_file_type_from_mimetype($file->getMimeType()) === 'jpeg') {
|
||||
|
||||
@@ -46,7 +46,7 @@ class StoreUpgradeAccountRequest extends FormRequest
|
||||
'plan.data.attributes.capacity' => 'required|digits_between:1,9',
|
||||
'plan.data.attributes.capacity_formatted' => 'required|string',
|
||||
'plan.data.attributes.currency' => 'required|string',
|
||||
'plan.data.attributes.description' => 'required|string',
|
||||
'plan.data.attributes.description' => 'sometimes|string|nullable',
|
||||
'plan.data.attributes.name' => 'required|string',
|
||||
'plan.data.attributes.price' => 'required|string',
|
||||
'plan.data.id' => 'required|string',
|
||||
|
||||
@@ -251,9 +251,21 @@ class Editor
|
||||
$disk_file_name = basename('chunks/' . $file->getClientOriginalName(), '.part');
|
||||
$temp_filename = $file->getClientOriginalName();
|
||||
|
||||
// Generate file
|
||||
File::append(config('filesystems.disks.local.root') . '/chunks/' . $temp_filename, $file->get());
|
||||
// File Path
|
||||
$file_path = config('filesystems.disks.local.root') . '/chunks/' . $temp_filename;\
|
||||
|
||||
// Generate file
|
||||
File::append($file_path, $file->get());
|
||||
|
||||
// Size of file
|
||||
$file_size = File::size($file_path);
|
||||
|
||||
// Size of limit
|
||||
$limit = get_setting('upload_limit');
|
||||
|
||||
// File size handling
|
||||
if( $limit && $file_size > format_bytes($limit)) abort(413);
|
||||
|
||||
// If last then process file
|
||||
if ($request->boolean('is_last')) {
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
return [
|
||||
|
||||
'version' => '1.7.11',
|
||||
'version' => '1.7.12',
|
||||
|
||||
// Define size of chunk uploaded by MB. E.g. integer 128 means chunk size will be 128MB.
|
||||
'chunk_size' => env('CHUNK_SIZE', '128'),
|
||||
|
||||
2
public/chunks/app-others.js
vendored
2
public/chunks/app-others.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
public/js/main.js
vendored
2
public/js/main.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"/chunks/files~chunks/shared-files~chunks/shared-page~chunks/trash.js": "/chunks/files~chunks/shared-files~chunks/shared-page~chunks/trash.js?id=b2c33d183697d06adb8d",
|
||||
"/js/main.js": "/js/main.js?id=939ce82189c86f19db73",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared-page~chunks/trash.js": "/chunks/files~chunks/shared-files~chunks/shared-page~chunks/trash.js?id=332a46c505c3e4f8a739",
|
||||
"/js/main.js": "/js/main.js?id=768d27992eafd9795e69",
|
||||
"/css/app.css": "/css/app.css?id=dbf49843b327d3936c06",
|
||||
"/chunks/admin.js": "/chunks/admin.js?id=bd7dce5ddfbb8ebeb7a8",
|
||||
"/chunks/admin-account.js": "/chunks/admin-account.js?id=ed4d3b5d0e9da3b70862",
|
||||
@@ -8,7 +8,7 @@
|
||||
"/chunks/app-billings.js": "/chunks/app-billings.js?id=0d1e25be91f67ffab63f",
|
||||
"/chunks/app-email.js": "/chunks/app-email.js?id=b7a3bca09764ae780d6c",
|
||||
"/chunks/app-index.js": "/chunks/app-index.js?id=e1544ff1341ca6416bab",
|
||||
"/chunks/app-others.js": "/chunks/app-others.js?id=aa5b12609a66adf1d918",
|
||||
"/chunks/app-others.js": "/chunks/app-others.js?id=1396078f7c5e8fc929e4",
|
||||
"/chunks/app-payments.js": "/chunks/app-payments.js?id=a1a84878ec6f645946f5",
|
||||
"/chunks/app-settings.js": "/chunks/app-settings.js?id=424c67c7d7f6b9109a99",
|
||||
"/chunks/app-setup.js": "/chunks/app-setup.js?id=3ac1935129bff281257d",
|
||||
|
||||
@@ -22,15 +22,15 @@
|
||||
<div class="icon-item">
|
||||
|
||||
<!--If is file or image, then link item-->
|
||||
<span v-if="isFile" class="file-icon-text">
|
||||
<span v-if="isFile || (isImage && !data.thumbnail)" class="file-icon-text">
|
||||
{{ data.mimetype }}
|
||||
</span>
|
||||
|
||||
<!--Folder thumbnail-->
|
||||
<FontAwesomeIcon v-if="isFile" class="file-icon" icon="file"/>
|
||||
<FontAwesomeIcon v-if="isFile || (isImage && !data.thumbnail)" class="file-icon" icon="file"/>
|
||||
|
||||
<!--Image thumbnail-->
|
||||
<img loading="lazy" v-if="isImage" class="image" :src="data.thumbnail" :alt="data.name"/>
|
||||
<img loading="lazy" v-if="isImage && data.thumbnail" class="image" :src="data.thumbnail" :alt="data.name"/>
|
||||
|
||||
<!--Else show only folder icon-->
|
||||
<FontAwesomeIcon v-if="isFolder" :class="{'is-deleted': isDeleted}" class="folder-icon" icon="folder"/>
|
||||
|
||||
@@ -16,15 +16,15 @@
|
||||
<!--Thumbnail for item-->
|
||||
<div class="icon-item">
|
||||
<!--If is file or image, then link item-->
|
||||
<span v-if="isFile" class="file-icon-text">
|
||||
<span v-if="isFile || (isImage && !data.thumbnail)" class="file-icon-text">
|
||||
{{ data.mimetype | limitCharacters }}
|
||||
</span>
|
||||
|
||||
<!--Folder thumbnail-->
|
||||
<FontAwesomeIcon v-if="isFile" class="file-icon" icon="file" />
|
||||
<FontAwesomeIcon v-if="isFile || (isImage && !data.thumbnail)" class="file-icon" icon="file" />
|
||||
|
||||
<!--Image thumbnail-->
|
||||
<img loading="lazy" v-if="isImage" class="image" :src="data.thumbnail" :alt="data.name" />
|
||||
<img loading="lazy" v-if="isImage && data.thumbnail" class="image" :src="data.thumbnail" :alt="data.name" />
|
||||
|
||||
<!--Else show only folder icon-->
|
||||
<FontAwesomeIcon v-if="isFolder" :class="{ 'is-deleted': isDeleted }" class="folder-icon" icon="folder" />
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div v-if="canBePreview" class="preview">
|
||||
<img v-if="fileInfoDetail.type == 'image'" :src="fileInfoDetail.thumbnail" :alt="fileInfoDetail.name" />
|
||||
<img v-if="fileInfoDetail.type == 'image' && fileInfoDetail.thumbnail" :src="fileInfoDetail.thumbnail" :alt="fileInfoDetail.name" />
|
||||
<audio v-else-if="fileInfoDetail.type == 'audio'" :src="fileInfoDetail.file_url" controlsList="nodownload" controls></audio>
|
||||
<video v-else-if="fileInfoDetail.type == 'video'" controlsList="nodownload" disablePictureInPicture playsinline controls>
|
||||
<source :src="fileInfoDetail.file_url" type="video/mp4">
|
||||
|
||||
27
resources/js/helpers.js
vendored
27
resources/js/helpers.js
vendored
@@ -10,7 +10,7 @@ const Helpers = {
|
||||
|
||||
Vue.prototype.$updateText = debounce(function (route, name, value) {
|
||||
|
||||
let enableEmptyInput = ['mimetypes_blacklist' , 'google_analytics']
|
||||
let enableEmptyInput = ['mimetypes_blacklist' , 'google_analytics' , 'upload_limit']
|
||||
|
||||
if (value === '' && !enableEmptyInput.includes(name)) return
|
||||
|
||||
@@ -148,8 +148,8 @@ const Helpers = {
|
||||
if (error.response.status === 500)
|
||||
isNotGeneralError = false
|
||||
|
||||
//Break if mimetype of file is in blacklist
|
||||
if(error.response.status === 415)
|
||||
//Break if mimetype of file is in blacklist or file size exceed upload limit
|
||||
if(error.response.status === 415 || 413)
|
||||
isNotGeneralError = false
|
||||
|
||||
// Show Error
|
||||
@@ -177,7 +177,7 @@ const Helpers = {
|
||||
|
||||
if (files.length == 0) return
|
||||
|
||||
if (!this.$checkFileMimetype(files)) return
|
||||
if (!this.$checkFileMimetype(files) || !this.$checkUploadLimit(files)) return
|
||||
|
||||
this.$handleUploading(files, undefined)
|
||||
}
|
||||
@@ -301,12 +301,27 @@ const Helpers = {
|
||||
title: i18n.t('popup_mimetypes_blacklist.title'),
|
||||
message: i18n.t('popup_mimetypes_blacklist.message', {mimetype: fileType[1]}),
|
||||
})
|
||||
}else {
|
||||
validated = true
|
||||
}
|
||||
}
|
||||
return validated
|
||||
}
|
||||
Vue.prototype.$checkUploadLimit = function (files) {
|
||||
let uploadLimit = store.getters.config.uploadLimit
|
||||
let validate = true
|
||||
|
||||
for (let i = 0 ; i<files.length; i++ ) {
|
||||
if(uploadLimit != 0 && files[i].size > uploadLimit) {
|
||||
validate = false
|
||||
events.$emit('alert:open', {
|
||||
emoji: '😟😟😟',
|
||||
title: i18n.t('popup_upload_limit.title'),
|
||||
message: i18n.t('popup_upload_limit.message', {uploadLimit: store.getters.config.uploadLimitFormatted}),
|
||||
})
|
||||
break
|
||||
}
|
||||
}
|
||||
return validate
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -208,6 +208,9 @@
|
||||
"username_plac": "输入您的邮件用户名"
|
||||
},
|
||||
"others": {
|
||||
"upload_limit": "Upload Limit",
|
||||
"upload_limit_plac": "Type your upload limit in MB",
|
||||
"upload_limit_help": "If you want to set max file size limit on single upload, add size of your limit in MB. E.g. 100 means 100 MB and 2 000 means 2 000 MB limit.",
|
||||
"mimetypes_blacklist": "Mimetypes Blacklist",
|
||||
"mimetypes_blacklist_plac":"Add mimetypes to Blacklist" ,
|
||||
"mimetypes_blacklist_help" :"If you want to prevent upload some type of files, just add them to blacklist like this: x-php,mp3,jpeg <br/> Use a comma between each mimetype. Don't use a dot before mimetypes." ,
|
||||
@@ -494,8 +497,12 @@
|
||||
},
|
||||
"title": "选择付款方式"
|
||||
},
|
||||
"popup_upload_limit": {
|
||||
"title": "You exceed upload limit on single file",
|
||||
"message": "Size of your uploaded file exceed the upload limit ({uploadLimit})."
|
||||
},
|
||||
"popup_mimetypes_blacklist": {
|
||||
"title": "Oh no",
|
||||
"title": "You are trying to upload unsupported file type",
|
||||
"message": "File of this type ({mimetype}) is not allowed to upload."
|
||||
},
|
||||
"popup_create_folder": {
|
||||
|
||||
@@ -210,6 +210,9 @@
|
||||
"username_plac": "Type your mail username"
|
||||
},
|
||||
"others": {
|
||||
"upload_limit": "Upload Limit",
|
||||
"upload_limit_plac": "Type your upload limit in MB",
|
||||
"upload_limit_help": "If you want to set max file size limit on single upload, add size of your limit in MB. E.g. 100 means 100 MB and 2 000 means 2 000 MB limit.",
|
||||
"mimetypes_blacklist": "Mimetypes Blacklist",
|
||||
"mimetypes_blacklist_plac":"Add mimetypes to Blacklist" ,
|
||||
"mimetypes_blacklist_help" :"If you want to prevent upload some type of files, just add them to blacklist like this: x-php,mp3,jpeg <br/> Use a comma between each mimetype. Don't use a dot before mimetypes." ,
|
||||
@@ -496,8 +499,12 @@
|
||||
},
|
||||
"title": "Choose Payment Method"
|
||||
},
|
||||
"popup_upload_limit": {
|
||||
"title": "You exceed upload limit on single file",
|
||||
"message": "Size of your uploaded file exceed the upload limit ({uploadLimit})."
|
||||
},
|
||||
"popup_mimetypes_blacklist": {
|
||||
"title": "Oh No",
|
||||
"title": "You are trying to upload unsupported file type",
|
||||
"message": "File of this type ({mimetype}) is not allowed to upload."
|
||||
},
|
||||
"popup_create_folder": {
|
||||
|
||||
@@ -210,6 +210,9 @@
|
||||
"username_plac": "Zadajte svoje používateľské meno pre poštu"
|
||||
},
|
||||
"others": {
|
||||
"upload_limit": "Limit nahrávania",
|
||||
"upload_limit_plac": "Pridajte veľkosť limitu v MB",
|
||||
"upload_limit_help": "Ak chcete nastaviť limit pre nahrávane jedneho súboru, pridajte veľkosť vášho limitu v MB.",
|
||||
"mimetypes_blacklist": "Čierna listina mimetypov",
|
||||
"mimetypes_blacklist_plac":"Pridajte mimetypy do Čiernej listiny",
|
||||
"mimetypes_blacklist_help" :"Ak chcete zakázať nahrávanie niektorých typov súborov, jednoducho ich pridajte na čiernu listinu, príklad: x-php, mp3, jpeg <br/> Medzi mimetypmi použite čiarku. Nevkladajte bodku pred mimetyp." ,
|
||||
@@ -496,8 +499,12 @@
|
||||
},
|
||||
"title": "Vyberte si metódu platby"
|
||||
},
|
||||
"popup_upload_limit": {
|
||||
"title": "Je nám to ľúto",
|
||||
"message": "Veľkosť nahravaného súboru prekročila limit pre nahraávane súbory ({uploadLimit})"
|
||||
},
|
||||
"popup_mimetypes_blacklist": {
|
||||
"title": "Ospravelnujume sa",
|
||||
"title": "Ospravedlňujeme sa",
|
||||
"message": "Nieje povolené nahrávať tento typ súboru ({mimetype})."
|
||||
},
|
||||
"popup_create_folder": {
|
||||
|
||||
4
resources/js/store/modules/fileFunctions.js
vendored
4
resources/js/store/modules/fileFunctions.js
vendored
@@ -132,8 +132,8 @@ const actions = {
|
||||
case 413:
|
||||
events.$emit('alert:open', {
|
||||
emoji: '😟😟😟',
|
||||
title: i18n.t('popup_paylod_error.title'),
|
||||
message: i18n.t('popup_paylod_error.message')
|
||||
title: i18n.t('popup_upload_limit.title'),
|
||||
message: i18n.t('popup_upload_limit.message', {uploadLimit: getters.config.uploadLimitFormatted})
|
||||
})
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -89,6 +89,15 @@
|
||||
<small class="input-help" v-html="$t('admin_settings.others.mimetypes_blacklist_help')"></small>
|
||||
</div>
|
||||
|
||||
<div class="block-wrapper">
|
||||
<label>{{ $t('admin_settings.others.upload_limit') }}:</label>
|
||||
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="Upload Limit" v-slot="{ errors }">
|
||||
<input @input="$updateText('/settings', 'upload_limit', app.uploadLimit)" v-model="app.uploadLimit" :placeholder="$t('admin_settings.others.upload_limit_plac')" type="number" min="0" step="1" :class="{'is-error': errors[0]}"/>
|
||||
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
|
||||
</ValidationProvider>
|
||||
<small class="input-help" v-html="$t('admin_settings.others.upload_limit_help')"></small>
|
||||
</div>
|
||||
|
||||
<FormLabel class="mt-70">
|
||||
{{ $t('admin_settings.others.section_cache') }}
|
||||
</FormLabel>
|
||||
@@ -163,7 +172,7 @@
|
||||
mounted() {
|
||||
axios.get('/api/settings', {
|
||||
params: {
|
||||
column: 'contact_email|google_analytics|storage_default|registration|storage_limitation|mimetypes_blacklist'
|
||||
column: 'contact_email|google_analytics|storage_default|registration|storage_limitation|mimetypes_blacklist|upload_limit'
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
@@ -175,7 +184,8 @@
|
||||
defaultStorage: response.data.storage_default,
|
||||
userRegistration: parseInt(response.data.registration),
|
||||
storageLimitation: parseInt(response.data.storage_limitation),
|
||||
mimetypesBlacklist : response.data.mimetypes_blacklist
|
||||
mimetypesBlacklist : response.data.mimetypes_blacklist,
|
||||
uploadLimit: response.data.upload_limit
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -56,6 +56,8 @@
|
||||
storageDefaultSpace: {{ isset($settings->storage_default) ? $settings->storage_default : 5 }},
|
||||
storageDefaultSpaceFormatted: '{{ isset($settings->storage_default) ? format_gigabytes($settings->storage_default) : format_gigabytes(5) }}',
|
||||
mimetypesBlacklist: '{{ isset($settings->mimetypes_blacklist) ? $settings->mimetypes_blacklist: null}}',
|
||||
uploadLimit: {{ isset($settings->upload_limit) ? format_bytes($settings->upload_limit) : 'undefined' }},
|
||||
uploadLimitFormatted: '{{ isset($settings->upload_limit) ? format_megabytes($settings->upload_limit) : null }}',
|
||||
|
||||
hasAuthCookie: {{ Cookie::has('token') ? 1 : 0 }},
|
||||
isSaaS: {{ isset($settings->license) && $settings->license === 'Extended' ? 1 : 0 }},
|
||||
|
||||
Reference in New Issue
Block a user