feat: 增加回收站文件夹限制 (#4479)

This commit is contained in:
zhengkunwang 2024-04-11 19:06:10 +08:00 committed by GitHub
parent 2eae8274f6
commit 38b0c42555
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 28 additions and 4 deletions

View file

@ -1144,6 +1144,9 @@ const message = {
ignoreCertificateHelper:
'Ignoring untrusted certificates during downloads may lead to data leakage or tampering. Please use this option with caution, only when trusting the download source.',
uploadOverLimit: 'The number of files exceeds 1000! Please compress and upload',
clashDitNotSuppport: 'File names are prohibited from containing .1panel_clash',
clashDeleteAlert: 'The Recycle Bin folder cannot be deleted',
clashOpenAlert: 'Please click the [Recycle Bin] button to open the recycle bin directory',
},
ssh: {
autoStart: 'Auto Start',

View file

@ -1088,6 +1088,9 @@ const message = {
ignoreCertificateHelper:
'下載時忽略不可信證書可能導致數據洩露或篡改請謹慎使用此選項僅在信任下載源的情況下啟用',
uploadOverLimit: '文件數量超過 1000 請壓縮後上傳',
clashDitNotSuppport: '檔名禁止包含 .1panel_clash',
clashDleteAlert: '回收站資料夾不能刪除',
clashOpenAlert: '回收站目錄請點選回收站按鈕開啟',
},
ssh: {
autoStart: '開機自啟',

View file

@ -1089,6 +1089,9 @@ const message = {
ignoreCertificateHelper:
'下载时忽略不可信证书可能导致数据泄露或篡改请谨慎使用此选项仅在信任下载源的情况下启用',
uploadOverLimit: '文件数量超过 1000请压缩后上传',
clashDitNotSuppport: '文件名禁止包含 .1panel_clash',
clashDleteAlert: '回收站文件夹不能删除',
clashOpenAlert: '回收站目录请点击回收站按钮打开',
},
ssh: {
autoStart: '开机自启',

View file

@ -180,7 +180,7 @@ const initEditor = () => {
folding: true,
roundedSelection: false,
overviewRulerBorder: false,
wordWrap: 'on',
wordWrap: config.wordWrap,
});
editor.onDidChangeModelContent(() => {
if (editor) {

View file

@ -67,7 +67,7 @@ import i18n from '@/lang';
import FileRole from '@/components/file-role/index.vue';
import { Rules } from '@/global/form-rules';
import FileList from '@/components/file-list/index.vue';
import { MsgSuccess } from '@/utils/message';
import { MsgSuccess, MsgWarning } from '@/utils/message';
const fileForm = ref<FormInstance>();
let loading = ref(false);
@ -120,6 +120,10 @@ const submit = async (formEl: FormInstance | undefined) => {
if (!valid) {
return;
}
if (getPath.value.indexOf('.1panel_clash') > -1) {
MsgWarning(i18n.global.t('file.clashDitNotSuppport'));
return;
}
let addItem = {};
Object.assign(addItem, addForm);

View file

@ -56,7 +56,7 @@ import { ref } from 'vue';
import { File } from '@/api/interface/file';
import { getIcon } from '@/utils/util';
import { DeleteFile, GetRecycleStatus } from '@/api/modules/files';
import { MsgSuccess } from '@/utils/message';
import { MsgSuccess, MsgWarning } from '@/utils/message';
const open = ref(false);
const files = ref();
@ -85,6 +85,10 @@ const getStatus = async () => {
const onConfirm = () => {
const pros = [];
for (const s of files.value) {
if (s['path'].indexOf('.1panel_clash') > -1) {
MsgWarning(i18n.global.t('file.clashDleteAlert'));
return;
}
pros.push(DeleteFile({ path: s['path'], isDir: s['isDir'], forceDelete: forceDelete.value }));
}
loading.value = true;

View file

@ -447,6 +447,10 @@ const handleSearchResult = (res: ResultData<File.File>) => {
const open = async (row: File.File) => {
if (row.isDir) {
if (row.name == '.1panel_clash') {
MsgWarning(i18n.global.t('file.clashOpenAlert'));
return;
}
const name = row.name;
if (req.path.endsWith('/')) {
req.path = req.path + name;
@ -830,6 +834,9 @@ const buttons = [
},
{
label: i18n.global.t('commons.button.delete'),
disabled: (row: File.File) => {
return row.name == '.1panel_clash';
},
click: delFile,
},
{

View file

@ -57,7 +57,7 @@
</el-form-item>
<el-form-item label="API Token" prop="authorization.apiKey">
<el-input v-model.trim="account.authorization['apiKey']"></el-input>
<span class="input-help">
<span class="input-help text-red-500">
{{ $t('ssl.cfHelper') }}
</span>
</el-form-item>