diff options
Diffstat (limited to 'shared')
-rw-r--r-- | shared/extra-utils/server/plugins.ts | 22 | ||||
-rw-r--r-- | shared/models/plugins/install-plugin.model.ts | 2 | ||||
-rw-r--r-- | shared/models/plugins/peertube-plugin.model.ts | 1 |
3 files changed, 23 insertions, 2 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 | ||
100 | function 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 | |||
100 | function uninstallPlugin (parameters: { | 119 | function uninstallPlugin (parameters: { |
101 | url: string, | 120 | url: string, |
102 | accessToken: string, | 121 | accessToken: string, |
@@ -118,6 +137,7 @@ function uninstallPlugin (parameters: { | |||
118 | export { | 137 | export { |
119 | listPlugins, | 138 | listPlugins, |
120 | installPlugin, | 139 | installPlugin, |
140 | updatePlugin, | ||
121 | getPlugin, | 141 | getPlugin, |
122 | uninstallPlugin, | 142 | uninstallPlugin, |
123 | getPluginSettings, | 143 | getPluginSettings, |
diff --git a/shared/models/plugins/install-plugin.model.ts b/shared/models/plugins/install-plugin.model.ts index b1b46fa08..5a268ebe1 100644 --- a/shared/models/plugins/install-plugin.model.ts +++ b/shared/models/plugins/install-plugin.model.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | export interface InstallPlugin { | 1 | export interface InstallOrUpdatePlugin { |
2 | npmName?: string | 2 | npmName?: string |
3 | path?: string | 3 | path?: string |
4 | } | 4 | } |
diff --git a/shared/models/plugins/peertube-plugin.model.ts b/shared/models/plugins/peertube-plugin.model.ts index de3c7741b..e3c100027 100644 --- a/shared/models/plugins/peertube-plugin.model.ts +++ b/shared/models/plugins/peertube-plugin.model.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | export interface PeerTubePlugin { | 1 | export interface PeerTubePlugin { |
2 | name: string | 2 | name: string |
3 | type: number | 3 | type: number |
4 | latestVersion: string | ||
4 | version: string | 5 | version: string |
5 | enabled: boolean | 6 | enabled: boolean |
6 | uninstalled: boolean | 7 | uninstalled: boolean |