diff options
-rw-r--r-- | client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts b/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts index c78b19585..cbdc379a8 100644 --- a/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts +++ b/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts | |||
@@ -128,6 +128,16 @@ export class PluginListInstalledComponent implements OnInit { | |||
128 | const updatingKey = this.getUpdatingKey(plugin) | 128 | const updatingKey = this.getUpdatingKey(plugin) |
129 | if (this.updating[updatingKey]) return | 129 | if (this.updating[updatingKey]) return |
130 | 130 | ||
131 | if (this.isMajorUpgrade(plugin)) { | ||
132 | const res = await this.confirmService.confirm( | ||
133 | $localize`This is a major plugin upgrade. Please go on the plugin homepage to check potential release notes.`, | ||
134 | $localize`Upgrade`, | ||
135 | $localize`Proceed upgrade` | ||
136 | ) | ||
137 | |||
138 | if (res === false) return | ||
139 | } | ||
140 | |||
131 | this.updating[updatingKey] = true | 141 | this.updating[updatingKey] = true |
132 | 142 | ||
133 | this.pluginApiService.update(plugin.name, plugin.type) | 143 | this.pluginApiService.update(plugin.name, plugin.type) |
@@ -156,4 +166,13 @@ export class PluginListInstalledComponent implements OnInit { | |||
156 | private getUpdatingKey (plugin: PeerTubePlugin) { | 166 | private getUpdatingKey (plugin: PeerTubePlugin) { |
157 | return plugin.name + plugin.type | 167 | return plugin.name + plugin.type |
158 | } | 168 | } |
169 | |||
170 | private isMajorUpgrade (plugin: PeerTubePlugin) { | ||
171 | if (!plugin.latestVersion) return false | ||
172 | |||
173 | const latestMajor = plugin.latestVersion.split('.')[0] | ||
174 | const currentMajor = plugin.version.split('.')[0] | ||
175 | |||
176 | return latestMajor > currentMajor | ||
177 | } | ||
159 | } | 178 | } |