@yancyyu/openhermit 1.5.11 → 1.5.13

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/main/server.ts +10 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@yancyyu/openhermit",
3
3
  "type": "module",
4
- "version": "1.5.11",
4
+ "version": "1.5.13",
5
5
  "description": "openHermit: team-oriented agent management workbench atop cc-connect.",
6
6
  "license": "AGPL-3.0",
7
7
  "author": {
@@ -3850,6 +3850,16 @@ app.get('/api/extensions/mcp/browse', async () => ({
3850
3850
  app.setNotFoundHandler((request, reply) => {
3851
3851
  const u = request.url;
3852
3852
  if (!u.startsWith('/api/')) {
3853
+ const pathname = u.split('?')[0] ?? '/';
3854
+ const hasFileExtension = /\.[^/]+$/.test(pathname);
3855
+ const indexPath = path.join(STATIC_DIR, 'index.html');
3856
+ if (
3857
+ (request.method === 'GET' || request.method === 'HEAD') &&
3858
+ !hasFileExtension &&
3859
+ _existsSync2(indexPath)
3860
+ ) {
3861
+ return reply.type('text/html; charset=utf-8').send(readFileSync(indexPath, 'utf-8'));
3862
+ }
3853
3863
  return reply.code(404).type('text/plain').send('not found');
3854
3864
  }
3855
3865