diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts index 33f64bd05..b804ea5cd 100644 --- a/app/src/types/index.d.ts +++ b/app/src/types/index.d.ts @@ -264,6 +264,7 @@ interface Window { returnDesktop(): void print(title: string, html: string): void getScreenWidthPx(): number + exit(): void }; Protyle: import("../protyle/method").default; diff --git a/app/stage/auth.html b/app/stage/auth.html index ebd19a357..8d5d50941 100644 --- a/app/stage/auth.html +++ b/app/stage/auth.html @@ -428,11 +428,17 @@ return; } - if ((window.webkit && window.webkit.messageHandlers) || window.JSHarmony) { - window.location.href = 'siyuan://api/system/exit' - } else { - window.location.reload() + if (window.webkit && window.webkit.messageHandlers) { + window.webkit.messageHandlers.exit.postMessage(""); + return; } + + if (window.JSHarmony) { + window.JSHarmony.exit(); + return; + } + + window.location.reload() } } @@ -472,7 +478,7 @@ } } - const showMessage = (msg)=> { + const showMessage = (msg) => { document.querySelector('#message').classList.add('b3-snackbar--show') document.querySelector('#message').firstElementChild.innerHTML = msg setTimeout(() => { @@ -485,7 +491,7 @@ const inputElement = document.getElementById('authCode') const captchaElement = document.getElementById('captcha') const rememberMeElement = document.getElementById('rememberMe') - let code = inputElement.value.trim(); + let code = inputElement.value.trim(); if ("" === code) { showMessage({{.l9}}) inputElement.value = ''