mobygate 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +1 -1
  3. package/server.js +24 -2
package/CHANGELOG.md CHANGED
@@ -4,6 +4,18 @@ All notable changes to mobygate are documented here. Format loosely follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); version numbers are
5
5
  [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [0.5.1] — 2026-04-19
8
+
9
+ ### Fixed
10
+
11
+ - **Dashboard 404** on `/` after `npm install -g mobygate@latest` on
12
+ some fnm / npm-global setups. Root cause: Express 5's
13
+ `res.sendFile(absolutePath)` + `send` middleware was throwing a
14
+ spurious `NotFoundError` even when `index.html` was present on
15
+ disk. Replaced with `fs.readFile` + `res.send(html)` — more direct,
16
+ no middleware in between, and surfaces any real file-missing
17
+ problem as a readable HTML error page pointing at the fix.
18
+
7
19
  ## [0.5.0] — 2026-04-19
8
20
 
9
21
  The "upgrade should just work" release. Closes an entire class of
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobygate",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "OpenAI-compatible local proxy for Claude Max. The Möbius-strip gateway: OpenAI shape in, Claude Max out.",
5
5
  "type": "module",
6
6
  "main": "server.js",
package/server.js CHANGED
@@ -788,11 +788,33 @@ app.use(express.json({ limit: '10mb' }));
788
788
  // GET / — serve dashboard. No-cache headers so browsers always re-fetch
789
789
  // after a mobygate upgrade; otherwise they keep serving the old index.html
790
790
  // from cache and users see a stale dashboard long after the service updated.
791
- app.get('/', (_req, res) => {
791
+ //
792
+ // We use fs.readFile + res.send instead of res.sendFile because Express 5's
793
+ // sendFile + send middleware has produced spurious 404s in npm-global fnm
794
+ // installs even when the file definitely exists — likely an interaction
795
+ // between ESM __dirname resolution and send's internal path checks.
796
+ // readFile is straightforward and gives us a real error to log if the
797
+ // file genuinely is missing.
798
+ app.get('/', async (_req, res) => {
792
799
  res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate');
793
800
  res.setHeader('Pragma', 'no-cache');
794
801
  res.setHeader('Expires', '0');
795
- res.sendFile(join(__dirname, 'index.html'));
802
+ try {
803
+ const { readFile } = await import('fs/promises');
804
+ const html = await readFile(join(__dirname, 'index.html'), 'utf8');
805
+ res.type('html').send(html);
806
+ } catch (e) {
807
+ res.status(500).type('html').send(
808
+ `<!doctype html><meta charset=utf-8><title>mobygate — dashboard unavailable</title>
809
+ <body style="background:#0B0B09;color:#F3EFE4;font-family:ui-monospace,monospace;padding:2rem">
810
+ <h1>Dashboard failed to load</h1>
811
+ <p>Server is running fine — the dashboard HTML is just missing from the install.</p>
812
+ <pre>Path tried: ${join(__dirname, 'index.html')}</pre>
813
+ <pre>Error: ${e.code || ''} ${e.message}</pre>
814
+ <p>Fix: <code>npm install -g mobygate@latest --force</code></p>
815
+ </body>`
816
+ );
817
+ }
796
818
  });
797
819
 
798
820
  // POST /v1/chat/completions