mirror of
https://github.com/ether/etherpad-lite.git
synced 2026-07-18 00:57:55 +00:00
parent
6c7598d88b
commit
bfdbd2bb91
14 changed files with 164 additions and 176 deletions
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue