diff options
author | kontrollanten <6680299+kontrollanten@users.noreply.github.com> | 2020-12-04 20:56:48 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-12-08 10:40:08 +0100 |
commit | f17faefb30e4872688a1c0dafcc6c793242750f4 (patch) | |
tree | fcae9afbdbb1f3fffff89737c2e3d7c3919510cd /server/controllers | |
parent | c824e8a0c7f28a8770553e21e225589dd8f015c0 (diff) | |
download | PeerTube-f17faefb30e4872688a1c0dafcc6c793242750f4.tar.gz PeerTube-f17faefb30e4872688a1c0dafcc6c793242750f4.tar.zst PeerTube-f17faefb30e4872688a1c0dafcc6c793242750f4.zip |
plugins: add optional authentication for routes
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/plugins.ts | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/server/controllers/plugins.ts b/server/controllers/plugins.ts index 18c6613e2..6a1ccc0bf 100644 --- a/server/controllers/plugins.ts +++ b/server/controllers/plugins.ts | |||
@@ -9,6 +9,7 @@ import { getCompleteLocale, is18nLocale } from '../../shared/core-utils/i18n' | |||
9 | import { PluginType } from '../../shared/models/plugins/plugin.type' | 9 | import { PluginType } from '../../shared/models/plugins/plugin.type' |
10 | import { isTestInstance } from '../helpers/core-utils' | 10 | import { isTestInstance } from '../helpers/core-utils' |
11 | import { logger } from '@server/helpers/logger' | 11 | import { logger } from '@server/helpers/logger' |
12 | import { optionalAuthenticate } from '@server/middlewares/oauth' | ||
12 | 13 | ||
13 | const sendFileOptions = { | 14 | const sendFileOptions = { |
14 | maxAge: '30 days', | 15 | maxAge: '30 days', |
@@ -45,11 +46,13 @@ pluginsRouter.get('/plugins/:pluginName/:pluginVersion/client-scripts/:staticEnd | |||
45 | 46 | ||
46 | pluginsRouter.use('/plugins/:pluginName/router', | 47 | pluginsRouter.use('/plugins/:pluginName/router', |
47 | getPluginValidator(PluginType.PLUGIN, false), | 48 | getPluginValidator(PluginType.PLUGIN, false), |
49 | optionalAuthenticate, | ||
48 | servePluginCustomRoutes | 50 | servePluginCustomRoutes |
49 | ) | 51 | ) |
50 | 52 | ||
51 | pluginsRouter.use('/plugins/:pluginName/:pluginVersion/router', | 53 | pluginsRouter.use('/plugins/:pluginName/:pluginVersion/router', |
52 | getPluginValidator(PluginType.PLUGIN), | 54 | getPluginValidator(PluginType.PLUGIN), |
55 | optionalAuthenticate, | ||
53 | servePluginCustomRoutes | 56 | servePluginCustomRoutes |
54 | ) | 57 | ) |
55 | 58 | ||