Skip to content

Commit 2b561ee

Browse files
committed
Merge branch 'main' into develop
2 parents 86f3c4d + 1c3e8e6 commit 2b561ee

File tree

8 files changed

+30
-8
lines changed

8 files changed

+30
-8
lines changed

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fumix/fu-blog-client",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"scripts": {
55
"start": "vite --port 5010",
66
"build": "run-p type-check build-only",

client/src/util/storage.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { JsonWebToken, SavedOAuthToken, UserTheme } from "@fumix/fu-blog-common";
2-
import { base64UrlToBuffer, isOAuthType } from "@fumix/fu-blog-common";
2+
import { base64UrlToBuffer, isOAuthType, isUserTheme } from "@fumix/fu-blog-common";
33

44
type OAuthState = { key: string; redirect_uri?: string };
55
const idTokenKey = "id_token";
@@ -67,9 +67,21 @@ export function saveCssPreference(css: UserTheme) {
6767
}
6868

6969
export function loadCssPreference(): UserTheme {
70-
return loadFromStorageAsString(window.localStorage, "cssTheme", "lightTheme") as UserTheme;
70+
return loadFromStorage(
71+
window.localStorage,
72+
"cssTheme",
73+
(saved) => {
74+
if (isUserTheme(saved)) {
75+
return saved;
76+
}
77+
return null;
78+
},
79+
"light",
80+
);
7181
}
7282

83+
84+
7385
//
7486
// General purpose helper functions, should only be called indirectly
7587
//

common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fumix/fu-blog-common",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"author": "fumiX GmbH & Co KG",
55
"license": "Apache-2.0",
66
"scripts": {

common/src/entity/User.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,9 @@ export type UserWithOAuthProviders = User & {
2828
oauthProviders: OAuthProviderId[];
2929
};
3030

31-
export type UserTheme = "light" | "dark";
31+
const userThemes = ["light", "dark"] as const;
32+
export type UserTheme = (typeof userThemes)[number];
33+
34+
export function isUserTheme(s: string): s is UserTheme {
35+
return userThemes.some((it) => it === s);
36+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
},
55
"engineStrict": true,
66
"name": "@fumix/fu-blog",
7-
"version": "0.2.3",
7+
"version": "0.2.4",
88
"workspaces": [
99
"common",
1010
"client",

portal/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fumix/fu-blog-portal",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"private": true,
55
"main": "index.js",
66
"type": "module",

server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fumix/fu-blog-server",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"description": "Backend Server for Blog in Node/Express",
55
"main": "server.js",
66
"scripts": {

server/src/server.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import console from "console";
12
import cors from "cors";
23
import express, { Application, NextFunction, Request, Response } from "express";
34
import { readFile, writeFileSync } from "fs";
@@ -70,13 +71,17 @@ async function handleUncaught(error: Error) {
7071
process.exit(1);
7172
}
7273

74+
console.log("IS_PRODUCTION:", AppSettings.IS_PRODUCTION);
75+
console.log("Run mode:", AppSettings.RUN_MODE);
76+
console.log("DTO:", AppSettings.DTO);
7377
// in production serve the built vue-app from static public folder:
7478
if (AppSettings.IS_PRODUCTION) {
7579
const indexResponse = (req: Request, res: Response) => {
7680
readFile(
7781
path.join(__dirname, "public/index.html"), //
7882
{ encoding: "utf-8" },
7983
(err, data) => {
84+
console.log("Data callback", data);
8085
if (err) {
8186
res.status(404).send(null);
8287
} else {

0 commit comments

Comments
 (0)