aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/plugins
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-16 14:52:24 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-07-24 10:58:16 +0200
commite0ce715a1ded6e84c877004dae3e354c8716fb06 (patch)
treec2a48af098e27fea2c2c6bb47b2daa68103c1a0e /server/lib/plugins
parent89c344dba4ae2fca39cf636c3c6f09f31a339493 (diff)
downloadPeerTube-e0ce715a1ded6e84c877004dae3e354c8716fb06.tar.gz
PeerTube-e0ce715a1ded6e84c877004dae3e354c8716fb06.tar.zst
PeerTube-e0ce715a1ded6e84c877004dae3e354c8716fb06.zip
Check latest plugins version
Diffstat (limited to 'server/lib/plugins')
-rw-r--r--server/lib/plugins/plugin-index.ts15
1 files changed, 10 insertions, 5 deletions
diff --git a/server/lib/plugins/plugin-index.ts b/server/lib/plugins/plugin-index.ts
index 4a8a90ec8..63cd47e63 100644
--- a/server/lib/plugins/plugin-index.ts
+++ b/server/lib/plugins/plugin-index.ts
@@ -27,13 +27,18 @@ async function listAvailablePluginsFromIndex (options: PeertubePluginIndexList)
27 27
28 const uri = CONFIG.PLUGINS.INDEX.URL + '/api/v1/plugins' 28 const uri = CONFIG.PLUGINS.INDEX.URL + '/api/v1/plugins'
29 29
30 const { body } = await doRequest({ uri, qs, json: true }) 30 try {
31 const { body } = await doRequest({ uri, qs, json: true })
31 32
32 logger.debug('Got result from PeerTube index.', { body }) 33 logger.debug('Got result from PeerTube index.', { body })
33 34
34 await addInstanceInformation(body) 35 await addInstanceInformation(body)
35 36
36 return body as ResultList<PeerTubePluginIndex> 37 return body as ResultList<PeerTubePluginIndex>
38 } catch (err) {
39 logger.error('Cannot list available plugins from index %s.', uri, { err })
40 return undefined
41 }
37} 42}
38 43
39async function addInstanceInformation (result: ResultList<PeerTubePluginIndex>) { 44async function addInstanceInformation (result: ResultList<PeerTubePluginIndex>) {
@@ -53,7 +58,7 @@ async function getLatestPluginsVersion (npmNames: string[]): Promise<PeertubePlu
53 58
54 const uri = CONFIG.PLUGINS.INDEX.URL + '/api/v1/plugins/latest-version' 59 const uri = CONFIG.PLUGINS.INDEX.URL + '/api/v1/plugins/latest-version'
55 60
56 const { body } = await doRequest({ uri, body: bodyRequest }) 61 const { body } = await doRequest({ uri, body: bodyRequest, json: true, method: 'POST' })
57 62
58 return body 63 return body
59} 64}