Skip to content

Build your personal knowledge base with Trilium Notes

fix(setup): restore draggable title bar region on macOS

Elian Dorand89378c7d9de
diff --git a/apps/server/src/routes/index.ts b/apps/server/src/routes/index.ts
index e4b51d9834..bfc45b382f 100644
--- a/apps/server/src/routes/index.ts
+++ b/apps/server/src/routes/index.ts
@@ -37,6 +37,7 @@ export function bootstrap(req: Request, res: Response) {
isStandalone: false,
isElectron,
isDev,
+ platform: process.platform,
triliumVersion: packageJson.version,
device: view,
TRILIUM_SAFE_MODE: !!process.env.TRILIUM_SAFE_MODE,
@@ -72,7 +73,6 @@ export function bootstrap(req: Request, res: Response) {
res.send({
...commonItems,
passwordSet: false,
- platform: process.platform,
hasNativeTitleBar: false,
hasBackgroundEffects: false,
isMainWindow: true
@@ -101,7 +101,6 @@ export function bootstrap(req: Request, res: Response) {
totpEnabled: totp.isTotpEnabled(),
ssoError
},
- platform: process.platform,
hasNativeTitleBar: false,
hasBackgroundEffects: false,
isMainWindow: true
@@ -134,7 +133,6 @@ export function bootstrap(req: Request, res: Response) {
loggedIn: true,
csrfToken,
oauthJustEnrolled,
- platform: process.platform,
hasNativeTitleBar: isElectron && nativeTitleBarVisible,
hasBackgroundEffects: options.backgroundEffects === "true"
&& isElectron
diff --git a/apps/server/src/routes/transport.spec.ts b/apps/server/src/routes/transport.spec.ts
index 68e5174798..676db2bc53 100644
--- a/apps/server/src/routes/transport.spec.ts
+++ b/apps/server/src/routes/transport.spec.ts
@@ -1,7 +1,7 @@
-import { cls, options as optionService } from "@triliumnext/core";
+import { cls, options as optionService, sql_init } from "@triliumnext/core";
import type { Application } from "express";
import supertest from "supertest";
-import { beforeAll, describe, expect, it } from "vitest";
+import { beforeAll, describe, expect, it, vi } from "vitest";
import { type ApiTestContext, bootLoggedInApp, createTextNote } from "../../spec/support/internal_api.js";
import port from "../services/port.js";
@@ -37,6 +37,19 @@ describe("Route transport & middleware", () => {
const res = await supertest(app).get("/bootstrap?extraWindow=1").expect(200);
expect(res.body.isMainWindow).toBe(false);
});
+
+ it("includes platform in the setup (uninitialized DB) payload", async () => {
+ // The setup window relies on `glob.platform` to apply the
+ // platform-darwin drag-region CSS on macOS.
+ const spy = vi.spyOn(sql_init, "isDbInitialized").mockReturnValue(false);
+ try {
+ const res = await supertest(app).get("/bootstrap").expect(200);
+ expect(res.body.dbInitialized).toBe(false);
+ expect(res.body.platform).toBe(process.platform);
+ } finally {
+ spy.mockRestore();
+ }
+ });
});
describe("CSRF & error handling", () => {