diff --git a/package.json b/package.json index 1039c22..2b0652e 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "usewiki2", "description": "Convert HTML to Markdown, and save to your computer, support nodejs tiddlywiki", "private": true, - "version": "1.5.4", + "version": "1.5.5", "type": "module", "scripts": { "dev": "wxt", diff --git a/utils/checkStatus.ts b/utils/checkStatus.ts index 2875f67..434daa3 100644 --- a/utils/checkStatus.ts +++ b/utils/checkStatus.ts @@ -10,6 +10,15 @@ export async function checkStatus( const baseURL = `http://localhost:${port}`; const twFetch = ofetch.create({ baseURL, + retry: 0, + onResponse({ request, response, options }) { + if (response.ok) { + notify({ + message: 'TiddlyWiki 连接成功', + type: 'success', + }); + } + }, async onRequestError({ request, response, options }) { notify({ message: 'TiddlyWiki 未成功连接', @@ -23,16 +32,4 @@ export async function checkStatus( }); status.value = data; - - if (!data.tiddlywiki_version) { - notify({ - message: 'TiddlyWiki 未连接', - type: 'error', - }); - } else { - notify({ - message: 'TiddlyWiki 连接成功', - type: 'success', - }); - } } diff --git a/utils/save2TiddlyWiki.ts b/utils/save2TiddlyWiki.ts index c3af7fd..886302e 100644 --- a/utils/save2TiddlyWiki.ts +++ b/utils/save2TiddlyWiki.ts @@ -33,8 +33,9 @@ const save2TiddlyWiki = async ( const baseURL = `http://localhost:${port}`; const savetwFetch = ofetch.create({ baseURL, + retry: 0, async onResponse({ request, response, options }) { - if (response.status === 204) { + if (response.ok) { notify({ message: '保存成功', type: 'success',