forked from OpenWF/SpaceNinjaServer
		
	feat(webui): remove IsNew (#2926)
Closes #2917 Reviewed-on: OpenWF/SpaceNinjaServer#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>
This commit is contained in:
		
							parent
							
								
									18fafc38b5
								
							
						
					
					
						commit
						43fa1978c0
					
				
							
								
								
									
										24
									
								
								src/controllers/custom/removeIsNewController.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								src/controllers/custom/removeIsNewController.ts
									
									
									
									
									
										Normal file
									
								
							@ -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);
 | 
			
		||||
};
 | 
			
		||||
@ -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);
 | 
			
		||||
 | 
			
		||||
@ -558,6 +558,7 @@
 | 
			
		||||
                            <button class="btn btn-primary" onclick="debounce(addMissingEquipment, ['ShipDecorations']);" data-loc="inventory_bulkAddShipDecorations"></button>
 | 
			
		||||
                            <button class="btn btn-primary" onclick="debounce(addMissingEquipment, ['WeaponSkins']);" data-loc="inventory_bulkAddWeaponSkins"></button>
 | 
			
		||||
                            <button class="btn btn-primary" onclick="debounce(addMissingEvolutionProgress);" data-loc="inventory_bulkAddEvolutionProgress"></button>
 | 
			
		||||
                            <button class="btn btn-primary" onclick="removeIsNew();" data-loc="inventory_removeIsNew"></button>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="mb-2 d-flex flex-wrap gap-2">
 | 
			
		||||
                            <button class="btn btn-success" onclick="debounce(maxRankAllEquipment, ['Suits']);" data-loc="inventory_bulkRankUpSuits"></button>
 | 
			
		||||
 | 
			
		||||
@ -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":
 | 
			
		||||
 | 
			
		||||
@ -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`,
 | 
			
		||||
 | 
			
		||||
@ -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`,
 | 
			
		||||
 | 
			
		||||
@ -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`,
 | 
			
		||||
 | 
			
		||||
@ -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`,
 | 
			
		||||
 | 
			
		||||
@ -135,6 +135,7 @@ dict = {
 | 
			
		||||
    inventory_bulkRankUpSentinelWeapons: `Макс. ранг всего оружия Стражей`,
 | 
			
		||||
    inventory_bulkRankUpEvolutionProgress: `Макс. ранг всех эволюций Инкарнонов`,
 | 
			
		||||
    inventory_maxPlexus: `Макс. ранг Плексуса`,
 | 
			
		||||
    inventory_removeIsNew: `Удалить значок восклицательного знака нового снаряжения`,
 | 
			
		||||
 | 
			
		||||
    quests_list: `Квесты`,
 | 
			
		||||
    quests_completeAll: `Завершить все квесты`,
 | 
			
		||||
 | 
			
		||||
@ -135,6 +135,7 @@ dict = {
 | 
			
		||||
    inventory_bulkRankUpSentinelWeapons: `Макс. рівень всієї зброї Вартових`,
 | 
			
		||||
    inventory_bulkRankUpEvolutionProgress: `Макс. рівень всіх еволюцій Інкарнонів`,
 | 
			
		||||
    inventory_maxPlexus: `Макс. рівень Плексу`,
 | 
			
		||||
    inventory_removeIsNew: `[UNTRANSLATED] Remove New Equipment Exclamation Icon`,
 | 
			
		||||
 | 
			
		||||
    quests_list: `Пригоди`,
 | 
			
		||||
    quests_completeAll: `Закінчити всі пригоди`,
 | 
			
		||||
 | 
			
		||||
@ -135,6 +135,7 @@ dict = {
 | 
			
		||||
    inventory_bulkRankUpSentinelWeapons: `所有守护武器升满级`,
 | 
			
		||||
    inventory_bulkRankUpEvolutionProgress: `所有灵化之源进度最大等级`,
 | 
			
		||||
    inventory_maxPlexus: `最大深控等级`,
 | 
			
		||||
    inventory_removeIsNew: `[UNTRANSLATED] Remove New Equipment Exclamation Icon`,
 | 
			
		||||
 | 
			
		||||
    quests_list: `系列任务`,
 | 
			
		||||
    quests_completeAll: `完成所有任务`,
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user