1 files changed, 3 insertions, 8 deletions
diff --git a/src/util/util/AutoUpdate.ts b/src/util/util/AutoUpdate.ts
index e62a5c50..efd0954e 100644
--- a/src/util/util/AutoUpdate.ts
+++ b/src/util/util/AutoUpdate.ts
@@ -16,12 +16,9 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import fetch from "node-fetch-commonjs";
-import { ProxyAgent } from "proxy-agent";
import readline from "readline";
import fs from "fs/promises";
import path from "path";
-import http from "http";
const rl = readline.createInterface({
input: process.stdin,
@@ -74,9 +71,8 @@ async function download(url: string, dir: string) {
try {
// TODO: use file stream instead of buffer (to prevent crash because of high memory usage for big files)
// TODO check file hash
- const agent = new ProxyAgent();
- const response = await fetch(url, { agent: agent as http.Agent });
- const buffer = await response.buffer();
+ const response = await fetch(url);
+ const buffer = await response.bytes();
const tempDir = await fs.mkdtemp("spacebar");
await fs.writeFile(path.join(tempDir, "Spacebar.zip"), buffer);
} catch (error) {
@@ -97,8 +93,7 @@ async function getCurrentVersion(dir: string) {
async function getLatestVersion(url: string) {
try {
- const agent = new ProxyAgent();
- const response = await fetch(url, { agent: agent as http.Agent });
+ const response = await fetch(url);
const content = (await response.json()) as { version: string };
return content.version;
} catch (error) {
|