From 43fa1978c068c2929a113ad8b45ba4c62b4e116e Mon Sep 17 00:00:00 2001 From: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Date: Thu, 23 Oct 2025 23:21:37 -0700 Subject: [PATCH] feat(webui): remove IsNew (#2926) Closes #2917 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2926 Reviewed-by: Sainan <63328889+sainan@users.noreply.github.com> Co-authored-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Co-committed-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> --- .../custom/removeIsNewController.ts | 24 +++++++++++++++++++ src/routes/custom.ts | 2 ++ static/webui/index.html | 1 + static/webui/script.js | 9 +++++++ static/webui/translations/de.js | 1 + static/webui/translations/en.js | 1 + static/webui/translations/es.js | 1 + static/webui/translations/fr.js | 1 + static/webui/translations/ru.js | 1 + static/webui/translations/uk.js | 1 + static/webui/translations/zh.js | 1 + 11 files changed, 43 insertions(+) create mode 100644 src/controllers/custom/removeIsNewController.ts diff --git a/src/controllers/custom/removeIsNewController.ts b/src/controllers/custom/removeIsNewController.ts new file mode 100644 index 00000000..e63a0d0a --- /dev/null +++ b/src/controllers/custom/removeIsNewController.ts @@ -0,0 +1,24 @@ +import { getInventory } from "../../services/inventoryService.ts"; +import { getAccountIdForRequest } from "../../services/loginService.ts"; +import type { RequestHandler } from "express"; +import { equipmentKeys } from "../../types/inventoryTypes/inventoryTypes.ts"; +import { broadcastInventoryUpdate } from "../../services/wsService.ts"; + +export const removeIsNewController: RequestHandler = async (req, res) => { + const accountId = await getAccountIdForRequest(req); + const filteredEquipmentKeys = equipmentKeys.filter(k => k !== "CrewShipWeapons" && k !== "CrewShipSalvagedWeapons"); + const inventory = await getInventory(accountId, [...filteredEquipmentKeys, "WeaponSkins"].join(" ")); + for (const key of filteredEquipmentKeys) { + if (key in inventory) { + for (const equipment of inventory[key]) { + if (equipment.IsNew) equipment.IsNew = false; + } + } + } + for (const equipment of inventory.WeaponSkins) { + if (equipment.IsNew) equipment.IsNew = false; + } + await inventory.save(); + res.end(); + broadcastInventoryUpdate(req); +}; diff --git a/src/routes/custom.ts b/src/routes/custom.ts index cf1785f0..05747f5a 100644 --- a/src/routes/custom.ts +++ b/src/routes/custom.ts @@ -22,6 +22,7 @@ import { unlockAllScansController } from "../controllers/custom/unlockAllScansCo import { unlockAllShipFeaturesController } from "../controllers/custom/unlockAllShipFeaturesController.ts"; import { unlockAllCapturaScenesController } from "../controllers/custom/unlockAllCapturaScenesController.ts"; import { removeCustomizationController } from "../controllers/custom/removeCustomizationController.ts"; +import { removeIsNewController } from "../controllers/custom/removeIsNewController.ts"; import { abilityOverrideController } from "../controllers/custom/abilityOverrideController.ts"; import { createAccountController } from "../controllers/custom/createAccountController.ts"; @@ -73,6 +74,7 @@ customRouter.get("/unlockAllScans", unlockAllScansController); customRouter.get("/unlockAllShipFeatures", unlockAllShipFeaturesController); customRouter.get("/unlockAllCapturaScenes", unlockAllCapturaScenesController); customRouter.get("/removeCustomization", removeCustomizationController); +customRouter.get("/removeIsNew", removeIsNewController); customRouter.post("/abilityOverride", abilityOverrideController); customRouter.post("/createAccount", createAccountController); diff --git a/static/webui/index.html b/static/webui/index.html index e7acd146..b14e004b 100644 --- a/static/webui/index.html +++ b/static/webui/index.html @@ -558,6 +558,7 @@ +
diff --git a/static/webui/script.js b/static/webui/script.js index 697631cd..a648b6ea 100644 --- a/static/webui/script.js +++ b/static/webui/script.js @@ -2177,6 +2177,15 @@ function removeCustomization(uniqueName) { }); } +function removeIsNew() { + revalidateAuthz().then(() => { + const req = $.get("/custom/removeIsNew?" + window.authz); + req.done(() => { + updateInventory(); + }); + }); +} + function getRequiredParts(category, WeaponType) { switch (category) { case "Hoverboards": diff --git a/static/webui/translations/de.js b/static/webui/translations/de.js index fc563086..8f2f97a3 100644 --- a/static/webui/translations/de.js +++ b/static/webui/translations/de.js @@ -135,6 +135,7 @@ dict = { inventory_bulkRankUpSentinelWeapons: `Alle Wächter-Waffen auf Max. Rang`, inventory_bulkRankUpEvolutionProgress: `Alle Incarnon-Entwicklungsfortschritte auf Max. Rang`, inventory_maxPlexus: `Plexus auf Max. Rang`, + inventory_removeIsNew: `[UNTRANSLATED] Remove New Equipment Exclamation Icon`, quests_list: `Quests`, quests_completeAll: `Alle Quests abschließen`, diff --git a/static/webui/translations/en.js b/static/webui/translations/en.js index e27d56bb..7a0af074 100644 --- a/static/webui/translations/en.js +++ b/static/webui/translations/en.js @@ -134,6 +134,7 @@ dict = { inventory_bulkRankUpSentinelWeapons: `Max Rank All Sentinel Weapons`, inventory_bulkRankUpEvolutionProgress: `Max Rank All Incarnon Evolution Progress`, inventory_maxPlexus: `Max Rank Plexus`, + inventory_removeIsNew: `Remove New Equipment Exclamation Icon`, quests_list: `Quests`, quests_completeAll: `Complete All Quests`, diff --git a/static/webui/translations/es.js b/static/webui/translations/es.js index 85a87227..58eab8c8 100644 --- a/static/webui/translations/es.js +++ b/static/webui/translations/es.js @@ -135,6 +135,7 @@ dict = { inventory_bulkRankUpSentinelWeapons: `Maximizar rango de todas las armas de centinela`, inventory_bulkRankUpEvolutionProgress: `Maximizar todo el progreso de evolución Incarnon`, inventory_maxPlexus: `Rango máximo de Plexus`, + inventory_removeIsNew: `[UNTRANSLATED] Remove New Equipment Exclamation Icon`, quests_list: `Misiones`, quests_completeAll: `Completar todas las misiones`, diff --git a/static/webui/translations/fr.js b/static/webui/translations/fr.js index 9f897bf8..3fa19019 100644 --- a/static/webui/translations/fr.js +++ b/static/webui/translations/fr.js @@ -135,6 +135,7 @@ dict = { inventory_bulkRankUpSentinelWeapons: `Toutes les armes de Sentinelles au rang max`, inventory_bulkRankUpEvolutionProgress: `Toutes les évolutions Incarnon au rang max`, inventory_maxPlexus: `Plexus au rang max`, + inventory_removeIsNew: `[UNTRANSLATED] Remove New Equipment Exclamation Icon`, quests_list: `Quêtes`, quests_completeAll: `Compléter toutes les quêtes`, diff --git a/static/webui/translations/ru.js b/static/webui/translations/ru.js index f9b742a3..bb80e3ed 100644 --- a/static/webui/translations/ru.js +++ b/static/webui/translations/ru.js @@ -135,6 +135,7 @@ dict = { inventory_bulkRankUpSentinelWeapons: `Макс. ранг всего оружия Стражей`, inventory_bulkRankUpEvolutionProgress: `Макс. ранг всех эволюций Инкарнонов`, inventory_maxPlexus: `Макс. ранг Плексуса`, + inventory_removeIsNew: `Удалить значок восклицательного знака нового снаряжения`, quests_list: `Квесты`, quests_completeAll: `Завершить все квесты`, diff --git a/static/webui/translations/uk.js b/static/webui/translations/uk.js index 6d3752a7..e36a9939 100644 --- a/static/webui/translations/uk.js +++ b/static/webui/translations/uk.js @@ -135,6 +135,7 @@ dict = { inventory_bulkRankUpSentinelWeapons: `Макс. рівень всієї зброї Вартових`, inventory_bulkRankUpEvolutionProgress: `Макс. рівень всіх еволюцій Інкарнонів`, inventory_maxPlexus: `Макс. рівень Плексу`, + inventory_removeIsNew: `[UNTRANSLATED] Remove New Equipment Exclamation Icon`, quests_list: `Пригоди`, quests_completeAll: `Закінчити всі пригоди`, diff --git a/static/webui/translations/zh.js b/static/webui/translations/zh.js index 4ff32e50..e856f8b9 100644 --- a/static/webui/translations/zh.js +++ b/static/webui/translations/zh.js @@ -135,6 +135,7 @@ dict = { inventory_bulkRankUpSentinelWeapons: `所有守护武器升满级`, inventory_bulkRankUpEvolutionProgress: `所有灵化之源进度最大等级`, inventory_maxPlexus: `最大深控等级`, + inventory_removeIsNew: `[UNTRANSLATED] Remove New Equipment Exclamation Icon`, quests_list: `系列任务`, quests_completeAll: `完成所有任务`,