Personal save-for-later and Miniflux e-reader proxy for Xteink X4 (wip)
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: require issue

+4 -6
+1 -4
src/server/config.ts
··· 1 - import { mkdirSync } from "node:fs"; 1 + import { mkdirSync, readFileSync } from "node:fs"; 2 2 import { resolve } from "node:path"; 3 3 import "dotenv/config"; 4 4 ··· 33 33 mkdirSync(config.dataDir, { recursive: true }); 34 34 35 35 function readTokenFile(path: string): string { 36 - // Defer the filesystem read to avoid needing fs at module top. 37 - // eslint-disable-next-line @typescript-eslint/no-require-imports 38 - const { readFileSync } = require("node:fs") as typeof import("node:fs"); 39 36 return readFileSync(path, "utf8").trim(); 40 37 } 41 38
+3 -2
src/server/index.ts
··· 36 36 app.route("/api", apiRoutes(oauth, mf)); 37 37 app.route("/device", deviceRoutes(oauth, mf, bodies)); 38 38 39 - const publicDir = resolve("./dist/public"); 39 + const packageRoot = resolve(import.meta.dirname, "../.."); 40 + const publicDir = resolve(packageRoot, "dist/public"); 40 41 const indexPath = resolve(publicDir, "index.html"); 41 42 const indexHtml = existsSync(indexPath) ? readFileSync(indexPath, "utf8") : ""; 42 43 43 - app.use("/*", serveStatic({ root: "./dist/public" })); 44 + app.use("/*", serveStatic({ root: publicDir })); 44 45 45 46 app.get("*", (c) => { 46 47 if (!indexHtml) return c.text("Frontend not built. Run `pnpm build`.\n");