diff options
Diffstat (limited to 'frontend/src/store.tsx')
| -rw-r--r-- | frontend/src/store.tsx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/frontend/src/store.tsx b/frontend/src/store.tsx index dfd9b04b..33c384a5 100644 --- a/frontend/src/store.tsx +++ b/frontend/src/store.tsx @@ -1,6 +1,6 @@ -import { compare } from 'compare-versions'; +import { compare, validate } from 'compare-versions'; -import { InstallType, Plugin, installPlugin, installPlugins } from './plugin'; +import { DisabledPlugin, InstallType, Plugin, installPlugin, installPlugins } from './plugin'; import { getSetting, setSetting } from './utils/settings'; export enum Store { @@ -113,18 +113,21 @@ export async function requestMultiplePluginInstalls(requests: PluginInstallReque ); } -export async function checkForPluginUpdates(plugins: Plugin[]): Promise<PluginUpdateMapping> { +export async function checkForPluginUpdates(plugins: (Plugin | DisabledPlugin)[]): Promise<PluginUpdateMapping> { const serverData = await getPluginList(); const updateMap = new Map<string, StorePluginVersion>(); for (let plugin of plugins) { const remotePlugin = serverData?.find((x) => x.name == plugin.name); //FIXME: Ugly hack since plugin.version might be null during evaluation, //so this will set the older version possible - const curVer = plugin.version ? plugin.version : '0.0'; + const curVer = plugin.version ? plugin.version : '0.0.0'; + if ( remotePlugin && remotePlugin.versions?.length > 0 && plugin.version != remotePlugin?.versions?.[0]?.name && + validate(remotePlugin.versions?.[0]?.name) && + validate(curVer) && compare(remotePlugin?.versions?.[0]?.name, curVer, '>') ) { updateMap.set(plugin.name, remotePlugin.versions[0]); |
