Added authentication to axios.defaults.proxy

This commit is contained in:
SamTV12345 2025-04-08 18:40:00 +02:00
parent 77792a5f7f
commit 9a97760ede
4 changed files with 15 additions and 5 deletions

7
pnpm-lock.yaml generated
View file

@ -182,6 +182,9 @@ importers:
http-errors: http-errors:
specifier: ^2.0.0 specifier: ^2.0.0
version: 2.0.0 version: 2.0.0
https-proxy-agent:
specifier: ^7.0.6
version: 7.0.6
jose: jose:
specifier: ^5.10.0 specifier: ^5.10.0
version: 5.10.0 version: 5.10.0
@ -7510,7 +7513,7 @@ snapshots:
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
eslint-module-utils@2.12.0(@typescript-eslint/parser@7.18.0(eslint@9.24.0)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.0)(eslint@9.24.0): eslint-module-utils@2.12.0(@typescript-eslint/parser@7.18.0(eslint@9.24.0)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.0(eslint-plugin-import@2.31.0)(eslint@9.24.0))(eslint@9.24.0):
dependencies: dependencies:
debug: 3.2.7 debug: 3.2.7
optionalDependencies: optionalDependencies:
@ -7550,7 +7553,7 @@ snapshots:
doctrine: 2.1.0 doctrine: 2.1.0
eslint: 9.24.0 eslint: 9.24.0
eslint-import-resolver-node: 0.3.9 eslint-import-resolver-node: 0.3.9
eslint-module-utils: 2.12.0(@typescript-eslint/parser@7.18.0(eslint@9.24.0)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.0)(eslint@9.24.0) eslint-module-utils: 2.12.0(@typescript-eslint/parser@7.18.0(eslint@9.24.0)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.0(eslint-plugin-import@2.31.0)(eslint@9.24.0))(eslint@9.24.0)
hasown: 2.0.2 hasown: 2.0.2
is-core-module: 2.16.1 is-core-module: 2.16.1
is-glob: 4.0.3 is-glob: 4.0.3

View file

@ -42,6 +42,10 @@ if (settings.dumpOnUncleanExit) {
const addProxyToAxios = (url: URL) => { const addProxyToAxios = (url: URL) => {
axios.defaults.proxy = { axios.defaults.proxy = {
host: url.hostname, host: url.hostname,
auth: {
username: url.username,
password: url.password,
},
port: Number(url.port), port: Number(url.port),
protocol: url.protocol, protocol: url.protocol,
} }

View file

@ -44,11 +44,13 @@
"find-root": "1.1.0", "find-root": "1.1.0",
"formidable": "^3.5.2", "formidable": "^3.5.2",
"http-errors": "^2.0.0", "http-errors": "^2.0.0",
"https-proxy-agent": "^7.0.6",
"jose": "^5.10.0", "jose": "^5.10.0",
"js-cookie": "^3.0.5", "js-cookie": "^3.0.5",
"jsdom": "^26.0.0", "jsdom": "^26.0.0",
"jsonminify": "0.4.2", "jsonminify": "0.4.2",
"jsonwebtoken": "^9.0.2", "jsonwebtoken": "^9.0.2",
"jwt-decode": "^4.0.0",
"languages4translatewiki": "0.1.3", "languages4translatewiki": "0.1.3",
"live-plugin-manager": "^1.0.0", "live-plugin-manager": "^1.0.0",
"lodash.clonedeep": "4.5.0", "lodash.clonedeep": "4.5.0",
@ -70,7 +72,6 @@
"socket.io-client": "^4.8.1", "socket.io-client": "^4.8.1",
"superagent": "10.2.0", "superagent": "10.2.0",
"swagger-ui-express": "^5.0.1", "swagger-ui-express": "^5.0.1",
"jwt-decode": "^4.0.0",
"tinycon": "0.6.8", "tinycon": "0.6.8",
"tsx": "4.19.3", "tsx": "4.19.3",
"ueberdb2": "^5.0.6", "ueberdb2": "^5.0.6",

View file

@ -172,12 +172,14 @@ export const getAvailablePlugins = (maxCacheAge: number|false) => {
} }
await axios.get(`${settings.updateServer}/plugins.json`, {headers}) await axios.get(`${settings.updateServer}/plugins.json`, {headers})
.then((pluginsLoaded:AxiosResponse<MapArrayType<PackageInfo>>) => { .then((pluginsLoaded: AxiosResponse<MapArrayType<PackageInfo>>) => {
availablePlugins = pluginsLoaded.data; availablePlugins = pluginsLoaded.data;
cacheTimestamp = nowTimestamp; cacheTimestamp = nowTimestamp;
resolve(availablePlugins); resolve(availablePlugins);
}) })
.catch(async (err) => reject(err)); .catch(async (err) => {
logger.error(`Error fetching available plugins: ${err}`);
});
}); });
}; };