mirror of
https://github.com/CringeStudios/element-desktop.git
synced 2025-01-18 07:24:59 +01:00
Prefer native node fetch over node-fetch (#1970)
This commit is contained in:
parent
e66db793bf
commit
098609607b
@ -63,7 +63,6 @@
|
|||||||
"electron-store": "^10.0.0",
|
"electron-store": "^10.0.0",
|
||||||
"electron-window-state": "^5.0.3",
|
"electron-window-state": "^5.0.3",
|
||||||
"minimist": "^1.2.6",
|
"minimist": "^1.2.6",
|
||||||
"node-fetch": "^2",
|
|
||||||
"png-to-ico": "^2.1.1",
|
"png-to-ico": "^2.1.1",
|
||||||
"uuid": "^11.0.0"
|
"uuid": "^11.0.0"
|
||||||
},
|
},
|
||||||
|
@ -5,7 +5,6 @@ import { createWriteStream, promises as fs } from "node:fs";
|
|||||||
import * as childProcess from "node:child_process";
|
import * as childProcess from "node:child_process";
|
||||||
import * as tar from "tar";
|
import * as tar from "tar";
|
||||||
import * as asar from "@electron/asar";
|
import * as asar from "@electron/asar";
|
||||||
import fetch from "node-fetch";
|
|
||||||
import { promises as stream } from "node:stream";
|
import { promises as stream } from "node:stream";
|
||||||
|
|
||||||
import riotDesktopPackageJson from "../package.json";
|
import riotDesktopPackageJson from "../package.json";
|
||||||
@ -125,6 +124,8 @@ async function main(): Promise<number | undefined> {
|
|||||||
});
|
});
|
||||||
fetch(PUB_KEY_URL)
|
fetch(PUB_KEY_URL)
|
||||||
.then((resp) => {
|
.then((resp) => {
|
||||||
|
if (!resp.ok) throw new Error(`unexpected response ${resp.statusText}`);
|
||||||
|
if (!resp.body) throw new Error(`unexpected response has no body ${resp.statusText}`);
|
||||||
stream.pipeline(resp.body, gpgProc.stdin!).catch(reject);
|
stream.pipeline(resp.body, gpgProc.stdin!).catch(reject);
|
||||||
})
|
})
|
||||||
.catch(reject);
|
.catch(reject);
|
||||||
|
@ -2,12 +2,13 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"moduleResolution": "node16",
|
"moduleResolution": "node16",
|
||||||
|
"skipLibCheck": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"target": "es2022",
|
"target": "es2022",
|
||||||
"module": "node16",
|
"module": "node16",
|
||||||
"sourceMap": false,
|
"sourceMap": false,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"lib": ["es2020", "dom"]
|
"lib": ["es2020"]
|
||||||
},
|
},
|
||||||
"include": ["../src/@types", "./**/*.ts"]
|
"include": ["../src/@types", "./**/*.ts"]
|
||||||
}
|
}
|
||||||
|
@ -31,8 +31,8 @@ async function safeCheckForUpdate(): Promise<void> {
|
|||||||
// To avoid this we check manually whether an update is available and call the
|
// To avoid this we check manually whether an update is available and call the
|
||||||
// autoUpdater.checkForUpdates() when something new is there.
|
// autoUpdater.checkForUpdates() when something new is there.
|
||||||
try {
|
try {
|
||||||
const res = await global.fetch(feedUrl);
|
const res = await fetch(feedUrl);
|
||||||
const { currentRelease } = await res.json();
|
const { currentRelease } = (await res.json()) as { currentRelease: string };
|
||||||
const latestVersionDownloaded = latestUpdateDownloaded?.releaseName;
|
const latestVersionDownloaded = latestUpdateDownloaded?.releaseName;
|
||||||
console.info(
|
console.info(
|
||||||
`Latest version from release download: ${currentRelease} (current: ${app.getVersion()}, most recent downloaded ${latestVersionDownloaded}})`,
|
`Latest version from release download: ${currentRelease} (current: ${app.getVersion()}, most recent downloaded ${latestVersionDownloaded}})`,
|
||||||
|
@ -23,7 +23,6 @@ import {
|
|||||||
} from "electron";
|
} from "electron";
|
||||||
import url from "node:url";
|
import url from "node:url";
|
||||||
import fs from "node:fs";
|
import fs from "node:fs";
|
||||||
import fetch from "node-fetch";
|
|
||||||
import { pipeline } from "node:stream/promises";
|
import { pipeline } from "node:stream/promises";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"typeRoots": ["src/@types", "node_modules/@types"],
|
"typeRoots": ["src/@types", "node_modules/@types"],
|
||||||
"lib": ["es2022", "dom"],
|
"lib": ["es2022"],
|
||||||
"types": ["node"],
|
"types": ["node"],
|
||||||
"strict": true
|
"strict": true
|
||||||
},
|
},
|
||||||
|
@ -5564,7 +5564,7 @@ node-api-version@^0.2.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
semver "^7.3.5"
|
semver "^7.3.5"
|
||||||
|
|
||||||
node-fetch@^2, node-fetch@^2.6.7:
|
node-fetch@^2.6.7:
|
||||||
version "2.7.0"
|
version "2.7.0"
|
||||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d"
|
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d"
|
||||||
integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==
|
integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==
|
||||||
|
Loading…
Reference in New Issue
Block a user