Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix: preserve logout type safety
dajiaohuang1fc3e5b72489
diff --git a/apps/client/src/components/entrypoints.ts b/apps/client/src/components/entrypoints.tsindex 1b09f1851e..8803854cf9 100644--- a/apps/client/src/components/entrypoints.ts+++ b/apps/client/src/components/entrypoints.ts@@ -104,10 +104,11 @@ export default class Entrypoints extends Component {// Electron keeps the request on its trusted custom protocol.const form = document.createElement("form");form.method = "POST";+ const httpBaseUrl = window.glob.httpBaseUrl;form.action = window.glob.isElectron? new URL(`${window.glob.baseApiUrl}../logout`, window.location.href).href- : window.glob.httpBaseUrl- ? new URL("/logout", window.glob.httpBaseUrl).href+ : httpBaseUrl+ ? new URL("/logout", httpBaseUrl).href: new URL(`${window.glob.baseApiUrl}../logout`, window.location.href).href;form.hidden = true;diff --git a/apps/server/src/routes/error_handlers.ts b/apps/server/src/routes/error_handlers.tsindex 6ce725b51b..6bbc3b5c15 100644--- a/apps/server/src/routes/error_handlers.ts+++ b/apps/server/src/routes/error_handlers.ts@@ -68,8 +68,8 @@ function register(app: Application) {export function isLogoutFormNavigation(req: Request): boolean {return req.method === "POST"&& req.path === "/logout"- && req.is("application/x-www-form-urlencoded")- && req.headers.accept?.includes("text/html") === true;+ && req.is("application/x-www-form-urlencoded") === "application/x-www-form-urlencoded"+ && req.get("Accept")?.includes("text/html") === true;}/**