diff options
Diffstat (limited to 'client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts')
-rw-r--r-- | client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts | 25 |
1 files changed, 23 insertions, 2 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..1a95980ae 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 | |||
@@ -31,8 +31,6 @@ export class PluginListInstalledComponent implements OnInit { | |||
31 | plugins: PeerTubePlugin[] = [] | 31 | plugins: PeerTubePlugin[] = [] |
32 | updating: { [name: string]: boolean } = {} | 32 | updating: { [name: string]: boolean } = {} |
33 | 33 | ||
34 | PluginType = PluginType | ||
35 | |||
36 | onDataSubject = new Subject<any[]>() | 34 | onDataSubject = new Subject<any[]>() |
37 | 35 | ||
38 | constructor ( | 36 | constructor ( |
@@ -104,6 +102,10 @@ export class PluginListInstalledComponent implements OnInit { | |||
104 | return !!this.updating[this.getUpdatingKey(plugin)] | 102 | return !!this.updating[this.getUpdatingKey(plugin)] |
105 | } | 103 | } |
106 | 104 | ||
105 | isTheme (plugin: PeerTubePlugin) { | ||
106 | return plugin.type === PluginType.THEME | ||
107 | } | ||
108 | |||
107 | async uninstall (plugin: PeerTubePlugin) { | 109 | async uninstall (plugin: PeerTubePlugin) { |
108 | const res = await this.confirmService.confirm( | 110 | const res = await this.confirmService.confirm( |
109 | $localize`Do you really want to uninstall ${plugin.name}?`, | 111 | $localize`Do you really want to uninstall ${plugin.name}?`, |
@@ -128,6 +130,16 @@ export class PluginListInstalledComponent implements OnInit { | |||
128 | const updatingKey = this.getUpdatingKey(plugin) | 130 | const updatingKey = this.getUpdatingKey(plugin) |
129 | if (this.updating[updatingKey]) return | 131 | if (this.updating[updatingKey]) return |
130 | 132 | ||
133 | if (this.isMajorUpgrade(plugin)) { | ||
134 | const res = await this.confirmService.confirm( | ||
135 | $localize`This is a major plugin upgrade. Please go on the plugin homepage to check potential release notes.`, | ||
136 | $localize`Upgrade`, | ||
137 | $localize`Proceed upgrade` | ||
138 | ) | ||
139 | |||
140 | if (res === false) return | ||
141 | } | ||
142 | |||
131 | this.updating[updatingKey] = true | 143 | this.updating[updatingKey] = true |
132 | 144 | ||
133 | this.pluginApiService.update(plugin.name, plugin.type) | 145 | this.pluginApiService.update(plugin.name, plugin.type) |
@@ -156,4 +168,13 @@ export class PluginListInstalledComponent implements OnInit { | |||
156 | private getUpdatingKey (plugin: PeerTubePlugin) { | 168 | private getUpdatingKey (plugin: PeerTubePlugin) { |
157 | return plugin.name + plugin.type | 169 | return plugin.name + plugin.type |
158 | } | 170 | } |
171 | |||
172 | private isMajorUpgrade (plugin: PeerTubePlugin) { | ||
173 | if (!plugin.latestVersion) return false | ||
174 | |||
175 | const latestMajor = plugin.latestVersion.split('.')[0] | ||
176 | const currentMajor = plugin.version.split('.')[0] | ||
177 | |||
178 | return latestMajor > currentMajor | ||
179 | } | ||
159 | } | 180 | } |