You've already forked joplin
							
							
				mirror of
				https://github.com/laurent22/joplin.git
				synced 2025-10-31 00:07:48 +02:00 
			
		
		
		
	This commit is contained in:
		| @@ -108,6 +108,10 @@ export default class PluginService extends BaseService { | ||||
| 		return this.isSafeMode_; | ||||
| 	} | ||||
|  | ||||
| 	public get appVersion(): string { | ||||
| 		return this.appVersion_; | ||||
| 	} | ||||
|  | ||||
| 	public set isSafeMode(v: boolean) { | ||||
| 		this.isSafeMode_ = v; | ||||
| 	} | ||||
|   | ||||
| @@ -215,21 +215,21 @@ export default class RepositoryApi { | ||||
| 		return this.manifests_; | ||||
| 	} | ||||
|  | ||||
| 	public async canBeUpdatedPlugins(installedManifests: PluginManifest[]): Promise<string[]> { | ||||
| 	public async canBeUpdatedPlugins(installedManifests: PluginManifest[], appVersion: string): Promise<string[]> { | ||||
| 		const output = []; | ||||
|  | ||||
| 		for (const manifest of installedManifests) { | ||||
| 			const canBe = await this.pluginCanBeUpdated(manifest.id, manifest.version); | ||||
| 			const canBe = await this.pluginCanBeUpdated(manifest.id, manifest.version, appVersion); | ||||
| 			if (canBe) output.push(manifest.id); | ||||
| 		} | ||||
|  | ||||
| 		return output; | ||||
| 	} | ||||
|  | ||||
| 	public async pluginCanBeUpdated(pluginId: string, installedVersion: string): Promise<boolean> { | ||||
| 	public async pluginCanBeUpdated(pluginId: string, installedVersion: string, appVersion: string): Promise<boolean> { | ||||
| 		const manifest = (await this.manifests()).find(m => m.id === pluginId); | ||||
| 		if (!manifest) return false; | ||||
| 		return compareVersions(installedVersion, manifest.version) < 0; | ||||
| 		return compareVersions(installedVersion, manifest.version) < 0 && compareVersions(appVersion, manifest.app_min_version) >= 0; | ||||
| 	} | ||||
|  | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user