From 7d2f3868aa56e827725db2285886bb79eca0fb0c Mon Sep 17 00:00:00 2001 From: kerms Date: Tue, 2 Apr 2024 10:06:20 +0800 Subject: [PATCH] move logs to dev mode only, change navbar connection icon --- env.d.ts | 4 +--- src/App.vue | 3 +-- src/assets/icon/link-off.svg | 1 + src/assets/icon/link.svg | 1 + src/composables/websocket/websocketWrapper.ts | 5 +++-- src/router/msgRouter.ts | 9 +++++++-- src/views/About.vue | 4 ++-- src/views/Wifi.vue | 1 - src/views/navigation/NavBar.vue | 4 ++-- vite.config.ts | 4 +--- 10 files changed, 19 insertions(+), 17 deletions(-) create mode 100644 src/assets/icon/link-off.svg create mode 100644 src/assets/icon/link.svg diff --git a/env.d.ts b/env.d.ts index 0fdf4a4..151aa68 100644 --- a/env.d.ts +++ b/env.d.ts @@ -1,3 +1 @@ -/// -declare const __APP_VERSION__: string; // defined in vite.config.ts, imported from package.json.version -declare const __BUILD_TIME__: string; \ No newline at end of file +/// \ No newline at end of file diff --git a/src/App.vue b/src/App.vue index 5044a79..6a01979 100644 --- a/src/App.vue +++ b/src/App.vue @@ -38,10 +38,9 @@ let websocketService: IWebsocketService; onMounted(() => { logHelloMessage(); - let host = ""; if (isDevMode()) { - host = "192.168.43.61"; + host = import.meta.env.VITE_DEVICE_HOST_NAME; } else { host = window.location.host } diff --git a/src/assets/icon/link-off.svg b/src/assets/icon/link-off.svg new file mode 100644 index 0000000..063b07c --- /dev/null +++ b/src/assets/icon/link-off.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icon/link.svg b/src/assets/icon/link.svg new file mode 100644 index 0000000..e0d8fc0 --- /dev/null +++ b/src/assets/icon/link.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/composables/websocket/websocketWrapper.ts b/src/composables/websocket/websocketWrapper.ts index 9f1a771..ee74427 100644 --- a/src/composables/websocket/websocketWrapper.ts +++ b/src/composables/websocket/websocketWrapper.ts @@ -147,8 +147,9 @@ class OneTimeWebsocket implements IWebsocket { if (this.socket.readyState !== WebSocket.OPEN) { return; } - - console.log('WebSocket proxies data ', msg); + if (isDevMode()) { + console.log('WebSocket proxies data ', msg); + } if (msg.type === "binary") { // this.socket.send(msg.data); } else if (msg.type === "json") { diff --git a/src/router/msgRouter.ts b/src/router/msgRouter.ts index d9edb39..1ff9c7d 100644 --- a/src/router/msgRouter.ts +++ b/src/router/msgRouter.ts @@ -1,4 +1,5 @@ import type {ApiJsonMsg, ControlMsg, ServerMsg} from "@/api"; +import {isDevMode} from "@/composables/buildMode"; export interface IModuleCallback { ctrlCallback: (msg: ControlMsg) => void; @@ -27,10 +28,14 @@ export function routeModuleServerMsg(msg: ServerMsg) { if (moduleHandler) { moduleHandler.serverMsgCallback(msg); } else { - console.log("routeModuleServerMsg module not loaded", module); + if (isDevMode()) { + console.log("routeModuleServerMsg module not loaded", module); + } } } else { - console.log("routeModuleServerMsg ignored:", msg); + if (isDevMode()) { + console.log("routeModuleServerMsg ignored:", msg); + } } } diff --git a/src/views/About.vue b/src/views/About.vue index ed996de..f45e126 100644 --- a/src/views/About.vue +++ b/src/views/About.vue @@ -6,11 +6,11 @@ const compileTime = import.meta.env.VITE_APP_LAST_COMMIT;