From c336f0e7b722b59de22ab8b6fb1a520208c99478 Mon Sep 17 00:00:00 2001 From: rosalina Date: Sun, 14 Jan 2024 18:11:03 -0500 Subject: [PATCH] use s3si.ts fetcher and send a user agent --- src/app.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/app.ts b/src/app.ts index 4651e57..e040b35 100644 --- a/src/app.ts +++ b/src/app.ts @@ -10,6 +10,7 @@ import { delay, showError } from "./utils.ts"; import { GameFetcher } from "./GameFetcher.ts"; import { DEFAULT_ENV, Env } from "./env.ts"; import { SPLATOON3_TITLE_ID } from "./constant.ts"; +import { USERAGENT } from "./constant.ts"; export type Opts = { profilePath: string; @@ -400,11 +401,17 @@ export class App { } async monitorWithNxapi() { this.env.logger.debug("Monitoring with nxapi presence"); + const fetcher = this.env.newFetcher(); await this.exportOnce(); while (true) { await this.countDown(this.profile.state.monitorInterval); - const nxapiResponse = await fetch(this.opts.nxapiPresenceUrl!); + const nxapiResponse = await fetcher.get({ + url: this.opts.nxapiPresenceUrl!, + headers: { + "User-Agent": USERAGENT, + }, + }); const nxapiData = await nxapiResponse.json(); const isSplatoon3Active = nxapiData.title?.id === SPLATOON3_TITLE_ID; if (isSplatoon3Active || this.splatoon3PreviouslyActive) {