diff options
Diffstat (limited to 'src-vue/src/utils/thunderstore')
-rw-r--r-- | src-vue/src/utils/thunderstore/ThunderstoreModStatus.ts | 7 | ||||
-rw-r--r-- | src-vue/src/utils/thunderstore/version.ts | 33 |
2 files changed, 0 insertions, 40 deletions
diff --git a/src-vue/src/utils/thunderstore/ThunderstoreModStatus.ts b/src-vue/src/utils/thunderstore/ThunderstoreModStatus.ts deleted file mode 100644 index f2351226..00000000 --- a/src-vue/src/utils/thunderstore/ThunderstoreModStatus.ts +++ /dev/null @@ -1,7 +0,0 @@ -export enum ThunderstoreModStatus { - INSTALLED, - BEING_INSTALLED, - BEING_UPDATED, - NOT_INSTALLED, - OUTDATED -} diff --git a/src-vue/src/utils/thunderstore/version.ts b/src-vue/src/utils/thunderstore/version.ts deleted file mode 100644 index a111e08c..00000000 --- a/src-vue/src/utils/thunderstore/version.ts +++ /dev/null @@ -1,33 +0,0 @@ -import {ThunderstoreMod} from "../../../../src-tauri/bindings/ThunderstoreMod"; -import {NorthstarMod} from "../../../../src-tauri/bindings/NorthstarMod"; -import {store} from "../../plugins/store"; - -/** - * Strips off a Thunderstore dependency string from its version - * (e.g. "taskinoz-WallrunningTitans-1.0.0" to - * "taskinoz-WallrunningTitans"). - **/ -function getThunderstoreDependencyStringPrefix(dependency: string): string { - const dependencyStringMembers = dependency.split('-'); - return `${dependencyStringMembers[0]}-${dependencyStringMembers[1]}`; -} - -function isThunderstoreModOutdated(mod: ThunderstoreMod): boolean { - // Ensure mod is up-to-date. - const tsModPrefix = getThunderstoreDependencyStringPrefix(mod.versions[0].full_name); - const matchingMods: NorthstarMod[] = store.state.installed_mods.filter((mod: NorthstarMod) => { - if (!mod.thunderstore_mod_string) return false; - return getThunderstoreDependencyStringPrefix(mod.thunderstore_mod_string!) === tsModPrefix; - }); - if (matchingMods.length !== 0) { - // There shouldn't be several mods with same dependency string, but we never know... - const matchingMod = matchingMods[0]; - // A mod is outdated if its dependency strings differs from Thunderstore dependency string - // (no need for semver check here). - // This assumes mod versions list is sorted from newest to oldest version. - return matchingMod.thunderstore_mod_string !== mod.versions[0].full_name; - } - return false; -} - -export { isThunderstoreModOutdated }; |