mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Merge branch 'file-routes' into 'main'
Optimize filesystem routes See merge request soapbox-pub/ditto!317
This commit is contained in:
commit
4111d8b3cb
1 changed files with 22 additions and 4 deletions
26
src/app.ts
26
src/app.ts
|
|
@ -247,11 +247,29 @@ app.get('/api/v1/lists', emptyArrayController);
|
||||||
|
|
||||||
app.use('/api/*', notImplementedController);
|
app.use('/api/*', notImplementedController);
|
||||||
|
|
||||||
app.get('*', serveStatic({ root: './public/' }));
|
const publicFiles = serveStatic({ root: './public/' });
|
||||||
app.get('*', serveStatic({ root: './static/' }));
|
const staticFiles = serveStatic({ root: './static/' });
|
||||||
app.get('*', serveStatic({ path: './public/index.html' }));
|
const frontendController = serveStatic({ path: './public/index.html' });
|
||||||
|
|
||||||
app.get('/', indexController);
|
// Known frontend routes
|
||||||
|
app.get('/@:acct', frontendController);
|
||||||
|
app.get('/@:acct/*', frontendController);
|
||||||
|
app.get('/users/*', frontendController);
|
||||||
|
app.get('/statuses/*', frontendController);
|
||||||
|
app.get('/notice/*', frontendController);
|
||||||
|
|
||||||
|
// Known static file routes
|
||||||
|
app.get('/favicon.ico', publicFiles, staticFiles);
|
||||||
|
app.get('/images/*', publicFiles, staticFiles);
|
||||||
|
app.get('/instance/*', publicFiles);
|
||||||
|
app.get('/packs/*', publicFiles);
|
||||||
|
app.get('/sw.js', publicFiles);
|
||||||
|
|
||||||
|
// Site index
|
||||||
|
app.get('/', frontendController, indexController);
|
||||||
|
|
||||||
|
// Fallback
|
||||||
|
app.get('*', publicFiles, staticFiles, frontendController);
|
||||||
|
|
||||||
export default app;
|
export default app;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue