1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-27 23:28:38 +02:00

Desktop: Do not allow installing plugins incompatible with current app version

This commit is contained in:
Laurent Cozic
2021-01-24 18:45:42 +00:00
parent 351a05fb0d
commit 774be9cc0d
4 changed files with 44 additions and 31 deletions

View File

@ -334,8 +334,12 @@ export default class PluginService extends BaseService {
}
}
public isCompatible(pluginVersion: string): boolean {
return compareVersions(this.appVersion_, pluginVersion) >= 0;
}
public async runPlugin(plugin: Plugin) {
if (compareVersions(this.appVersion_, plugin.manifest.app_min_version) < 0) {
if (!this.isCompatible(plugin.manifest.app_min_version)) {
throw new Error(`Plugin "${plugin.id}" was disabled because it requires Joplin version ${plugin.manifest.app_min_version} and current version is ${this.appVersion_}.`);
} else {
this.store_.dispatch({