]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/extra-utils/server/plugins.ts
Comment changed, mostly to kick Travis into rectifying its last silliness
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / server / plugins.ts
index 7a5c5344b7b70cbf72d07f4649146209e816c1e6..5c0d1e511c1812daba288d9890850c0c842e3f65 100644 (file)
@@ -119,6 +119,36 @@ function getPluginRegisteredSettings (parameters: {
   })
 }
 
+function getPublicSettings (parameters: {
+  url: string,
+  npmName: string,
+  expectedStatus?: number
+}) {
+  const { url, npmName, expectedStatus = 200 } = parameters
+  const path = '/api/v1/plugins/' + npmName + '/public-settings'
+
+  return makeGetRequest({
+    url,
+    path,
+    statusCodeExpected: expectedStatus
+  })
+}
+
+function getPluginTranslations (parameters: {
+  url: string,
+  locale: string,
+  expectedStatus?: number
+}) {
+  const { url, locale, expectedStatus = 200 } = parameters
+  const path = '/plugins/translations/' + locale + '.json'
+
+  return makeGetRequest({
+    url,
+    path,
+    statusCodeExpected: expectedStatus
+  })
+}
+
 function installPlugin (parameters: {
   url: string,
   accessToken: string,
@@ -201,10 +231,15 @@ function getPluginPackageJSON (server: ServerInfo, npmName: string) {
   return readJSON(path)
 }
 
+function getPluginTestPath (suffix = '') {
+  return join(root(), 'server', 'tests', 'fixtures', 'peertube-plugin-test' + suffix)
+}
+
 export {
   listPlugins,
   listAvailablePlugins,
   installPlugin,
+  getPluginTranslations,
   getPluginsCSS,
   updatePlugin,
   getPlugin,
@@ -213,5 +248,7 @@ export {
   getPluginRegisteredSettings,
   getPackageJSONPath,
   updatePluginPackageJSON,
-  getPluginPackageJSON
+  getPluginPackageJSON,
+  getPluginTestPath,
+  getPublicSettings
 }