diff options
Diffstat (limited to 'server/controllers/themes.ts')
-rw-r--r-- | server/controllers/themes.ts | 30 |
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 @@ | |||
1 | import * as express from 'express' | ||
2 | import { join } from 'path' | ||
3 | import { RegisteredPlugin } from '../lib/plugins/plugin-manager' | ||
4 | import { serveThemeCSSValidator } from '../middlewares/validators/themes' | ||
5 | |||
6 | const themesRouter = express.Router() | ||
7 | |||
8 | themesRouter.get('/:themeName/:themeVersion/css/:staticEndpoint(*)', | ||
9 | serveThemeCSSValidator, | ||
10 | serveThemeCSSDirectory | ||
11 | ) | ||
12 | |||
13 | // --------------------------------------------------------------------------- | ||
14 | |||
15 | export { | ||
16 | themesRouter | ||
17 | } | ||
18 | |||
19 | // --------------------------------------------------------------------------- | ||
20 | |||
21 | function 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 | } | ||