@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.
- package/package.json +1 -1
- package/src/main/server.ts +10 -0
package/package.json
CHANGED
package/src/main/server.ts
CHANGED
|
@@ -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
|
|