chore: removed axios (#7685)

* chore: removed axios

* chore: pnpm
This commit is contained in:
SamTV12345 2026-05-06 22:06:04 +02:00 committed by GitHub
parent 6c7598d88b
commit bfdbd2bb91
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 164 additions and 176 deletions

View file

@ -27,7 +27,7 @@ import {ErrorCaused} from "./types/ErrorCaused";
import log4js from 'log4js';
import pkg from '../package.json';
import {checkForMigration} from "../static/js/pluginfw/installer";
import axios from "axios";
import {ProxyAgent, setGlobalDispatcher} from 'undici';
import settings from './utils/Settings';
@ -38,28 +38,10 @@ if (settings.dumpOnUncleanExit) {
wtfnode = require('wtfnode');
}
const addProxyToAxios = (url: URL) => {
axios.defaults.proxy = {
host: url.hostname,
auth: {
username: url.username,
password: url.password,
},
port: Number(url.port),
protocol: url.protocol,
}
}
if(process.env['http_proxy']) {
console.log("Using proxy: " + process.env['http_proxy'])
addProxyToAxios(new URL(process.env['http_proxy']));
}
if (process.env['https_proxy']) {
console.log("Using proxy: " + process.env['https_proxy'])
addProxyToAxios(new URL(process.env['https_proxy']));
const proxyUrl = process.env['https_proxy'] || process.env['http_proxy'];
if (proxyUrl) {
console.log("Using proxy: " + proxyUrl);
setGlobalDispatcher(new ProxyAgent(proxyUrl));
}

View file

@ -1,7 +1,6 @@
'use strict';
import semver from 'semver';
import settings, {getEpVersion} from './Settings';
import axios from 'axios';
const headers = {
'User-Agent': 'Etherpad/' + getEpVersion(),
}
@ -20,9 +19,10 @@ const loadEtherpadInformations = () => {
return infos;
}
return axios.get(`${settings.updateServer}/info.json`, {headers: headers})
.then(async (resp: any) => {
infos = await resp.data;
return fetch(`${settings.updateServer}/info.json`, {headers})
.then(async (resp) => {
if (!resp.ok) throw new Error(`HTTP ${resp.status} ${resp.statusText}`);
infos = await resp.json() as Infos;
if (infos === undefined || infos === null) {
await Promise.reject("Could not retrieve current version")
return