diff --git a/components.d.ts b/components.d.ts index 4d08b34..1d94901 100644 --- a/components.d.ts +++ b/components.d.ts @@ -7,8 +7,7 @@ export {} declare module 'vue' { export interface GlobalComponents { - ElButton: typeof import('element-plus/es')['ElButton'] - ElDrawer: typeof import('element-plus/es')['ElDrawer'] + ElDialog: typeof import('element-plus/es')['ElDialog'] ElForm: typeof import('element-plus/es')['ElForm'] ElFormItem: typeof import('element-plus/es')['ElFormItem'] ElInput: typeof import('element-plus/es')['ElInput'] @@ -18,5 +17,6 @@ declare module 'vue' { ElTabPane: typeof import('element-plus/es')['ElTabPane'] ElTabs: typeof import('element-plus/es')['ElTabs'] ElTag: typeof import('element-plus/es')['ElTag'] + ElTooltip: typeof import('element-plus/es')['ElTooltip'] } } diff --git a/entrypoints/sidepanel/Sidepanel.vue b/entrypoints/sidepanel/Sidepanel.vue index 215b8bd..2183df1 100644 --- a/entrypoints/sidepanel/Sidepanel.vue +++ b/entrypoints/sidepanel/Sidepanel.vue @@ -33,7 +33,7 @@ const faviconUrl = ref(''); const title = ref(''); const isAIChecking = ref(false); const GROQ_APIKEY = ref(''); -const isCheckTw5 = ref(false); +const isCheckTw5 = ref(false); // 是否连接tw const inputVisible = ref(false); const InputRef = ref(); const inputValue = ref(); @@ -60,6 +60,7 @@ async function getContent( tip: false, } ) { + html.value = ''; const tabs = await browser.tabs.query({ active: true, currentWindow: true }); const tab = tabs[0]; @@ -194,6 +195,22 @@ async function ai2md() { } async function savePort(port: number) { + if (!port) { + notify({ + message: '请输入端口号', + type: 'error', + }); + return; + } + // 检查端口号范围的合法性 + if (port < 1024 || port > 65535) { + notify({ + message: '端口号范围 1024 - 65535', + type: 'error', + }); + return; + } + await portStorage.setValue(port); if (isCheckTw5.value) { // 更新status @@ -202,6 +219,14 @@ async function savePort(port: number) { } async function saveAuth(option: { username: string; password: string }) { + // 检查用户名或者密码是否合法 + if (!option.username || !option.password) { + notify({ + message: '请输入' + (option.username ? '密码' : '用户名'), + type: 'error', + }); + return; + } await authStorage.setValue(option); if (password.value) { checkStatus(port, status, isChecking, username, password); @@ -214,60 +239,74 @@ const toggleInfoDialog = () => { -
-

连接到 Nodejs TiddlyWiki5

- - - +
-

TiddlyWiki5 登录认证

+

登录

- + + minlength="3" + maxlength="20" + show-word-limit + placeholder="请输入用户名" /> 保存 + "> + 保存 +
+

连接TiddlyWiki5

+ +
-

Nodejs TiddlyWiki5 端口

+

端口号

+ type="number" + placeholder="请输入端口号" /> 保存
-

剪藏标签

- -
- - {{ tag }} - - - - - + - + +
+

标签

+ +
+ +
+ + {{ tag }} +
+
+ + + + + + +
- + title=""> --> + - +
diff --git a/entrypoints/sidepanel/components/Info.vue b/entrypoints/sidepanel/components/Info.vue index 2d60aeb..3579f9e 100644 --- a/entrypoints/sidepanel/components/Info.vue +++ b/entrypoints/sidepanel/components/Info.vue @@ -4,11 +4,13 @@ defineProps(['status', 'json']);