1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 02:09:37 +02:00

Check latest plugins version

This commit is contained in:
Chocobozzz 2019-07-16 14:52:24 +02:00 committed by Chocobozzz
parent 89c344dba4
commit e0ce715a1d
6 changed files with 51 additions and 18 deletions

View file

@ -27,13 +27,18 @@ async function listAvailablePluginsFromIndex (options: PeertubePluginIndexList)
const uri = CONFIG.PLUGINS.INDEX.URL + '/api/v1/plugins'
const { body } = await doRequest({ uri, qs, json: true })
try {
const { body } = await doRequest({ uri, qs, json: true })
logger.debug('Got result from PeerTube index.', { body })
logger.debug('Got result from PeerTube index.', { body })
await addInstanceInformation(body)
await addInstanceInformation(body)
return body as ResultList<PeerTubePluginIndex>
return body as ResultList<PeerTubePluginIndex>
} catch (err) {
logger.error('Cannot list available plugins from index %s.', uri, { err })
return undefined
}
}
async function addInstanceInformation (result: ResultList<PeerTubePluginIndex>) {
@ -53,7 +58,7 @@ async function getLatestPluginsVersion (npmNames: string[]): Promise<PeertubePlu
const uri = CONFIG.PLUGINS.INDEX.URL + '/api/v1/plugins/latest-version'
const { body } = await doRequest({ uri, body: bodyRequest })
const { body } = await doRequest({ uri, body: bodyRequest, json: true, method: 'POST' })
return body
}