@mrrisega/dsh-remote 0.6.0-beta.2 → 0.6.0-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrrisega/dsh-remote",
3
- "version": "0.6.0-beta.2",
3
+ "version": "0.6.0-beta.3",
4
4
  "description": "手机远程控制 DeepSeek Harness · Remote control DeepSeek Harness (dsh web) from any phone browser — 100% 全功能 App 级体验:发消息、看工具执行、审批权限、改设置、管凭据,含特权操作,免内网穿透。一条命令安装 npx @mrrisega/dsh-remote。Mobile remote control for DSH, self-host or SaaS, no server needed on LAN.",
5
5
  "keywords": [
6
6
  "deepseek-harness",
@@ -320,6 +320,18 @@ window.__ModuleLoader__.load({
320
320
  return api(path, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(data || {}) });
321
321
  };
322
322
 
323
+ /** 一次性访问 url → 升级/续费页 url(带同一 auth,进入后即登录态到 /app/promo)。 */
324
+ function promoUrlOf(u) {
325
+ var s = String(u || "");
326
+ if (/\/app\/\?auth=/i.test(s)) return s.replace(/\/app\/\?auth=/i, "/app/promo?auth=");
327
+ try {
328
+ var m = /auth=([^&#]+)/.exec(s);
329
+ var origin = s.split("/app")[0];
330
+ if (m && origin) return origin + "/app/promo?auth=" + m[1];
331
+ } catch (e) { /* fallthrough */ }
332
+ return s;
333
+ }
334
+
323
335
  // ── 用户反馈模块:本地状态(thread 令牌 / 弹窗节流) ───────────────────
324
336
  var FB_THREADS_KEY = "dsh-feedback-threads";
325
337
  var FB_POPUP_KEY = "dsh-feedback-popup";
@@ -1093,12 +1105,13 @@ window.__ModuleLoader__.load({
1093
1105
  }).finally(function () { setDevBusy(""); });
1094
1106
  };
1095
1107
 
1096
- /** 升级/续费带登录态打开:先取一次性访问 url,再 window.open(node 半用账号 JWT 换 key)。 */
1108
+ /** 升级/续费带登录态打开:取一次性访问 url,改写为 /app/promo?auth=… 后在手机端进入续费页。 */
1097
1109
  var openUpgradeAuth = function () {
1098
1110
  setBusy("upgrade");
1099
1111
  api("/dsh-remote/access-key").then(function (b) {
1100
1112
  if (!b || !b.ok || !b.url) throw new Error((b && b.error) || "生成访问链接失败");
1101
- try { window.open(b.url, "_blank", "noopener"); } catch (e2) {}
1113
+ var promo = promoUrlOf(b.url);
1114
+ try { window.open(promo, "_blank", "noopener"); } catch (e2) {}
1102
1115
  setMsg("ok", "✅ 升级/续费页已在新标签页打开(带登录态)");
1103
1116
  }).catch(function (e) {
1104
1117
  setMsg("err", "打开升级/续费页失败:" + e.message);
@@ -1206,6 +1219,8 @@ window.__ModuleLoader__.load({
1206
1219
  setBusy("logout");
1207
1220
  post("/dsh-remote/logout").then(function (body) {
1208
1221
  setSt(body); setAccount(null); setQuota(null);
1222
+ // 清空一次性访问密钥/二维码/授权设备等本地状态(退出后不得残留可见)
1223
+ setAkey(null); setAkeyMsg(null);
1209
1224
  // 退出登录:清除本机保存的用户反馈线程凭据(thread_token 见 FB_THREADS_KEY),
1210
1225
  // 反馈历史保留在服务端(按账号校验),账号身份变化后本机不再可见旧线程。
1211
1226
  fbClearThreads();
@@ -762,13 +762,13 @@ async function proxyCreateAccessKey(relayDir, res) {
762
762
  }
763
763
 
764
764
  /**
765
- * GET /dsh-remote/mobile-sessions → 已授权设备列表(企业端 POST /api/mobile-sessions,Bearer)。
765
+ * GET /dsh-remote/mobile-sessions → 已授权设备列表(企业端 GET /api/mobile-sessions,Bearer)。
766
766
  */
767
767
  async function proxyMobileSessions(relayDir, res) {
768
768
  const token = await relayToken(relayDir).catch(() => "");
769
769
  if (!token) return sendJson(res, 401, notLoggedInJson());
770
770
  const r = await relayFetch(relayDir, "/api/mobile-sessions", {
771
- method: "POST",
771
+ method: "GET",
772
772
  headers: { authorization: `Bearer ${token}` },
773
773
  });
774
774
  const d = flattenRelayBody(r);
@@ -946,7 +946,7 @@ const PLUGIN_ID = "dsh-remote-web";
946
946
  const PLUGIN_LEGACY_IDS = ["dsh-remote-ui"];
947
947
  const PLUGIN_ALL_IDS = [PLUGIN_ID, ...PLUGIN_LEGACY_IDS];
948
948
  /** 插件自身发布版本(与 dsh-remote 根包同步递增)。 */
949
- const PLUGIN_VERSION = "0.6.0-beta.2";
949
+ const PLUGIN_VERSION = "0.6.0-beta.3";
950
950
  const UPDATE_LOG = ".dsh-update.log";
951
951
  const UPDATE_MARKER = ".dsh-update-running";
952
952
 
@@ -30,7 +30,7 @@ function startFakeRelay(opts = {}) {
30
30
  if (!opts.noQr) body.qr_data_url = QR;
31
31
  return send(200, body);
32
32
  }
33
- if (req.method === "POST" && url.pathname === "/api/mobile-sessions") {
33
+ if ((req.method === "GET" || req.method === "POST") && url.pathname === "/api/mobile-sessions") {
34
34
  return send(200, {
35
35
  ok: true,
36
36
  sessions: [
@@ -117,7 +117,7 @@ test("mobile-sessions 路由:列表透传,Bearer 已带上", async () => {
117
117
  assert.equal(r.sessions[0].label, "iPhone 15");
118
118
  assert.equal(r.sessions[0].os, "iOS");
119
119
  const up = relay.seen.find((s) => s.path === "/api/mobile-sessions");
120
- assert.equal(up.method, "POST");
120
+ assert.equal(up.method, "GET"); // 列表为 GET;POST 仅用于 auth-key/revoke
121
121
  assert.equal(up.authorization, "Bearer jwt-abc");
122
122
  } finally {
123
123
  host.close();