diff options
author | Chocobozzz <me@florianbigard.com> | 2019-07-11 17:23:24 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-07-24 10:58:16 +0200 |
commit | 8d2be0ed7bb87283a1ec98609df6b82d83db706a (patch) | |
tree | 31a36b252df32be83ceb77658a53b57f9d15e8ac /server/controllers/themes.ts | |
parent | dba85a1e9e9f603ba52e1ea42deaf3fdd799b1d8 (diff) | |
download | PeerTube-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.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 | } | ||