aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/themes.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/themes.ts')
-rw-r--r--server/controllers/themes.ts30
1 files changed, 0 insertions, 30 deletions
diff --git a/server/controllers/themes.ts b/server/controllers/themes.ts
deleted file mode 100644
index 104c285ad..000000000
--- a/server/controllers/themes.ts
+++ /dev/null
@@ -1,30 +0,0 @@
1import * as express from 'express'
2import { join } from 'path'
3import { RegisteredPlugin } from '../lib/plugins/plugin-manager'
4import { serveThemeCSSValidator } from '../middlewares/validators/themes'
5
6const themesRouter = express.Router()
7
8themesRouter.get('/:themeName/:themeVersion/css/:staticEndpoint(*)',
9 serveThemeCSSValidator,
10 serveThemeCSSDirectory
11)
12
13// ---------------------------------------------------------------------------
14
15export {
16 themesRouter
17}
18
19// ---------------------------------------------------------------------------
20
21function serveThemeCSSDirectory (req: express.Request, res: express.Response) {
22 const plugin: RegisteredPlugin = res.locals.registeredPlugin
23 const staticEndpoint = req.params.staticEndpoint
24
25 if (plugin.css.includes(staticEndpoint) === false) {
26 return res.sendStatus(404)
27 }
28
29 return res.sendFile(join(plugin.path, staticEndpoint))
30}