From eed486f76d38c3830d99213ae5b7b4255dd9aa58 Mon Sep 17 00:00:00 2001 From: Marco Rodolfi Date: Thu, 14 Mar 2024 15:22:49 +0100 Subject: [PATCH] Stop notifying updates which have an older semver release. --- frontend/package.json | 4 +++- frontend/pnpm-lock.yaml | 29 +++++++++++++++++++++++++++++ frontend/src/store.tsx | 12 +++++++++++- package-lock.json | 6 ++++++ 4 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 package-lock.json diff --git a/frontend/package.json b/frontend/package.json index cc21fea00..b19a36a4c 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -52,6 +52,8 @@ "react-i18next": "^12.3.1", "react-icons": "^4.9.0", "react-markdown": "^8.0.7", - "remark-gfm": "^3.0.1" + "remark-gfm": "^3.0.1", + "compare-versions": "^6.1.0", + "semver": "^7.6.0" } } diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml index 3c4666ce5..6fbc14745 100644 --- a/frontend/pnpm-lock.yaml +++ b/frontend/pnpm-lock.yaml @@ -5,6 +5,9 @@ settings: excludeLinksFromLockfile: false dependencies: + compare-versions: + specifier: ^6.1.0 + version: 6.1.0 decky-frontend-lib: specifier: 3.25.0 version: 3.25.0 @@ -32,6 +35,9 @@ dependencies: remark-gfm: specifier: ^3.0.1 version: 3.0.1 + semver: + specifier: ^7.6.0 + version: 7.6.0 devDependencies: '@rollup/plugin-commonjs': @@ -1398,6 +1404,10 @@ packages: resolution: {integrity: sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==} dev: true + /compare-versions@6.1.0: + resolution: {integrity: sha512-LNZQXhqUvqUTotpZ00qLSaify3b4VFD588aRr8MKFw4CMUr98ytzCW5wDH5qx/DEY5kCDXcbcRuCqL0szEf2tg==} + dev: false + /concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} dev: true @@ -2480,6 +2490,13 @@ packages: yallist: 3.1.1 dev: true + /lru-cache@6.0.0: + resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} + engines: {node: '>=10'} + dependencies: + yallist: 4.0.0 + dev: false + /magic-string@0.25.9: resolution: {integrity: sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==} dependencies: @@ -3545,6 +3562,14 @@ packages: hasBin: true dev: true + /semver@7.6.0: + resolution: {integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==} + engines: {node: '>=10'} + hasBin: true + dependencies: + lru-cache: 6.0.0 + dev: false + /serialize-javascript@6.0.1: resolution: {integrity: sha512-owoXEFjWRllis8/M1Q+Cw5k8ZH40e3zhp/ovX+Xr/vi1qj6QesbyXXViFbpNvWvPNAD62SutwEXavefrLJWj7w==} dependencies: @@ -4126,6 +4151,10 @@ packages: resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} dev: true + /yallist@4.0.0: + resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} + dev: false + /yargs-parser@21.1.1: resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} engines: {node: '>=12'} diff --git a/frontend/src/store.tsx b/frontend/src/store.tsx index ee32f0f94..7ae281985 100644 --- a/frontend/src/store.tsx +++ b/frontend/src/store.tsx @@ -1,3 +1,5 @@ +import { compare } from 'compare-versions'; + import { InstallType, Plugin } from './plugin'; import { getSetting, setSetting } from './utils/settings'; @@ -126,7 +128,15 @@ export async function checkForUpdates(plugins: Plugin[]): Promise(); for (let plugin of plugins) { const remotePlugin = serverData?.find((x) => x.name == plugin.name); - if (remotePlugin && remotePlugin.versions?.length > 0 && plugin.version != remotePlugin?.versions?.[0]?.name) { + //FIXME: Ugly hack since plugin.version might be null during evaulation, + //so set the older version possible + const curVer = plugin.version ? plugin.version : '0.0'; + if ( + remotePlugin && + remotePlugin.versions?.length > 0 && + plugin.version != remotePlugin?.versions?.[0]?.name && + compare(remotePlugin?.versions?.[0]?.name, curVer, '>') + ) { updateMap.set(plugin.name, remotePlugin.versions[0]); } } diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000..7609098a3 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "decky-loader", + "lockfileVersion": 3, + "requires": true, + "packages": {} +}