WIP on builtin prosody.
This commit is contained in:
@ -5,20 +5,20 @@ const version: string = packagejson.version || ''
|
||||
if (!/^\d+\.\d+\.\d+/.test(version)) {
|
||||
throw new Error('Incorrect version in package.json.')
|
||||
}
|
||||
const name: string = packagejson.name || ''
|
||||
if (!/^peertube-plugin-[-a-z]+$/.test(name)) {
|
||||
const pluginName: string = packagejson.name || ''
|
||||
if (!/^peertube-plugin-[-a-z]+$/.test(pluginName)) {
|
||||
throw new Error('Incorrect plugin name in package.json.')
|
||||
}
|
||||
const shortName = name.substring('peertube-plugin-'.length)
|
||||
const pluginShortName = pluginName.substring('peertube-plugin-'.length)
|
||||
|
||||
// FIXME: in Peertube <= 3.1.0, PeertubeHelpers dont provide this function
|
||||
function getBaseRouter (): string {
|
||||
return '/plugins/' + shortName + '/router/'
|
||||
return '/plugins/' + pluginShortName + '/router/'
|
||||
}
|
||||
|
||||
// FIXME: in Peertube <= 3.1.0, PeertubeHelpers dont provide this function
|
||||
function getBaseStaticRoute (): string {
|
||||
return '/plugins/' + shortName + '/' + version + '/static/'
|
||||
return '/plugins/' + pluginShortName + '/' + version + '/static/'
|
||||
}
|
||||
|
||||
// FIXME: Peertube <= 3.1.0 has no way to test that current user is admin
|
||||
@ -36,5 +36,7 @@ function isUserAdmin (res: Response): boolean {
|
||||
export {
|
||||
getBaseRouter,
|
||||
getBaseStaticRoute,
|
||||
isUserAdmin
|
||||
isUserAdmin,
|
||||
pluginName,
|
||||
pluginShortName
|
||||
}
|
||||
|
Reference in New Issue
Block a user