Lazy import proxy-agent

This commit is contained in:
Fedor Indutny 2024-03-20 11:05:10 -07:00 committed by GitHub
parent 83e8f4b59d
commit 091b50c414
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 60 additions and 39 deletions

View file

@ -602,7 +602,7 @@ export abstract class Updater {
this.logger.info(`downloadUpdate: Downloading signature ${signatureUrl}`);
const signature = Buffer.from(
await got(signatureUrl, getGotOptions()).text(),
await got(signatureUrl, await getGotOptions()).text(),
'hex'
);
@ -614,7 +614,10 @@ export abstract class Updater {
this.logger.info(
`downloadUpdate: Downloading blockmap ${blockMapUrl}`
);
const blockMap = await got(blockMapUrl, getGotOptions()).buffer();
const blockMap = await got(
blockMapUrl,
await getGotOptions()
).buffer();
await writeFile(tempBlockMapPath, blockMap);
} catch (error) {
this.logger.warn(
@ -751,7 +754,7 @@ export abstract class Updater {
targetUpdatePath: string,
updateOnProgress = false
): Promise<void> {
const downloadStream = got.stream(updateFileUrl, getGotOptions());
const downloadStream = got.stream(updateFileUrl, await getGotOptions());
const writeStream = createWriteStream(targetUpdatePath);
await new Promise<void>((resolve, reject) => {
@ -930,7 +933,7 @@ export function parseYaml(yaml: string): JSONUpdateSchema {
async function getUpdateYaml(): Promise<string> {
const targetUrl = getUpdateCheckUrl();
const body = await got(targetUrl, getGotOptions()).text();
const body = await got(targetUrl, await getGotOptions()).text();
if (!body) {
throw new Error('Got unexpected response back from update check');