From cbe6737560b9a19448e8ab68767fb0147351ff81 Mon Sep 17 00:00:00 2001 From: O3H Date: Thu, 17 Oct 2024 20:32:52 +0100 Subject: [PATCH] use multiple mod exceptions, not just r2 --- backend/thunderstore/api.go | 18 +++++++++++++++++- backend/util.go | 12 ++++++++++++ frontend/src/App.vue | 1 + frontend/src/views/GameSelection.vue | 2 +- 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/backend/thunderstore/api.go b/backend/thunderstore/api.go index 9acb26a..9cb6057 100644 --- a/backend/thunderstore/api.go +++ b/backend/thunderstore/api.go @@ -19,6 +19,22 @@ import ( v1 "github.com/the-egg-corp/thundergo/v1" ) +var modExceptions = []string{ + "Foldex-r2mod_cli", + "ebkr-r2modman", + "ebkr-r2modman_dsp", + "ebkr-BT2TS", + "ethanbrews-RiskOfRainModManager", + "ethanbrews-Forecast_Mod_Manager", + "scottbot95-RoR2ModManager", + "HoodedDeath-RiskOfDeathModManager", + "MythicManiac-MythicModManager", + "Kesomannen-GaleModManager", + "Elaviers-GCManager", + "MADH95Mods-JSONRenameUtility", + "Higgs1-Lighthouse", +} + var CurModCacheDir string func ModCacheDir(gameTitle string) string { @@ -134,7 +150,7 @@ func (a *API) GetStrippedPackages(community string, skipCache bool) ([]StrippedP // Loops over all pkgs, stripping some unecessary fields, massively improving // time to serialize/deserialize to avoid blocking the frontend. for _, pkg := range pkgs { - if strings.EqualFold(pkg.Name, "r2modman") { + if backend.ContainsEqualFold(modExceptions, pkg.Name) { continue } diff --git a/backend/util.go b/backend/util.go index 43b0ace..0da539e 100644 --- a/backend/util.go +++ b/backend/util.go @@ -50,3 +50,15 @@ func ReadFile(path string) (*string, error) { out := string(content) return &out, nil } + +func ContainsEqualFold(arr []string, item string) bool { + lowerItem := strings.ToLower(item) + + for _, str := range arr { + if strings.ToLower(str) == lowerItem { + return true + } + } + + return false +} diff --git a/frontend/src/App.vue b/frontend/src/App.vue index d15f5f6..38aec34 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -23,6 +23,7 @@ onMounted(async () => { const settings = await GetSettings() changeLocale(settings.general.locale) + // We don't use `navigator.hardwareConcurrency` as it is known to be unreliable. setMaxThreads(await NumCPU()) }) diff --git a/frontend/src/views/GameSelection.vue b/frontend/src/views/GameSelection.vue index 11a1942..4fe8ab5 100644 --- a/frontend/src/views/GameSelection.vue +++ b/frontend/src/views/GameSelection.vue @@ -155,7 +155,7 @@ const handleScroll = (e: WheelEvent) => { scrollIndex.value-- } - // Scroll to the corresponding section + // Scroll to the next div element in game list. nextTick(() => scrollToGame()) }