desktop-pet-app 0.2.2 → 0.2.3
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/README.md +1 -1
- package/out/main/index.js +15 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ npm install --global ./d
|
|
|
24
24
|
desktop-pet
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
客户端默认连接 `
|
|
27
|
+
客户端默认连接 `https://deskpalai.com`,会自动推导 WebSocket、登录和更新接口。只有本地开发或私有部署时才需要设置 `DESKTOP_PET_HOST`。应用内更新仅接受 HTTPS 地址。
|
|
28
28
|
|
|
29
29
|
首次启动后,在宠物右键菜单中选择“登录账号”或“注册账号”。
|
|
30
30
|
|
package/out/main/index.js
CHANGED
|
@@ -1644,11 +1644,12 @@ async function fallbackChat(operationId) {
|
|
|
1644
1644
|
}
|
|
1645
1645
|
const REQUEST_TIMEOUT_MS = 6e3;
|
|
1646
1646
|
const DOWNLOAD_TIMEOUT_MS = 10 * 6e4;
|
|
1647
|
+
const LEGACY_OFFICIAL_HTTP_HOST = "47.94.20.104";
|
|
1647
1648
|
let status = { kind: "idle" };
|
|
1648
1649
|
function updateCheckURL() {
|
|
1649
1650
|
const override = process.env.DESKTOP_PET_UPDATE_API?.trim();
|
|
1650
1651
|
if (override) return validateUpdateAPIURL(override).toString();
|
|
1651
|
-
const relayURL =
|
|
1652
|
+
const relayURL = updateRelayURL();
|
|
1652
1653
|
const url = new URL(relayURL);
|
|
1653
1654
|
url.protocol = url.protocol === "wss:" ? "https:" : "http:";
|
|
1654
1655
|
url.pathname = "/api/updates/check";
|
|
@@ -1854,6 +1855,19 @@ function storedRelayURL() {
|
|
|
1854
1855
|
return void 0;
|
|
1855
1856
|
}
|
|
1856
1857
|
}
|
|
1858
|
+
function updateRelayURL() {
|
|
1859
|
+
const stored = storedRelayURL();
|
|
1860
|
+
if (stored && !isLegacyOfficialHTTPURL(stored)) return stored;
|
|
1861
|
+
return configuredRelayURL();
|
|
1862
|
+
}
|
|
1863
|
+
function isLegacyOfficialHTTPURL(value) {
|
|
1864
|
+
try {
|
|
1865
|
+
const url = new URL(value);
|
|
1866
|
+
return url.protocol === "http:" && url.hostname === LEGACY_OFFICIAL_HTTP_HOST;
|
|
1867
|
+
} catch {
|
|
1868
|
+
return false;
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1857
1871
|
function validateUpdateAPIURL(value) {
|
|
1858
1872
|
const url = new URL(value);
|
|
1859
1873
|
const local = url.hostname === "127.0.0.1" || url.hostname === "localhost" || url.hostname === "::1";
|