Skip to content

Commit 8ebd584

Browse files
committed
Use native fetch instead of node-fetch
1 parent a41f224 commit 8ebd584

File tree

3 files changed

+7
-53
lines changed

3 files changed

+7
-53
lines changed

package-lock.json

Lines changed: 0 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"dependencies": {
1313
"express": "^4.18.2",
1414
"express-async-handler": "^1.1.4",
15-
"node-fetch": "^2.6.7",
1615
"winston": "^3.3.3",
1716
"winston-daily-rotate-file": "^4.5.0"
1817
},

src/scratch-api.js

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
1-
const https = require('https');
2-
const fetch = require('node-fetch');
3-
41
const API = 'https://trampoline.turbowarp.org/proxy/projects/$id';
5-
const OPTIONS = {
6-
agent: new https.Agent({
7-
keepAlive: true
8-
}),
9-
headers: {
10-
referer: 'https://project-og.turbowarp.org'
11-
},
12-
timeout: 5000
13-
};
142

153
const getProjectMeta = async (id) => {
16-
const response = await fetch(API.replace('$id', id), OPTIONS);
4+
const response = await fetch(API.replace('$id', id), {
5+
keepalive: true,
6+
headers: {
7+
referer: 'https://project-og.turbowarp.org'
8+
},
9+
signal: AbortSignal.timeout(5000)
10+
});
1711
if (response.status === 404) {
1812
throw new Error('Project is unshared');
1913
}

0 commit comments

Comments
 (0)