desktop-pet-app 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/main/index.js +5 -2
- package/package.json +1 -1
package/out/main/index.js
CHANGED
|
@@ -1667,7 +1667,7 @@ async function checkForUpdates(currentVersion = electron.app.getVersion()) {
|
|
|
1667
1667
|
endpoint.searchParams.set("platform", process.platform);
|
|
1668
1668
|
endpoint.searchParams.set("arch", process.arch);
|
|
1669
1669
|
endpoint.searchParams.set("currentVersion", currentVersion);
|
|
1670
|
-
const response = await fetch(endpoint, {
|
|
1670
|
+
const response = await electron.net.fetch(endpoint.toString(), {
|
|
1671
1671
|
headers: updateCheckHeaders(endpoint),
|
|
1672
1672
|
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
|
|
1673
1673
|
cache: "no-store"
|
|
@@ -1711,7 +1711,7 @@ async function downloadAvailableUpdate() {
|
|
|
1711
1711
|
const temporaryPath = `${artifactPath}.${node_crypto.randomUUID()}.download`;
|
|
1712
1712
|
try {
|
|
1713
1713
|
await promises.mkdir(updateDirectory, { recursive: true });
|
|
1714
|
-
const response = await fetch(available.releaseUrl, {
|
|
1714
|
+
const response = await electron.net.fetch(available.releaseUrl, {
|
|
1715
1715
|
headers: { accept: "application/octet-stream, application/wasm, */*" },
|
|
1716
1716
|
signal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS),
|
|
1717
1717
|
cache: "no-store",
|
|
@@ -1926,6 +1926,9 @@ function compareVersions(a, b) {
|
|
|
1926
1926
|
}
|
|
1927
1927
|
function humanizeUpdateError(error) {
|
|
1928
1928
|
if (error instanceof DOMException && error.name === "TimeoutError") return "检查更新超时,请稍后重试";
|
|
1929
|
+
if (error instanceof TypeError && error.message === "fetch failed") {
|
|
1930
|
+
return "无法连接更新服务器,请检查网络或系统代理";
|
|
1931
|
+
}
|
|
1929
1932
|
if (error instanceof Error) return error.message;
|
|
1930
1933
|
return "暂时无法检查更新";
|
|
1931
1934
|
}
|