Skip to content

Commit 2443fc4

Browse files
authored
feat: use new origin proxy url (#282)
1 parent adcb8b7 commit 2443fc4

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

.github/workflows/update-items.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ jobs:
3333
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
3434
DISCORD_ADMIN_IDS: ${{ secrets.DISCORD_ADMIN_IDS }}
3535
FORCE_UPLOAD: ${{ contains(github.event.head_commit.message, 'force upload') && github.event_name == 'push' }}
36-
PROXY_AUTH: ${{ secrets.PROXY_AUTH }}
36+
WARFRAME_ORIGIN_PROXY: ${{ secrets.WARFRAME_ORIGIN_PROXY }}
37+
X_PROXY_TOKEN: ${{ secrets.X_PROXY_TOKEN }}
3738
- name: Authenticate Firebase
3839
uses: 'google-github-actions/auth@v2'
3940
with:

updater/warframe_exports.mjs

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import fetch from "node-fetch";
22
import lzma from "lzma";
33

44
const CONTENT_URL = "https://content.warframe.com";
5-
const ORIGIN_URL = process.env.PROXY_AUTH
6-
? "https://wf-origin-proxy.aericio.workers.dev"
7-
: "https://origin.warframe.com";
5+
const ORIGIN_URL =
6+
process.env.WARFRAME_ORIGIN_PROXY ?? "https://origin.warframe.com";
87

98
let endpoints;
109

@@ -13,18 +12,24 @@ function parseDamagedJSON(json) {
1312
}
1413

1514
async function fetchEndpoints() {
15+
const headers = {};
16+
17+
if (process.env.X_PROXY_TOKEN) {
18+
headers["X-Proxy-Token"] = process.env.X_PROXY_TOKEN;
19+
}
20+
21+
const response = await fetch(`${ORIGIN_URL}/PublicExport/index_en.txt.lzma`, {
22+
headers
23+
});
24+
25+
if (!response.ok) {
26+
throw new Error(
27+
`Failed to fetch endpoints: ${response.status} ${response.statusText}`
28+
);
29+
}
30+
1631
endpoints = lzma
17-
.decompress(
18-
Buffer.from(
19-
await (
20-
await fetch(`${ORIGIN_URL}/PublicExport/index_en.txt.lzma`, {
21-
headers: {
22-
Authentication: process.env.PROXY_AUTH
23-
}
24-
})
25-
).arrayBuffer()
26-
)
27-
)
32+
.decompress(Buffer.from(await response.arrayBuffer()))
2833
.split("\n");
2934
}
3035

0 commit comments

Comments
 (0)