fix: plugin version not updated after upgrade (#3166)

This commit is contained in:
chenos 2023-12-08 19:19:38 +08:00 committed by GitHub
parent 810ab3294d
commit d782776a8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -106,6 +106,8 @@ export class PresetNocoBase extends Plugin {
} }
async getPluginToBeUpgraded() { async getPluginToBeUpgraded() {
const repository = this.app.db.getRepository<any>('applicationPlugins');
const items = (await repository.find()).map((item) => item.name);
const plugins = this.getBuiltInPlugins().map((name) => { const plugins = this.getBuiltInPlugins().map((name) => {
const packageName = PluginManager.getPackageName(name); const packageName = PluginManager.getPackageName(name);
const packageJson = PluginManager.getPackageJson(packageName); const packageJson = PluginManager.getPackageJson(packageName);
@ -113,7 +115,8 @@ export class PresetNocoBase extends Plugin {
}); });
for (const plugin of this.getLocalPlugins()) { for (const plugin of this.getLocalPlugins()) {
if (plugin[1]) { if (plugin[1]) {
if (await this.app.version.satisfies(`>${plugin[1]}`)) { // 不在插件列表,并且插件最低版本小于当前应用版本,跳过不处理
if (!items.includes(plugin[0]) && (await this.app.version.satisfies(`>${plugin[1]}`))) {
continue; continue;
} }
} }