From e4827b4fe6565554a3a750c633fc5caa790aa753 Mon Sep 17 00:00:00 2001 From: miao <2514145421@qq.com> Date: Mon, 13 Feb 2023 14:13:44 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=B8=BA=E5=A4=9A=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/FileManageDialog.vue | 238 ++++++++++++++-------------- 1 file changed, 121 insertions(+), 117 deletions(-) diff --git a/src/components/FileManageDialog.vue b/src/components/FileManageDialog.vue index 098f259..55e2c08 100644 --- a/src/components/FileManageDialog.vue +++ b/src/components/FileManageDialog.vue @@ -346,6 +346,7 @@ style="height: 69vh; width: 70%" :disable="uploader_loading" :url="getUrl" + multiple method="post" :headers="generatorFileUploadHeaders" :label="$t('select file') + ':'" @@ -687,7 +688,6 @@ export default defineComponent({ loading.value = false; }; - const refresh_file_list_async = async () => { const response = await _request_list_files(path.value); _show_files(response); @@ -912,67 +912,34 @@ export default defineComponent({ resolve_value = null; }, async onCreateNewFolder() { - $q.dialog({ - title: $t.t("create folder"), - message: $t.t("input folder name") + ":", - prompt: { - model: "", - isValid: (val: string) => !!val && val.trim().length > 0, - type: "text", - }, - ok: { - label: $t.t("ok"), - noCaps: true, - flat: true, - }, - cancel: { - label: $t.t("cancel"), - noCaps: true, - flat: true, - }, - persistent: true, - }).onOk(async (data: string) => { - const response = await GlobalData.getInstance() - .getCurrentClient() - ?.CreateDirectoryFileManager(path.value, data); - if (response && response.success) { - refresh_file_list(); - $q.notify({ - type: "positive", - message: $t.t("create folder") + $t.t("success") + "!", - position: "top", - timeout: 1500, - }); - } else { - $q.notify({ - type: "warning", - message: - $t.t("create folder") + - $t.t("fail") + - "!" + - (response ? response.error_message : ""), - position: "top", - timeout: 1500, - }); - } - }); - }, - - selectFile, - async deleteFile(file: FileEntity) { - let response = null; - try { - response = await GlobalData.getInstance() - .getCurrentClient() - ?.DeleteFileManager(path.value, file.name); - } catch (e) { - console.log(e); - } + $q.dialog({ + title: $t.t("create folder"), + message: $t.t("input folder name") + ":", + prompt: { + model: "", + isValid: (val: string) => !!val && val.trim().length > 0, + type: "text", + }, + ok: { + label: $t.t("ok"), + noCaps: true, + flat: true, + }, + cancel: { + label: $t.t("cancel"), + noCaps: true, + flat: true, + }, + persistent: true, + }).onOk(async (data: string) => { + const response = await GlobalData.getInstance() + .getCurrentClient() + ?.CreateDirectoryFileManager(path.value, data); if (response && response.success) { refresh_file_list(); $q.notify({ type: "positive", - message: $t.t("delete file") + $t.t("success") + "!", + message: $t.t("create folder") + $t.t("success") + "!", position: "top", timeout: 1500, }); @@ -980,7 +947,7 @@ export default defineComponent({ $q.notify({ type: "warning", message: - $t.t("delete file") + + $t.t("create folder") + $t.t("fail") + "!" + (response ? response.error_message : ""), @@ -988,55 +955,88 @@ export default defineComponent({ timeout: 1500, }); } + }); + }, + + selectFile, + async deleteFile(file: FileEntity) { + let response = null; + try { + response = await GlobalData.getInstance() + .getCurrentClient() + ?.DeleteFileManager(path.value, file.name); + } catch (e) { + console.log(e); + } + if (response && response.success) { + refresh_file_list(); + $q.notify({ + type: "positive", + message: $t.t("delete file") + $t.t("success") + "!", + position: "top", + timeout: 1500, + }); + } else { + $q.notify({ + type: "warning", + message: + $t.t("delete file") + + $t.t("fail") + + "!" + + (response ? response.error_message : ""), + position: "top", + timeout: 1500, + }); + } }, renameFile(file: FileEntity) { - $q.dialog({ - title: $t.t("rename"), - message: $t.t("input new file name") + ":", - prompt: { - model: file.name, - isValid: (val: string) => !!val && val.trim().length > 0, - type: "text", - }, - ok: { - label: $t.t("ok"), - noCaps: true, - flat: true, - }, - cancel: { - label: $t.t("cancel"), - noCaps: true, - flat: true, - }, - persistent: true, - }).onOk(async (data: string) => { - if (data == file.name) { - return; - } - let response = await GlobalData.getInstance() - .getCurrentClient() - ?.RenameFileManager(path.value, file.name, data); - if (response && response.success) { - refresh_file_list(); - $q.notify({ - type: "positive", - message: $t.t("file rename") + $t.t("success") + "!", - position: "top", - timeout: 1500, - }); - } else { - $q.notify({ - type: "warning", - message: - $t.t("file rename") + - $t.t("fail") + - "!" + - (response ? response.error_message : ""), - position: "top", - timeout: 1500, - }); - } - }); + $q.dialog({ + title: $t.t("rename"), + message: $t.t("input new file name") + ":", + prompt: { + model: file.name, + isValid: (val: string) => !!val && val.trim().length > 0, + type: "text", + }, + ok: { + label: $t.t("ok"), + noCaps: true, + flat: true, + }, + cancel: { + label: $t.t("cancel"), + noCaps: true, + flat: true, + }, + persistent: true, + }).onOk(async (data: string) => { + if (data == file.name) { + return; + } + let response = await GlobalData.getInstance() + .getCurrentClient() + ?.RenameFileManager(path.value, file.name, data); + if (response && response.success) { + refresh_file_list(); + $q.notify({ + type: "positive", + message: $t.t("file rename") + $t.t("success") + "!", + position: "top", + timeout: 1500, + }); + } else { + $q.notify({ + type: "warning", + message: + $t.t("file rename") + + $t.t("fail") + + "!" + + (response ? response.error_message : ""), + position: "top", + timeout: 1500, + }); + } + }); }, copyStringToClipboard(value: string) { copyToClipboard(value); @@ -1148,7 +1148,7 @@ export default defineComponent({ } }, 1); }, - onUploaded() { + onUploaded(info: any) { uploading.value = false; uploader.value.reset(); refresh_file_list(); @@ -1161,16 +1161,20 @@ export default defineComponent({ }); loading.value = false; }, - onFailed(info: any) { - console.log(info); - $q.notify({ - type: "warning", - message: $t.t("file upload") + $t.t("fail") + "!", - position: "top", - timeout: 1500, - }); - loading.value = false; - loading.value = false; + async onFailed(info: any) { + let file_list: any = await _request_list_files(path.value); + setTimeout(() => { + if (files.value.length != file_list.files.length) { + $q.notify({ + type: "warning", + message: $t.t("file upload") + $t.t("fail") + "!", + position: "top", + timeout: 1500, + }); + loading.value = false; + } + }, 500); + }, copyFile(file: FileEntity) { if (file) { From 5a1dba7a8f956c5db37b4614e1c2d419a5a2aa17 Mon Sep 17 00:00:00 2001 From: miao <2514145421@qq.com> Date: Tue, 14 Feb 2023 08:50:40 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E6=A3=80=E6=9F=A5=E7=B4=A2=E5=BC=95?= =?UTF-8?q?=E7=9A=84http=E8=AF=B7=E6=B1=82=E6=94=B9=E4=B8=BAwebsocket?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 2 +- src/common/ClientConnection.ts | 9 + src/components/ModeDialog.vue | 1078 ++++++++++++++++---------------- src/entities/WSProtocol.ts | 21 + 4 files changed, 572 insertions(+), 538 deletions(-) diff --git a/src/App.vue b/src/App.vue index 306807f..e97b399 100644 --- a/src/App.vue +++ b/src/App.vue @@ -117,7 +117,7 @@ export default defineComponent({ console.log(e); } - EventBus.getInstance().on(EventNamesDefine.CheckDebug, () => { + EventBus.getInstance().on(EventNamesDefine.CheckDebug2, () => { const to_normal_url = () => { const p1 = window.location.href.indexOf("?debug"); const p2 = window.location.href.indexOf("#"); diff --git a/src/common/ClientConnection.ts b/src/common/ClientConnection.ts index 97e1df6..b9a3f6a 100644 --- a/src/common/ClientConnection.ts +++ b/src/common/ClientConnection.ts @@ -1519,6 +1519,15 @@ export default class ClientConnection { console.error(e); } } + public async CheckModeIndex(mode_index:number) { + try { + return await this.doRpc( + new Protocol.RpcCheckModeIndexRequestEntity(mode_index) + ); + } catch (e) { + console.error(e); + } + } } export interface NotifyMessage { diff --git a/src/components/ModeDialog.vue b/src/components/ModeDialog.vue index d218726..be459a0 100644 --- a/src/components/ModeDialog.vue +++ b/src/components/ModeDialog.vue @@ -1,537 +1,541 @@ - - - - - + + + + + diff --git a/src/entities/WSProtocol.ts b/src/entities/WSProtocol.ts index 5922bce..54f1711 100644 --- a/src/entities/WSProtocol.ts +++ b/src/entities/WSProtocol.ts @@ -534,6 +534,9 @@ export namespace Protocol { public static get kRpcFileManagerCreateDirectory() { return Commands.PROTOCOL_PREFIX + "RpcFileManagerCreateDirectory"; } + public static get kRpcCheckModeIndex() { + return Commands.PROTOCOL_PREFIX + "RpcCheckModeIndex"; + } static _all_commands = new Set([ Commands.kUnKnowCommand, Commands.kSearchDevice, @@ -668,6 +671,7 @@ export namespace Protocol { Commands.kRpcFileManagerRename, Commands.kRpcFileManagerDelete, Commands.kRpcFileManagerCreateDirectory, + Commands.kRpcCheckModeIndex, ]); public static get AllCommands() { return this._all_commands; @@ -3541,4 +3545,21 @@ export namespace Protocol { error_message="" error_code=0; } + export class RpcCheckModeIndexRequestEntity extends PacketEntity{ + constructor(mode_index:number,rpc_id = 0) { + super(); + super.command = Commands.kRpcCheckModeIndex; + super.flag = PacketEntity.FLAG_REQUEST; + this.mode_index=mode_index + } + mode_index = 0; + } + export class RpcCheckModeIndexResponseEntity extends PacketEntity{ + constructor() { + super(); + super.flag = PacketEntity.FLAG_RESPONSE; + } + success = false; + + } } From a2102bdb5e70e82986f6697d77c45a4d6bc8da96 Mon Sep 17 00:00:00 2001 From: fangxiang Date: Tue, 14 Feb 2023 17:40:59 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E9=80=82=E9=85=8D=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E7=9A=84=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/FileManageDialog.vue | 128 +++------------------------- 1 file changed, 13 insertions(+), 115 deletions(-) diff --git a/src/components/FileManageDialog.vue b/src/components/FileManageDialog.vue index 55e2c08..dfd70ab 100644 --- a/src/components/FileManageDialog.vue +++ b/src/components/FileManageDialog.vue @@ -347,14 +347,11 @@ :disable="uploader_loading" :url="getUrl" multiple - method="post" - :headers="generatorFileUploadHeaders" + method="POST" :label="$t('select file') + ':'" :accept="uploader_accept" @start="onStartUpload" - @uploaded="onUploaded" - @failed="onFailed" - @added="/*onFileAdded*/ null" + @finish="onFailed" > @@ -882,21 +879,6 @@ export default defineComponent({ resolve = _resolve; }); }, - generatorFileUploadHeaders(files: File[]) { - if (files.length > 0) { - return [ - { - name: HttpProtocol.kHeaderXProductName, - value: HttpProtocol.getProductName($store), - }, - { - name: HttpProtocol.kHeaderXFileLength, - value: files[0].size, - }, - ]; - } - return []; - }, resetData() { loading.value = false; uploading.value = false; @@ -1068,8 +1050,8 @@ export default defineComponent({ getUrl(file: File[]) { let url = GlobalData.getInstance().createCurrentRequestUrl(); if (url) { - url.pathname = HttpProtocol.RequestUploadFile; - url.searchParams.append("type", HttpProtocol.HttpUploadTypeNormal); + url.pathname = "/upload_media_file"; //HttpProtocol.RequestUploadFile; + // url.searchParams.append("type", HttpProtocol.HttpUploadTypeNormal); url.searchParams.append("base_dir", path.value); return url.toString(); } @@ -1078,103 +1060,19 @@ export default defineComponent({ onStartUpload() { loading.value = true; }, - async onFileAdded(files: File[] | File) { - setTimeout(async () => { - const onError = async (file: File | null) => { - await nextTick(() => {}); - uploader.value.reset(); - - $q.notify({ - color: "negative", - icon: "warning", - message: $t.t("load file error") + "!", - position: "top", - timeout: 3000, - }); - }; - - let file: File | null = null; - - try { - if (Array.isArray(files)) { - if (files.length > 0) { - file = files[0]; - } - } else { - file = files; - } - if (file) { - const file_name = file.name; - const blob = file.slice(0, 1024 * 1024 * 1); // 1 MB - uploader_loading.value = true; - - try { - let url = GlobalData.getInstance().createCurrentRequestUrl(); - if (url) { - url.pathname = HttpProtocol.RequestPathCheckFileSupport; - - // if (FileSuffixHelper.isVideoPath(file_name)) { - - // } - const data = new FormData(); - data.append( - "file", - new File([blob], file_name, { - lastModified: file.lastModified, - }) - ); - const response = await api.post(url.toString(), data, { - headers: { - "Content-Type": "multipart/form-data", - }, - }); - if (response && response.data && response.data.is_support) { - } else { - onError(file); - } - } else { - throw ""; - } - } catch (e) { - console.error(e); - onError(file); - } - uploader_loading.value = false; - return; - } - } catch (e) { - console.error(e); - onError(file); - } - }, 1); - }, - onUploaded(info: any) { - uploading.value = false; - uploader.value.reset(); - refresh_file_list(); - - $q.notify({ - type: "positive", - message: $t.t("file upload") + $t.t("success") + "!", - position: "top", - timeout: 1500, - }); - loading.value = false; - }, async onFailed(info: any) { let file_list: any = await _request_list_files(path.value); setTimeout(() => { if (files.value.length != file_list.files.length) { - $q.notify({ - type: "warning", - message: $t.t("file upload") + $t.t("fail") + "!", - position: "top", - timeout: 1500, - }); - loading.value = false; - } - }, 500); - + $q.notify({ + type: "warning", + message: $t.t("file upload") + $t.t("fail") + "!", + position: "top", + timeout: 1500, + }); + loading.value = false; + } + }, 500); }, copyFile(file: FileEntity) { if (file) { From 71abf1bba21ddeff50b957f6bfe886ed3c165aae Mon Sep 17 00:00:00 2001 From: fangxiang Date: Tue, 14 Feb 2023 19:32:51 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BA=E6=9C=80?= =?UTF-8?q?=E6=96=B0=E7=9A=84=E6=95=B0=E6=8D=AE=E5=BA=93=E5=A4=87=E4=BB=BD?= =?UTF-8?q?=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entities/HttpProtocol.ts | 66 ++++++++++++++++++------------------ src/pages/TopToolBar.vue | 26 +++++++------- 2 files changed, 47 insertions(+), 45 deletions(-) diff --git a/src/entities/HttpProtocol.ts b/src/entities/HttpProtocol.ts index 9956eff..cf743e7 100644 --- a/src/entities/HttpProtocol.ts +++ b/src/entities/HttpProtocol.ts @@ -1,33 +1,33 @@ -export namespace HttpProtocol { - export const DefaultHttpPort = 80; - export const RequestUploadFile = "/upload_file"; - export const RequestPathUpdateDBBackupFile = "/common/update_db_backup_file"; - export const RequestPathDBBackup = "/db_backup"; - export const RequestPathListFile = "/list_file"; - export const RequestPathCreateDirectory = "/create_directory"; - export const RequestPathCheckFileSupport = "/check_file_support"; - export const RequestPathGetWebscoketPort = "/get_websocket_port"; - export const RequestPathGetAllPort = "/get_all_port"; - export const RequestPathDeleteFile = "/delete_file"; - export const RequestPathRenameFile = "/rename_file"; - export const RequestCheckModeIndex = "/check_mode_index"; - - export const HttpUploadTypeNormal = "U_T_Normal"; - export const UploadTypeBackgroundImage = "U_T_BACKGROUND_IMAGE"; - export const UploadTypeMedia = "U_T_MEDIA"; - export const UploadTypeDatabase = "U_T_DATABASE"; - export const UploadTypeRootFS = "U_T_ROOT_FS"; - export const UploadTypeSoftware = "U_T_SOFTWARE"; - - export const kHeaderXFileLength = "X-File-Length"; - export const kHeaderXFileMD5 = "X-File-MD5"; - export const kHeaderXProductName = "X-Product-Name"; - const kHeaderDefaultValueXProductName = "LED_PLAYER"; - - export const getProductName = ($store: any): String => { - if ($store && $store.state && $store.state.product_name) { - return $store.state.product_name; - } - return kHeaderDefaultValueXProductName; - }; -} +export namespace HttpProtocol { + export const DefaultHttpPort = 80; + export const RequestUploadFile = "/upload_file"; + export const RequestPathUpdateDBBackupFile = "/update_db_backup_file"; + export const RequestPathDBBackup = "/download_db_backup_file"; + export const RequestPathListFile = "/list_file"; + export const RequestPathCreateDirectory = "/create_directory"; + export const RequestPathCheckFileSupport = "/check_file_support"; + export const RequestPathGetWebscoketPort = "/get_websocket_port"; + export const RequestPathGetAllPort = "/get_all_port"; + export const RequestPathDeleteFile = "/delete_file"; + export const RequestPathRenameFile = "/rename_file"; + export const RequestCheckModeIndex = "/check_mode_index"; + + export const HttpUploadTypeNormal = "U_T_Normal"; + export const UploadTypeBackgroundImage = "U_T_BACKGROUND_IMAGE"; + export const UploadTypeMedia = "U_T_MEDIA"; + export const UploadTypeDatabase = "U_T_DATABASE"; + export const UploadTypeRootFS = "U_T_ROOT_FS"; + export const UploadTypeSoftware = "U_T_SOFTWARE"; + + export const kHeaderXFileLength = "X-File-Length"; + export const kHeaderXFileMD5 = "X-File-MD5"; + export const kHeaderXProductName = "X-Product-Name"; + const kHeaderDefaultValueXProductName = "LED_PLAYER"; + + export const getProductName = ($store: any): String => { + if ($store && $store.state && $store.state.product_name) { + return $store.state.product_name; + } + return kHeaderDefaultValueXProductName; + }; +} diff --git a/src/pages/TopToolBar.vue b/src/pages/TopToolBar.vue index b5b625c..100000c 100644 --- a/src/pages/TopToolBar.vue +++ b/src/pages/TopToolBar.vue @@ -305,7 +305,10 @@ @@ -457,7 +457,6 @@ - @@ -711,9 +710,9 @@ export default defineComponent({ show_device_list.value = typeof (window).user_search?.hide_device_list == "undefined"; }); - let isfan=ref(true) + let isfan = ref(true); if ((window as any).$wujie) { - isfan.value=false + isfan.value = false; } return { show_advanced_menu, @@ -738,8 +737,11 @@ export default defineComponent({ console.log(url.toString()); let response = await api.get(url.toString()); if (response.status == 200 && response && response.data) { - url.pathname = - HttpProtocol.RequestPathDBBackup + "/" + response.data; + console.log(response.data); + + url.pathname = HttpProtocol.RequestPathDBBackup; + url.searchParams.append("name", response.data); + console.log(url); openURL(url.toString()); } else { $q.notify({ @@ -992,7 +994,7 @@ export default defineComponent({ isfull.value = !isfull.value; if ((window as any).$wujie) { const $wujie = (window as any).$wujie as IWuJieInterface; - $wujie?.bus.$emit("isfull", isfull.value); + $wujie?.bus.$emit("isfull", isfull.value); } }, }; From e68eb4c8d6c7b487a27263f9a10735da9d4dd753 Mon Sep 17 00:00:00 2001 From: miao <2514145421@qq.com> Date: Wed, 15 Feb 2023 11:36:19 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E5=B0=86=E6=95=B0=E6=8D=AE=E6=81=A2?= =?UTF-8?q?=E5=A4=8D=EF=BC=8C=E5=BA=95=E5=9B=BE=E4=B8=8A=E4=BC=A0=EF=BC=8C?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E5=BA=95=E5=9B=BE=EF=BC=8C=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E7=9A=84http=E8=BD=AC=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/BackgroundImageDialog.vue | 482 ++++++++++------------ src/components/FileManageDialog.vue | 5 +- src/components/RecoveryDatabaseDialog.vue | 472 ++++++++++----------- src/components/UpgradeDialog.vue | 49 +-- src/i18n/en-US/index.ts | 1 + src/i18n/zh-CN/index.ts | 1 + 6 files changed, 463 insertions(+), 547 deletions(-) diff --git a/src/components/BackgroundImageDialog.vue b/src/components/BackgroundImageDialog.vue index 6b6df9c..46d69be 100644 --- a/src/components/BackgroundImageDialog.vue +++ b/src/components/BackgroundImageDialog.vue @@ -1,256 +1,226 @@ - - - - - + + + + + diff --git a/src/components/FileManageDialog.vue b/src/components/FileManageDialog.vue index dfd70ab..e15935b 100644 --- a/src/components/FileManageDialog.vue +++ b/src/components/FileManageDialog.vue @@ -1065,12 +1065,13 @@ export default defineComponent({ setTimeout(() => { if (files.value.length != file_list.files.length) { $q.notify({ - type: "warning", - message: $t.t("file upload") + $t.t("fail") + "!", + type: "positive", + message: $t.t("file upload") + $t.t("finish") + "!", position: "top", timeout: 1500, }); loading.value = false; + uploading.value=false; } }, 500); }, diff --git a/src/components/RecoveryDatabaseDialog.vue b/src/components/RecoveryDatabaseDialog.vue index a6dd0b4..26dbe07 100644 --- a/src/components/RecoveryDatabaseDialog.vue +++ b/src/components/RecoveryDatabaseDialog.vue @@ -1,247 +1,225 @@ - - - - - + + + + + diff --git a/src/components/UpgradeDialog.vue b/src/components/UpgradeDialog.vue index d287d7c..74a1e50 100644 --- a/src/components/UpgradeDialog.vue +++ b/src/components/UpgradeDialog.vue @@ -61,7 +61,6 @@ ref="uploader_software" :url="upload_url_software" method="post" - :headers="generatorFileUploadHeaders" :label="$t('select software upgrade file') + ':'" accept=".zip,.tar,.tar.gz" :hide-upload-btn="true" @@ -76,7 +75,6 @@ ref="uploader_rootfs" :url="upload_url_rootfs" method="post" - :headers="generatorFileUploadHeaders" :label="$t('select rootfs upgrade file') + ':'" accept=".img" :hide-upload-btn="true" @@ -85,6 +83,7 @@ @added="(files) => files && (file_count += files.length)" @removed="(files) => files && (file_count -= files.length)" /> + @@ -92,9 +91,7 @@ - - V: {{ server_version }} - + 0) { - return [ - { - name: HttpProtocol.kHeaderXProductName, - value: HttpProtocol.getProductName($store), - }, - { - name: HttpProtocol.kHeaderXFileLength, - value: files[0].size, - }, - ]; - } - return []; - }, loga(a: any) { console.log(a); }, showDialog() { show_dialog.value = true; - let client = GlobalData.getInstance().getCurrentClient(); - if (client) { - let url = new URL(client.url); - url.port = - GlobalData.getInstance().applicationConfig?.httpserver_port ?? - HttpProtocol.DefaultHttpPort.toString(); - url.pathname = HttpProtocol.RequestUploadFile; - url.protocol = "http:"; - url.searchParams.append("type", HttpProtocol.UploadTypeRootFS); - upload_url_rootfs.value = url.toString(); - - url.searchParams.set("type", HttpProtocol.UploadTypeSoftware); + let url = GlobalData.getInstance().createCurrentRequestUrl(); + if (url) { + url.pathname = "/upload_soft_file"; upload_url_software.value = url.toString(); - try { - client?.getBuildInfo()?.then((build_info) => { - if (build_info) { - server_version.value = build_info.version; - } - }); - // console.log(build_info); - } catch {} + url.pathname = "/upload_root_fs_file"; + upload_url_rootfs.value = url.toString(); } }, resetData() { diff --git a/src/i18n/en-US/index.ts b/src/i18n/en-US/index.ts index 2914a8b..f087ade 100644 --- a/src/i18n/en-US/index.ts +++ b/src/i18n/en-US/index.ts @@ -294,6 +294,7 @@ export default { "open left tool bar": "Open Left Tool Bar", "open right tool bar": "Open Right Tool Bar", fail: " Fail", + finish:"Finish", "edit group": "Edit Group", "open window": "Open Window", "close all windows": "Close All Windows", diff --git a/src/i18n/zh-CN/index.ts b/src/i18n/zh-CN/index.ts index 6c3a6a4..1de7aa9 100644 --- a/src/i18n/zh-CN/index.ts +++ b/src/i18n/zh-CN/index.ts @@ -5,6 +5,7 @@ export default { " ": "", title: "MediaPlayerWebApp", failed: "失败", + finish:"完成", fail: "失败", error: "错误", Confirm: "确认", From fc6b23432cf0bf977885d8a4044c65a44dc6792e Mon Sep 17 00:00:00 2001 From: miao <2514145421@qq.com> Date: Wed, 15 Feb 2023 16:30:42 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=B9=E6=97=B6=E6=B7=BB=E5=8A=A0=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/FileManageDialog.vue | 44 +++++++++++++++++++++-------- src/i18n/en-US/index.ts | 2 ++ src/i18n/zh-CN/index.ts | 1 + 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/src/components/FileManageDialog.vue b/src/components/FileManageDialog.vue index e15935b..22d4d9e 100644 --- a/src/components/FileManageDialog.vue +++ b/src/components/FileManageDialog.vue @@ -899,7 +899,8 @@ export default defineComponent({ message: $t.t("input folder name") + ":", prompt: { model: "", - isValid: (val: string) => !!val && val.trim().length > 0, + isValid: (val: string) => + !!val && val.trim().length > 0&& val.indexOf(".") != 0 , type: "text", }, ok: { @@ -917,6 +918,7 @@ export default defineComponent({ const response = await GlobalData.getInstance() .getCurrentClient() ?.CreateDirectoryFileManager(path.value, data); + console.log(response); if (response && response.success) { refresh_file_list(); $q.notify({ @@ -926,16 +928,34 @@ export default defineComponent({ timeout: 1500, }); } else { - $q.notify({ - type: "warning", - message: - $t.t("create folder") + - $t.t("fail") + - "!" + - (response ? response.error_message : ""), - position: "top", - timeout: 1500, - }); + // if ( + // response?.error_message == + // "the folder name cannot start with a '.'" + // ) { + // $q.notify({ + // type: "warning", + // message: + // $t.t("create folder") + + // $t.t("fail") + + // "!" + + // $t.t("the folder name cannot start with a '.'"), + // position: "top", + // timeout: 1500, + // }); + // } + // else { + if (response) { + $q.notify({ + type: "warning", + message: + $t.t("create folder") + + $t.t("fail") + + "! " + + $t.t(response.error_message), + position: "top", + timeout: 1500, + }); + } } }); }, @@ -1071,7 +1091,7 @@ export default defineComponent({ timeout: 1500, }); loading.value = false; - uploading.value=false; + uploading.value = false; } }, 500); }, diff --git a/src/i18n/en-US/index.ts b/src/i18n/en-US/index.ts index f087ade..fcb4bb0 100644 --- a/src/i18n/en-US/index.ts +++ b/src/i18n/en-US/index.ts @@ -445,4 +445,6 @@ export default { resize: "Resize", "export magic": "Export", "raster graph": "Raster Graph", + "the folder name cannot start with a '.'":"The Folder Name Cannot Start With a '.'", + }; diff --git a/src/i18n/zh-CN/index.ts b/src/i18n/zh-CN/index.ts index 1de7aa9..d39045e 100644 --- a/src/i18n/zh-CN/index.ts +++ b/src/i18n/zh-CN/index.ts @@ -713,4 +713,5 @@ export default { resize: "缩放", "export magic": "导出", "raster graph": "栅格图", + "the folder name cannot start with a '.'":"文件夹名称不能以“.” 开头", }; From b2bd16128a4332d9e51ea5048dc4fa31849cb749 Mon Sep 17 00:00:00 2001 From: miao <2514145421@qq.com> Date: Wed, 15 Feb 2023 17:48:53 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=B9=8B=E5=90=8E=E7=9A=84=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/FileManageDialog.vue | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/components/FileManageDialog.vue b/src/components/FileManageDialog.vue index 22d4d9e..6c4d647 100644 --- a/src/components/FileManageDialog.vue +++ b/src/components/FileManageDialog.vue @@ -351,7 +351,7 @@ :label="$t('select file') + ':'" :accept="uploader_accept" @start="onStartUpload" - @finish="onFailed" + @finish="onfinish" > @@ -1080,10 +1080,8 @@ export default defineComponent({ onStartUpload() { loading.value = true; }, - async onFailed(info: any) { - let file_list: any = await _request_list_files(path.value); + async onfinish(info: any) { setTimeout(() => { - if (files.value.length != file_list.files.length) { $q.notify({ type: "positive", message: $t.t("file upload") + $t.t("finish") + "!", @@ -1092,7 +1090,6 @@ export default defineComponent({ }); loading.value = false; uploading.value = false; - } }, 500); }, copyFile(file: FileEntity) {