forked from OpenWF/SpaceNinjaServer
		
	fix: compatibility with echoes of duviri (#1928)
Reviewed-on: OpenWF/SpaceNinjaServer#1928 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									3d6c880c96
								
							
						
					
					
						commit
						ed54e00a03
					
				@ -14,6 +14,7 @@ import { logger } from "@/src/utils/logger";
 | 
				
			|||||||
import { ExportFlavour } from "warframe-public-export-plus";
 | 
					import { ExportFlavour } from "warframe-public-export-plus";
 | 
				
			||||||
import { handleStoreItemAcquisition } from "@/src/services/purchaseService";
 | 
					import { handleStoreItemAcquisition } from "@/src/services/purchaseService";
 | 
				
			||||||
import { fromStoreItem, isStoreItem } from "@/src/services/itemDataService";
 | 
					import { fromStoreItem, isStoreItem } from "@/src/services/itemDataService";
 | 
				
			||||||
 | 
					import { IOid } from "@/src/types/commonTypes";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const inboxController: RequestHandler = async (req, res) => {
 | 
					export const inboxController: RequestHandler = async (req, res) => {
 | 
				
			||||||
    const { deleteId, lastMessage: latestClientMessageId, messageId } = req.query;
 | 
					    const { deleteId, lastMessage: latestClientMessageId, messageId } = req.query;
 | 
				
			||||||
@ -28,10 +29,10 @@ export const inboxController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        await deleteMessageRead(deleteId as string);
 | 
					        await deleteMessageRead(parseOid(deleteId as string));
 | 
				
			||||||
        res.status(200).end();
 | 
					        res.status(200).end();
 | 
				
			||||||
    } else if (messageId) {
 | 
					    } else if (messageId) {
 | 
				
			||||||
        const message = await getMessage(messageId as string);
 | 
					        const message = await getMessage(parseOid(messageId as string));
 | 
				
			||||||
        message.r = true;
 | 
					        message.r = true;
 | 
				
			||||||
        await message.save();
 | 
					        await message.save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -100,7 +101,7 @@ export const inboxController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
        await createNewEventMessages(req);
 | 
					        await createNewEventMessages(req);
 | 
				
			||||||
        const messages = await Inbox.find({ ownerId: accountId }).sort({ date: 1 });
 | 
					        const messages = await Inbox.find({ ownerId: accountId }).sort({ date: 1 });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const latestClientMessage = messages.find(m => m._id.toString() === latestClientMessageId);
 | 
					        const latestClientMessage = messages.find(m => m._id.toString() === parseOid(latestClientMessageId as string));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!latestClientMessage) {
 | 
					        if (!latestClientMessage) {
 | 
				
			||||||
            logger.debug(`this should only happen after DeleteAllRead `);
 | 
					            logger.debug(`this should only happen after DeleteAllRead `);
 | 
				
			||||||
@ -123,3 +124,11 @@ export const inboxController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
        res.json({ Inbox: inbox });
 | 
					        res.json({ Inbox: inbox });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// 33.6.0 has query arguments like lastMessage={"$oid":"68112baebf192e786d1502bb"} instead of lastMessage=68112baebf192e786d1502bb
 | 
				
			||||||
 | 
					const parseOid = (oid: string): string => {
 | 
				
			||||||
 | 
					    if (oid[0] == "{") {
 | 
				
			||||||
 | 
					        return (JSON.parse(oid) as IOid).$oid;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return oid;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -724,6 +724,11 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
 | 
				
			|||||||
        SyndicateMissions: [...staticWorldState.SyndicateMissions]
 | 
					        SyndicateMissions: [...staticWorldState.SyndicateMissions]
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Omit void fissures for versions prior to Whispers in the Walls to avoid errors with the unknown deimos nodes having void fissures.
 | 
				
			||||||
 | 
					    if (buildLabel && version_compare(buildLabel, "2023.11.06.13.39") <= 0) {
 | 
				
			||||||
 | 
					        worldState.ActiveMissions = [];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (config.worldState?.starDays) {
 | 
					    if (config.worldState?.starDays) {
 | 
				
			||||||
        worldState.Goals.push({
 | 
					        worldState.Goals.push({
 | 
				
			||||||
            _id: { $oid: "67a4dcce2a198564d62e1647" },
 | 
					            _id: { $oid: "67a4dcce2a198564d62e1647" },
 | 
				
			||||||
@ -1227,3 +1232,20 @@ export const isArchwingMission = (node: IRegion): boolean => {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    return false;
 | 
					    return false;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const version_compare = (a: string, b: string): number => {
 | 
				
			||||||
 | 
					    const a_digits = a
 | 
				
			||||||
 | 
					        .split("/")[0]
 | 
				
			||||||
 | 
					        .split(".")
 | 
				
			||||||
 | 
					        .map(x => parseInt(x));
 | 
				
			||||||
 | 
					    const b_digits = b
 | 
				
			||||||
 | 
					        .split("/")[0]
 | 
				
			||||||
 | 
					        .split(".")
 | 
				
			||||||
 | 
					        .map(x => parseInt(x));
 | 
				
			||||||
 | 
					    for (let i = 0; i != a_digits.length; ++i) {
 | 
				
			||||||
 | 
					        if (a_digits[i] != b_digits[i]) {
 | 
				
			||||||
 | 
					            return a_digits[i] > b_digits[i] ? 1 : -1;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return 0;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -10,6 +10,7 @@ export interface IWorldState {
 | 
				
			|||||||
    LiteSorties: ILiteSortie[];
 | 
					    LiteSorties: ILiteSortie[];
 | 
				
			||||||
    SyndicateMissions: ISyndicateMissionInfo[];
 | 
					    SyndicateMissions: ISyndicateMissionInfo[];
 | 
				
			||||||
    GlobalUpgrades: IGlobalUpgrade[];
 | 
					    GlobalUpgrades: IGlobalUpgrade[];
 | 
				
			||||||
 | 
					    ActiveMissions: IFissure[];
 | 
				
			||||||
    NodeOverrides: INodeOverride[];
 | 
					    NodeOverrides: INodeOverride[];
 | 
				
			||||||
    EndlessXpChoices: IEndlessXpChoice[];
 | 
					    EndlessXpChoices: IEndlessXpChoice[];
 | 
				
			||||||
    SeasonInfo: {
 | 
					    SeasonInfo: {
 | 
				
			||||||
@ -71,6 +72,18 @@ export interface IGlobalUpgrade {
 | 
				
			|||||||
    LocalizeDescTag: string;
 | 
					    LocalizeDescTag: string;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface IFissure {
 | 
				
			||||||
 | 
					    _id: IOid;
 | 
				
			||||||
 | 
					    Region: number;
 | 
				
			||||||
 | 
					    Seed: number;
 | 
				
			||||||
 | 
					    Activation: IMongoDate;
 | 
				
			||||||
 | 
					    Expiry: IMongoDate;
 | 
				
			||||||
 | 
					    Node: string;
 | 
				
			||||||
 | 
					    MissionType: string;
 | 
				
			||||||
 | 
					    Modifier: string;
 | 
				
			||||||
 | 
					    Hard?: boolean;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface INodeOverride {
 | 
					export interface INodeOverride {
 | 
				
			||||||
    _id: IOid;
 | 
					    _id: IOid;
 | 
				
			||||||
    Activation?: IMongoDate;
 | 
					    Activation?: IMongoDate;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user