aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/themes.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-11 17:23:24 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-07-24 10:58:16 +0200
commit8d2be0ed7bb87283a1ec98609df6b82d83db706a (patch)
tree31a36b252df32be83ceb77658a53b57f9d15e8ac /server/controllers/themes.ts
parentdba85a1e9e9f603ba52e1ea42deaf3fdd799b1d8 (diff)
downloadPeerTube-8d2be0ed7bb87283a1ec98609df6b82d83db706a.tar.gz
PeerTube-8d2be0ed7bb87283a1ec98609df6b82d83db706a.tar.zst
PeerTube-8d2be0ed7bb87283a1ec98609df6b82d83db706a.zip
WIP plugins: move plugin CLI in peertube script
Install/uninstall/list plugins remotely
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}