dsh-pocket 1.4.2 → 1.4.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/client/client.js CHANGED
@@ -1348,7 +1348,7 @@ function PocketSettingsTab({ rpcCall }) {
1348
1348
  (0, import_react2.useEffect)(() => {
1349
1349
  if (isDesktop) return;
1350
1350
  let alive = true;
1351
- (async () => {
1351
+ const check = async () => {
1352
1352
  try {
1353
1353
  const v = await call(POCKET_ENDPOINTS.version, {});
1354
1354
  const meta = await (await fetch("https://registry.npmjs.org/dsh-pocket/latest", { cache: "no-store" })).json();
@@ -1361,9 +1361,12 @@ function PocketSettingsTab({ rpcCall }) {
1361
1361
  }
1362
1362
  } catch {
1363
1363
  }
1364
- })();
1364
+ };
1365
+ check();
1366
+ const t = setInterval(check, 5 * 60 * 1e3);
1365
1367
  return () => {
1366
1368
  alive = false;
1369
+ clearInterval(t);
1367
1370
  };
1368
1371
  }, [isDesktop]);
1369
1372
  const restartPocket = async () => {
@@ -1438,10 +1441,11 @@ function PocketSettingsTab({ rpcCall }) {
1438
1441
  "div",
1439
1442
  { style: { fontSize: 12, color: "var(--dsw-alias-label-tertiary,#8b93a1)", textAlign: "right" } },
1440
1443
  (0, import_react2.createElement)("div", { style: { whiteSpace: "nowrap" } }, "\u5F00\u53D1\u8005\uFF1A\u7A0B\u5E8F\u5458\u5C11\u5317\u6668"),
1444
+ (0, import_react2.createElement)("div", { style: { whiteSpace: "nowrap" } }, "\u2B50 \u987A\u624B\u7559\u9897 Star\uFF0C\u4F5C\u8005\u80FD\u9AD8\u5174\u4E00\u6574\u5929"),
1441
1445
  (0, import_react2.createElement)(
1442
1446
  "a",
1443
1447
  { href: "https://github.com/shaobeichen/dsh-pocket", target: "_blank", rel: "noreferrer", style: { color: "var(--dsw-alias-brand-primary,#4f6ef7)", fontSize: 12, lineHeight: 1.6, textDecoration: "underline" } },
1444
- "\u2B50 \u8FD9\u4E2A\u63D2\u4EF6\u4E0D\u6536\u94B1\uFF0C\u987A\u624B\u7559\u9897 Star\uFF0C\u4F5C\u8005\u80FD\u9AD8\u5174\u4E00\u6574\u5929 | Free plugin \u2014 a Star would make the author's day"
1448
+ "\u884C\uFF0C\u7ED9\u4F60\u4E00\u9897 Star"
1445
1449
  )
1446
1450
  )
1447
1451
  ),
package/client/index.jsx CHANGED
@@ -87,11 +87,13 @@ function PocketSettingsTab({ rpcCall }) {
87
87
  // 版本检测:host 当前版本 vs npm registry latest(registry 带 CORS *)
88
88
  // 两种情况显示横幅:① 有新版可更新;② 磁盘已更新但进程还是旧代码(重启生效)
89
89
  // cache: 'no-store' —— registry 响应带缓存头,浏览器会缓存旧版本号导致「小版本不提示」
90
+ // 周期重查(每 5 分钟):npm registry 的 /latest 走 CDN 边缘缓存,刚发布后打开页面
91
+ // 可能拿到旧版本号——周期性重查让更新提示在缓存刷新后自动出现,不用重开页面。
90
92
  // 桌面端(isDesktop):更新/重启由 DSH Desktop 管理,这里不做版本检测、不显示更新横幅
91
93
  useEffect(() => {
92
94
  if (isDesktop) return;
93
95
  let alive = true;
94
- (async () => {
96
+ const check = async () => {
95
97
  try {
96
98
  const v = await call(POCKET_ENDPOINTS.version, {});
97
99
  const meta = await (await fetch('https://registry.npmjs.org/dsh-pocket/latest', { cache: 'no-store' })).json();
@@ -104,8 +106,10 @@ function PocketSettingsTab({ rpcCall }) {
104
106
  setUpdateInfo({ current: v.current, latest: v.current, updating: false, result: 'ok', updated: true });
105
107
  }
106
108
  } catch { /* 网络失败静默 */ }
107
- })();
108
- return () => { alive = false; };
109
+ };
110
+ check();
111
+ const t = setInterval(check, 5 * 60 * 1000);
112
+ return () => { alive = false; clearInterval(t); };
109
113
  }, [isDesktop]);
110
114
 
111
115
  // 重启宿主(更新生效必需:刷新页面不会重载服务端代码)
@@ -178,8 +182,9 @@ function PocketSettingsTab({ rpcCall }) {
178
182
  ),
179
183
  h('div', { style: { fontSize: 12, color: 'var(--dsw-alias-label-tertiary,#8b93a1)', textAlign: 'right' } },
180
184
  h('div', { style: { whiteSpace: 'nowrap' } }, '开发者:程序员少北晨'),
185
+ h('div', { style: { whiteSpace: 'nowrap' } }, '⭐ 顺手留颗 Star,作者能高兴一整天'),
181
186
  h('a', { href: 'https://github.com/shaobeichen/dsh-pocket', target: '_blank', rel: 'noreferrer', style: { color: 'var(--dsw-alias-brand-primary,#4f6ef7)', fontSize: 12, lineHeight: 1.6, textDecoration: 'underline' } },
182
- ' 这个插件不收钱,顺手留颗 Star,作者能高兴一整天 | Free plugin — a Star would make the author\'s day'),
187
+ '行,给你一颗 Star'),
183
188
  ),
184
189
  ),
185
190
 
package/package.json CHANGED
@@ -76,5 +76,5 @@
76
76
  "access": "public",
77
77
  "registry": "https://registry.npmjs.org/"
78
78
  },
79
- "version": "1.4.2"
79
+ "version": "1.4.4"
80
80
  }