Skip to content

Commit d06b77c

Browse files
committed
Ensure HTTPS is used for Speedrun.com Pagination
Apparently their API returns HTTP links for pagination, which seems to get blocked nowadays. This forces the use of HTTPS for those links.
1 parent 66018ed commit d06b77c

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

buildCore.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ let profile = "debug";
66
let cargoFlags = "";
77
// Keep .github/workflows/ci.yml in sync with these flags, so wasm-opt works.
88
let rustFlags =
9-
"-C target-feature=+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,+simd128,+extended-const,+multivalue,+reference-types,+tail-call";
9+
"-C target-feature=+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext,+simd128,+extended-const,+multivalue,+reference-types,+tail-call";
1010
let wasmBindgenFlags = "--encode-into always --target web --reference-types";
1111
let target = "wasm32-unknown-unknown";
1212
let targetFolder = target;
@@ -37,7 +37,7 @@ if (process.argv.some((v) => v === "--unstable")) {
3737
if (process.argv.some((v) => v === "--nightly")) {
3838
toolchain = "+nightly";
3939
cargoFlags +=
40-
" -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort";
40+
" -Z build-std=std,panic_abort -Z unstable-options -C panic=immediate-abort";
4141
rustFlags += " -Z wasm-c-abi=spec";
4242

4343
// FIXME: Apparently the multivalue ABI is broken again.
@@ -71,20 +71,20 @@ execSync(
7171
...process.env,
7272
RUSTFLAGS: rustFlags,
7373
},
74-
}
74+
},
7575
);
7676

7777
execSync(
7878
`wasm-bindgen ${wasmBindgenFlags} livesplit-core/target/${targetFolder}/${profile}/livesplit_core.wasm --out-dir src/livesplit-core`,
7979
{
8080
stdio: "inherit",
81-
}
81+
},
8282
);
8383

8484
fs.createReadStream(
85-
"livesplit-core/capi/bindings/wasm_bindgen/web/index.ts"
85+
"livesplit-core/capi/bindings/wasm_bindgen/web/index.ts",
8686
).pipe(fs.createWriteStream("src/livesplit-core/index.ts"));
8787

8888
fs.createReadStream(
89-
"livesplit-core/capi/bindings/wasm_bindgen/web/preload.ts"
89+
"livesplit-core/capi/bindings/wasm_bindgen/web/preload.ts",
9090
).pipe(fs.createWriteStream("src/livesplit-core/preload.ts"));

src/api/SpeedrunCom.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,9 @@ async function executePaginatedRequest<T>(uri: string): Promise<Page<T>> {
316316
if (pagination.links != null) {
317317
const nextLink = pagination.links.find((l: any) => l.rel === "next");
318318
if (nextLink != null) {
319-
const link = nextLink.uri as string;
320-
next = () => executePaginatedRequest<T>(link);
319+
const link = new URL(nextLink.uri as string);
320+
link.protocol = "https:"; // Ensure HTTPS, their API seems to return HTTP links.
321+
next = () => executePaginatedRequest<T>(link.toString());
321322
}
322323
}
323324
return new Page(data as T[], next);

0 commit comments

Comments
 (0)