diff --git a/apps/api/src/share-routes.test.mjs b/apps/api/src/share-routes.test.mjs index b73d2e45..f85a35bc 100644 --- a/apps/api/src/share-routes.test.mjs +++ b/apps/api/src/share-routes.test.mjs @@ -104,6 +104,22 @@ describe("public memo shares", () => { sqlite.close(); }); + test("reads existing fonts and new catalog choices through the same stored preference", async () => { + const { sqlite, environment } = createDatabaseEnvironment(); + sqlite.query("INSERT INTO users (id, username, password_hash, note_body_font) VALUES (?, ?, ?, ?)") + .run("usr_font_catalog", "font-catalog", "hash", "wenkai"); + sqlite.query("UPDATE memo_shares SET created_by = ? WHERE id = ?").run("usr_font_catalog", "share_source"); + const app = new Hono(); + registerPublicShareRoutes(app); + for (const id of ["wenkai", "smiley", "puhui", "puhui-heavy", "youshe", "shuhei", "heavy", "zhuque", "source-han-serif"]) { + sqlite.query("UPDATE users SET note_body_font = ? WHERE id = ?").run(id, "usr_font_catalog"); + const response = await app.request(`/api/public/shares/${sourceToken}`, {}, environment); + expect(response.status).toBe(200); + expect((await response.json()).share.bodyFont).toBe(id); + } + sqlite.close(); + }); + test("publishes the author's built-in note font and ignores anything else", async () => { const { sqlite, environment } = createDatabaseEnvironment(); sqlite.query("INSERT INTO users (id, username, password_hash, note_body_font) VALUES (?, ?, ?, ?)") @@ -195,6 +211,14 @@ describe("public memo shares", () => { expect(response.status).toBe(200); expect(sqlite.query("SELECT note_body_font FROM users WHERE id = ?").get("usr_author").note_body_font).toBe("source-han-serif"); + for (const id of ["smiley", "wenkai", "zhuque", "heavy", "puhui", "puhui-heavy", "youshe", "shuhei"]) { + const response = await app.request("/api/v1/me/note-body-font", { + method: "PUT", headers: { "content-type": "application/json" }, body: JSON.stringify({ bodyFont: id }), + }, environment); + expect(response.status).toBe(200); + expect(sqlite.query("SELECT note_body_font FROM users WHERE id = ?").get("usr_author").note_body_font).toBe(id); + } + const cleared = await app.request("/api/v1/me/note-body-font", { method: "PUT", headers: { "content-type": "application/json" }, diff --git a/apps/ios/EdgeEver/Resources/EditorBundle/index.html b/apps/ios/EdgeEver/Resources/EditorBundle/index.html index 5d119805..2fe9ea75 100644 --- a/apps/ios/EdgeEver/Resources/EditorBundle/index.html +++ b/apps/ios/EdgeEver/Resources/EditorBundle/index.html @@ -7,7 +7,7 @@ content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />