Skip to content

Commit

Permalink
Update starrail warp api url endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinovantes committed Aug 7, 2024
1 parent 617ea0f commit 9621c1b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/ipc/WarpTracker/WarpTrackerModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function createActionHandlers(logger: LogFunctions, db: Awaited<ReturnType<typeo

let endId: WarpId | undefined
while (true) {
const warps = await fetchWarpHistory(bannerType, authKey, endId, logger)
const warps = await fetchWarpHistory(logger, bannerType, authKey, endId)

// Save search state before inserting
endId = warps.at(-1)?.id
Expand Down
4 changes: 2 additions & 2 deletions src/main/ipc/WarpTracker/fetchWarpHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ function getWarpHistoryResponseValidationErrors(obj: unknown): Array<ValueError>
// Export
// ----------------------------------------------------------------------------

export async function fetchWarpHistory(bannerType: GachaBannerType, authKey: string, endId?: string, logger?: LogFunctions): Promise<Array<Warp>> {
const url = new URL('https://api-os-takumi.mihoyo.com/common/gacha_record/api/getGachaLog')
export async function fetchWarpHistory(logger: LogFunctions, bannerType: GachaBannerType, authKey: string, endId?: string): Promise<Array<Warp>> {
const url = new URL('https://public-operation-hkrpg-sg.hoyoverse.com/common/gacha_record/api/getGachaLog')
url.searchParams.append('size', '20')
url.searchParams.append('game_biz', 'hkrpg_global')
url.searchParams.append('lang', 'en')
Expand Down
4 changes: 2 additions & 2 deletions src/main/ipc/WarpTracker/getAuthKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function getAuthKey(gameDir: string, isWsl: boolean, logger?: LogFunction

let gachaLogUrl: string | null = null
for (const match of contents.matchAll(gachaLogRe)) {
gachaLogUrl = match[0]
gachaLogUrl = match[0] // Save last url as that's the most recent
}

if (!gachaLogUrl) {
Expand All @@ -27,6 +27,6 @@ export function getAuthKey(gameDir: string, isWsl: boolean, logger?: LogFunction
throw new Error(errMsg)
}

logger?.info('Found authKey', authKey.length)
logger?.info('Found authKey', `len:${authKey.length}`)
return authKey
}

0 comments on commit 9621c1b

Please sign in to comment.