mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-05-04 05:05:58 +00:00
v0.1 exif Blacklist add frontend validation
This commit is contained in:
Vendored
+25
@@ -1,3 +1,4 @@
|
||||
import i18n from '@/i18n/index'
|
||||
import store from './store/index'
|
||||
import {debounce, includes} from "lodash";
|
||||
import {events} from './bus'
|
||||
@@ -174,6 +175,8 @@ const Helpers = {
|
||||
|
||||
if (files.length == 0) return
|
||||
|
||||
if (!this.$checkFileMimetype(files)) return
|
||||
|
||||
this.$handleUploading(files, undefined)
|
||||
}
|
||||
|
||||
@@ -277,6 +280,28 @@ const Helpers = {
|
||||
message: this.$t('popup_error.message'),
|
||||
})
|
||||
}
|
||||
Vue.prototype.$checkFileMimetype = function(files) {
|
||||
let validated = true
|
||||
let mimetypesBlacklist = store.getters.config.mimetypesBlacklist
|
||||
console.log(files[0])
|
||||
|
||||
for (let i = 0 ; i<files.length; i++ ) {
|
||||
let fileType = files[i].type.split("/")
|
||||
|
||||
if(mimetypesBlacklist.includes(fileType[1])) {
|
||||
validated = false
|
||||
|
||||
events.$emit('alert:open', {
|
||||
emoji: '😬',
|
||||
title: i18n.t('popup_mimetypes_blacklist.title'),
|
||||
message: i18n.t('popup_mimetypes_blacklist.message') + '(' + fileType[1] + ')' ,
|
||||
})
|
||||
}else {
|
||||
validated = true
|
||||
}
|
||||
}
|
||||
return validated
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
storageLimit: {{ isset($settings->storage_limitation) ? $settings->storage_limitation : 1 }},
|
||||
storageDefaultSpace: {{ isset($settings->storage_default) ? $settings->storage_default : 5 }},
|
||||
storageDefaultSpaceFormatted: '{{ isset($settings->storage_default) ? format_gigabytes($settings->storage_default) : format_gigabytes(5) }}',
|
||||
mimetypesBlacklist: '{{$settings->mimetypes_blacklist}}',
|
||||
|
||||
hasAuthCookie: {{ Cookie::has('token') ? 1 : 0 }},
|
||||
isSaaS: {{ isset($settings->license) && $settings->license === 'Extended' ? 1 : 0 }},
|
||||
|
||||
Reference in New Issue
Block a user