aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-12 11:39:58 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-07-24 10:58:16 +0200
commitb5f919ac8eb2a1c20e26582fdfd377d687710d8f (patch)
tree5ec28be6f750f54bba560803ddba681103c2d82e /shared/extra-utils
parent8d2be0ed7bb87283a1ec98609df6b82d83db706a (diff)
downloadPeerTube-b5f919ac8eb2a1c20e26582fdfd377d687710d8f.tar.gz
PeerTube-b5f919ac8eb2a1c20e26582fdfd377d687710d8f.tar.zst
PeerTube-b5f919ac8eb2a1c20e26582fdfd377d687710d8f.zip
WIP plugins: update plugin
Diffstat (limited to 'shared/extra-utils')
-rw-r--r--shared/extra-utils/server/plugins.ts22
1 files changed, 21 insertions, 1 deletions
diff --git a/shared/extra-utils/server/plugins.ts b/shared/extra-utils/server/plugins.ts
index 6cd7cd17a..1da313ab7 100644
--- a/shared/extra-utils/server/plugins.ts
+++ b/shared/extra-utils/server/plugins.ts
@@ -85,7 +85,7 @@ function installPlugin (parameters: {
85 npmName?: string 85 npmName?: string
86 expectedStatus?: number 86 expectedStatus?: number
87}) { 87}) {
88 const { url, accessToken, npmName, path, expectedStatus = 204 } = parameters 88 const { url, accessToken, npmName, path, expectedStatus = 200 } = parameters
89 const apiPath = '/api/v1/plugins/install' 89 const apiPath = '/api/v1/plugins/install'
90 90
91 return makePostBodyRequest({ 91 return makePostBodyRequest({
@@ -97,6 +97,25 @@ function installPlugin (parameters: {
97 }) 97 })
98} 98}
99 99
100function updatePlugin (parameters: {
101 url: string,
102 accessToken: string,
103 path?: string,
104 npmName?: string
105 expectedStatus?: number
106}) {
107 const { url, accessToken, npmName, path, expectedStatus = 200 } = parameters
108 const apiPath = '/api/v1/plugins/update'
109
110 return makePostBodyRequest({
111 url,
112 path: apiPath,
113 token: accessToken,
114 fields: { npmName, path },
115 statusCodeExpected: expectedStatus
116 })
117}
118
100function uninstallPlugin (parameters: { 119function uninstallPlugin (parameters: {
101 url: string, 120 url: string,
102 accessToken: string, 121 accessToken: string,
@@ -118,6 +137,7 @@ function uninstallPlugin (parameters: {
118export { 137export {
119 listPlugins, 138 listPlugins,
120 installPlugin, 139 installPlugin,
140 updatePlugin,
121 getPlugin, 141 getPlugin,
122 uninstallPlugin, 142 uninstallPlugin,
123 getPluginSettings, 143 getPluginSettings,