mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 23:53:13 +09:00
Replace remaining usage of phin (#862)
Replace the remaining places in the codebase using phin with fetch. With the exception of HttpCloser which uses the http/https request method instead.
This commit is contained in:
1 parent
ef0baaa30f
commit
05b6bf8c04
13 files changed
+91
-102
No files matched your search
@@ -4,7 +4,6 @@ const fs = require("fs-extra");
|
||||
const jwt = require("jsonwebtoken");
|
||||
const path = require("path");
|
||||
const events = require("events");
|
||||
const phin = require("phin");
|
||||
|
||||
const lib = require("@clusterio/lib");
|
||||
const libBuildMod = require("@clusterio/lib/build_mod");
|
||||
@@ -79,16 +78,15 @@ async function runWithAltHost(callback) {
|
||||
}
|
||||
|
||||
async function uploadSave(instanceId, name, content) {
|
||||
return await phin({
|
||||
url: `https://localhost:4443/api/upload-save?instance_id=${instanceId}&filename=${name}`,
|
||||
const uploadUrl = `https://localhost:4443/api/upload-save?instance_id=${instanceId}&filename=${name}`;
|
||||
return await fetch(uploadUrl, {
|
||||
method: "POST",
|
||||
core: { rejectUnauthorized: false },
|
||||
headers: {
|
||||
"X-Access-Token": controlToken,
|
||||
"Content-Type": "application/zip",
|
||||
"Content-Length": String(content.length),
|
||||
},
|
||||
data: content,
|
||||
body: content,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user