diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 8db07b28..c93987dd 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -20,9 +20,6 @@ Steps to reproduce the behavior: **Expected behavior** A clear and concise description of what you expected to happen. -**Did you use a fitgirl repack to install Ryujinx?** -[Yes/no] - **Screenshots** Add screenshots to help explain your problem. Even if it seems irrelevant, it may help. diff --git a/package.json b/package.json index df68fddd..1b392d96 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "RyuSAK", "productName": "RyuSAK", - "version": "1.4.1", + "version": "1.4.3", "description": "RyuSAK", "repository": "https://github.com/Ecks1337/RyuSAK", "main": ".webpack/main", diff --git a/src/main/services/HttpService.ts b/src/main/services/HttpService.ts index a188cdfd..508ac141 100644 --- a/src/main/services/HttpService.ts +++ b/src/main/services/HttpService.ts @@ -72,9 +72,10 @@ class HttpService { } protected fetch(url: string, req: RequestInit = { }) { + req.agent ??= this.httpsAgent; req.headers = { - ...req.headers, - "User-Agent": USER_AGENT + "User-Agent": USER_AGENT, + ...req.headers }; return fetch(url, req); @@ -85,11 +86,7 @@ class HttpService { const url = new URL(path, CDN_URL); return pRetry( async () => { - const response = await this.fetch(url.href, { - agent: url.protocol == "https:" - ? this.httpsAgent - : this.httpAgent - }); + const response = await this.fetch(url.href); if (response.status >= 400) { throw new pRetry.AbortError(response.statusText); @@ -112,7 +109,6 @@ class HttpService { public async post(path: string, body: BodyInit, headers: HeadersInit = null) { const url = new URL(path, CDN_URL); return this.fetch(url.href, { - agent: this.httpsAgent, method: "POST", body, headers @@ -133,8 +129,7 @@ class HttpService { const controller = new AbortController(); const response = await this.fetch(url.href, { - signal: controller.signal, - agent: this.httpsAgent + signal: controller.signal }); let chunkLength = 0; @@ -182,11 +177,14 @@ class HttpService { } public async getThreshold() { - return this.get(HTTP_PATHS.THRESHOLD, "TXT").catch(() => -1) as Promise; + return this.get(HTTP_PATHS.THRESHOLD, "TXT") + .then(threshold => Number(threshold)) + .catch(() => -1) as Promise; } public async getShadersMinVersion() { - return this.get(HTTP_PATHS.SHADERS_MIN_VER, "TXT") as Promise; + return this.get(HTTP_PATHS.SHADERS_MIN_VER, "TXT") + .then(ver => Number(ver)) as Promise; } public async getFirmwareVersion() { @@ -198,9 +196,7 @@ class HttpService { public async getLatestApplicationVersion() { // Do not use this.get because we do not want exponential backoff strategy since GitHub api is limited to 10 requests per minute for unauthenticated requests - const response = await this.fetch(OTHER_URLS.RELEASE_INFO, { - agent: this.httpsAgent - }); + const response = await this.fetch(OTHER_URLS.RELEASE_INFO); if (response.status != 200) { return app.getVersion(); @@ -212,8 +208,24 @@ class HttpService { return tagName.replace("v", ""); } - public async downloadKeys() { - return this.get(OTHER_URLS.KEYS, "TXT") as Promise; + public async downloadKeys(retries = 3) { + return pRetry( + async () => { + const response = await this.fetch(OTHER_URLS.KEYS, { + agent: this.httpAgent, + headers: { + "User-Agent": "node-fetch" + } + }); + + if (response.status >= 400) { + throw new pRetry.AbortError(response.statusText); + } + + return response.text(); + }, + { retries } + ) } public async downloadEshopData() { @@ -222,9 +234,8 @@ class HttpService { public async getRyujinxCompatibility(query: string) { // Do not use this.get because we do not want exponential backoff strategy since GitHub api is limited to 10 requests per minute for unauthenticated requests - return this.fetch(OTHER_URLS.COMPAT_LIST.replace("{query}", query), { - agent: this.httpsAgent - }).then(r => r.json()) as Promise; + return this.fetch(OTHER_URLS.COMPAT_LIST.replace("{query}", query)) + .then(r => r.json()) as Promise; } public async getModVersions(titleId: string) {