Skip to content

Commit aefca27

Browse files
committed
fix font reloading bug
1 parent abe5f8d commit aefca27

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ initKeycloak(app).then(() => {
401401
});
402402

403403
// Initial scan
404-
scanFiles("md/", path.join(basePath, "md")).then(() => {
404+
scanFiles("md/", path.join(basePath, "md"), true).then(() => {
405405
scanFonts(path.join(basePath, "assets")).then(() => {
406406
app.listen(process.env.NEXT_PUBLIC_PORT, "0.0.0.0");
407407
});

obsidian.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { v4 as uuidv4 } from "uuid";
66
import { JSDOM } from "jsdom";
77
import { hasSomeRoles } from "./utils.js";
88
import * as lucideIcons from "lucide-static";
9-
import { get } from "http";
109

1110
const internalTags = {
1211
callout: {
@@ -235,7 +234,7 @@ let lastFileSnapshot = new Map();
235234
* Scans all markdown files recursively and detects added/removed/modified files.
236235
* Returns { added, removed, modified } with full paths like "md/subdir/file.md".
237236
*/
238-
export async function scanFiles(prefix, dir, root = dir) {
237+
export async function scanFiles(prefix, dir, resetFonts = false, root = dir) {
239238
const previousSnapshot = new Map(lastFileSnapshot);
240239
const newSnapshot = new Map();
241240

@@ -293,10 +292,12 @@ export async function scanFiles(prefix, dir, root = dir) {
293292
Object.keys(filesMap).forEach(key => delete filesMap[key]);
294293
Object.keys(mdFilesDir).forEach(key => delete mdFilesDir[key]);
295294
Object.keys(mdFilesDirOnHdd).forEach(key => delete mdFilesDirOnHdd[key]);
296-
Object.keys(mainFonts).forEach(key => delete mainFonts[key]);
297-
mainFontsArray.length = 0;
298-
Object.keys(navFonts).forEach(key => delete navFonts[key]);
299-
navFontsArray.length = 0;
295+
if (resetFonts) {
296+
Object.keys(mainFonts).forEach(key => delete mainFonts[key]);
297+
mainFontsArray.length = 0;
298+
Object.keys(navFonts).forEach(key => delete navFonts[key]);
299+
navFontsArray.length = 0;
300+
}
300301
contentMap = {};
301302
mdFilesDirStructure = {};
302303

0 commit comments

Comments
 (0)