dsh-pocket-ios 0.1.1 → 0.1.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 CHANGED
@@ -3,11 +3,14 @@
3
3
  在 DSH 的**设置 → 手机访问**里加入 iOS 客户端下载二维码与连接引导,把「手机访问」和
4
4
  [DSH Pocket iOS](https://github.com/jqlong17/dsh-pocket-ios) 串起来。
5
5
 
6
+ 当前版本:**0.1.3**(npm `dsh-pocket-ios`)。卡片主按钮与二维码指向 **App Store**(<https://apps.apple.com/app/id6832288744>),
7
+ 并保留「GitHub Release(自签)」与「直接下载 IPA」作为备用渠道。
8
+
6
9
  ## 它做什么
7
10
 
8
11
  - 设置页新增「iOS 客户端」入口(`settings.section` 插槽,原生渲染);
9
- - 在「手机访问」页的**局域网访问上方**尽力插入一张 iOS 卡片:下载二维码 + Release 链接 +
10
- 源码 zip 直链(DOM 注入,插入失败不影响上面的原生入口);
12
+ - 在「手机访问」页的**局域网访问上方**尽力插入一张 iOS 卡片:App Store 下载二维码 +
13
+ App Store / GitHub Release / IPA 三个入口(DOM 注入,插入失败不影响上面的原生入口);
11
14
  - `dependencies` 带 `dsh-pocket`,安装本插件会一并安装手机访问所需的 dsh-pocket。
12
15
 
13
16
  ## 安装
@@ -26,12 +29,15 @@ npm: <https://www.npmjs.com/package/dsh-pocket-ios>
26
29
 
27
30
  ## 手机端
28
31
 
29
- iOS App 通过 GitHub Release 分发(自签安装):
32
+ iOS App 已上架 App Store(免费):
30
33
 
31
- <https://github.com/jqlong17/dsh-pocket-ios/releases>
34
+ <https://apps.apple.com/app/id6832288744>
32
35
 
33
- 装好后在 App 里扫描 dsh-pocket 的二维码即可连接本机 DSH。
36
+ 没有 App Store 的地区仍可从 [GitHub Release](https://github.com/jqlong17/dsh-pocket-ios/releases)
37
+ 下载 IPA 自签安装。装好后在 App 里扫描 dsh-pocket 的二维码即可连接本机 DSH。
34
38
 
35
39
  ## 许可
36
40
 
37
- GPL-2.0(与上游 dsh-pocket 一致)。
41
+ GPL-2.0(与上游 dsh-pocket 一致),见 [LICENSE](LICENSE)。
42
+
43
+ 注意:本仓库根目录的 `LICENSE`(MIT)只覆盖 `DSHPocket/` iOS 客户端,不覆盖本插件目录。
package/client/client.js CHANGED
@@ -7,7 +7,8 @@ window.__ModuleLoader__.load({
7
7
 
8
8
  var RELEASE_URL = "https://github.com/jqlong17/dsh-pocket-ios/releases/latest";
9
9
  var DOWNLOAD_URL = "https://github.com/jqlong17/dsh-pocket-ios/releases/latest/download/DSHPocket.ipa";
10
- var QR_SVG = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"200\" height=\"200\" viewBox=\"0 0 33 33\" shape-rendering=\"crispEdges\"><path fill=\"#ffffff\" d=\"M0 0h33v33H0z\"/><path stroke=\"#000000\" d=\"M0 0.5h7m2 0h1m3 0h2m1 0h6m1 0h1m2 0h7M0 1.5h1m5 0h1m2 0h1m2 0h4m4 0h3m3 0h1m5 0h1M0 2.5h1m1 0h3m1 0h1m1 0h4m1 0h1m1 0h2m1 0h1m2 0h2m3 0h1m1 0h3m1 0h1M0 3.5h1m1 0h3m1 0h1m1 0h1m5 0h4m4 0h1m1 0h1m1 0h1m1 0h3m1 0h1M0 4.5h1m1 0h3m1 0h1m1 0h1m2 0h2m2 0h1m1 0h5m1 0h1m2 0h1m1 0h3m1 0h1M0 5.5h1m5 0h1m1 0h1m2 0h1m1 0h1m1 0h2m3 0h1m3 0h1m1 0h1m5 0h1M0 6.5h7m1 0h1m1 0h1m1 0h1m1 0h1m1 0h1m1 0h1m1 0h1m1 0h1m1 0h1m1 0h7M8 7.5h5m1 0h2m2 0h4m1 0h2M0 8.5h1m1 0h5m2 0h1m2 0h4m1 0h1m1 0h2m5 0h5M7 9.5h1m1 0h1m6 0h1m1 0h3m2 0h1m2 0h2m1 0h2m1 0h1M2 10.5h8m5 0h2m1 0h1m2 0h2m1 0h3m1 0h1m1 0h2M2 11.5h2m1 0h1m2 0h1m1 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1m2 0h4m2 0h1m1 0h1m3 0h2m1 0h1M0 31.5h1m5 0h1m2 0h4m1 0h1m4 0h1m1 0h3m1 0h2m1 0h3M0 32.5h7m1 0h4m3 0h4m3 0h6m3 0h1\"/></svg>\n";
10
+ var APP_STORE_URL = "https://apps.apple.com/app/id6832288744";
11
+ var QR_SVG = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 37 37\" shape-rendering=\"crispEdges\"><path fill=\"#ffffff\" d=\"M0 0h37v37H0z\"/><path stroke=\"#000000\" d=\"M4 4.5h7m3 0h1m4 0h5m2 0h7M4 5.5h1m5 0h1m2 0h1m7 0h1m2 0h1m1 0h1m5 0h1M4 6.5h1m1 0h3m1 0h1m1 0h1m5 0h1m1 0h1m3 0h1m1 0h1m1 0h3m1 0h1M4 7.5h1m1 0h3m1 0h1m1 0h2m7 0h1m1 0h1m2 0h1m1 0h3m1 0h1M4 8.5h1m1 0h3m1 0h1m1 0h8m2 0h3m1 0h1m1 0h3m1 0h1M4 9.5h1m5 0h1m1 0h2m1 0h5m2 0h1m1 0h1m1 0h1m5 0h1M4 10.5h7m1 0h1m1 0h1m1 0h1m1 0h1m1 0h1m1 0h1m1 0h1m1 0h7M12 11.5h1m1 0h1m1 0h2m1 0h2m2 0h2M4 12.5h1m1 0h5m5 0h1m1 0h2m1 0h1m1 0h1m2 0h5M8 13.5h1m5 0h2m7 0h4m1 0h1m3 0h1M5 14.5h1m3 0h2m1 0h1m1 0h3m5 0h1m1 0h1m1 0h2M4 15.5h5m6 0h2m1 0h1m1 0h1m1 0h2m1 0h2m1 0h2m1 0h1M5 16.5h3m1 0h2m1 0h2m5 0h3m5 0h1m1 0h2M4 17.5h4m3 0h3m1 0h1m1 0h2m4 0h6m3 0h1M8 18.5h3m3 0h1m2 0h4m1 0h1m2 0h1m2 0h3M5 19.5h2m2 0h1m1 0h1m3 0h1m1 0h1m1 0h1m2 0h3m3 0h1m2 0h1M4 20.5h2m2 0h1m1 0h6m2 0h1m1 0h4m3 0h1m1 0h2M4 21.5h6m1 0h1m1 0h3m5 0h3m2 0h3m1 0h1m1 0h1M4 22.5h1m4 0h3m2 0h2m3 0h3m2 0h2m2 0h1m1 0h1M4 23.5h1m2 0h3m3 0h1m1 0h2m1 0h1m5 0h2m2 0h1m2 0h1M4 24.5h1m1 0h3m1 0h1m3 0h3m4 0h1m2 0h5m1 0h3M12 25.5h3m1 0h3m2 0h2m1 0h1m3 0h5M4 26.5h7m6 0h2m3 0h3m1 0h1m1 0h3M4 27.5h1m5 0h1m1 0h6m5 0h2m3 0h1M4 28.5h1m1 0h3m1 0h1m1 0h5m1 0h1m2 0h1m2 0h5m1 0h1m1 0h1M4 29.5h1m1 0h3m1 0h1m1 0h2m8 0h1m4 0h1m1 0h2M4 30.5h1m1 0h3m1 0h1m1 0h1m1 0h1m3 0h2m3 0h2m1 0h6M4 31.5h1m5 0h1m3 0h2m3 0h1m2 0h1m1 0h2m1 0h3m1 0h1M4 32.5h7m1 0h2m1 0h1m1 0h4m1 0h2m1 0h1m2 0h1m1 0h1\"/></svg>";
11
12
  var CARD_ID = "dsh-pocket-ios-card";
12
13
 
13
14
  function linkStyle(primary) {
@@ -29,24 +30,25 @@ window.__ModuleLoader__.load({
29
30
  function IOSCard() {
30
31
  return React.createElement(
31
32
  "div",
32
- { style: { display: "flex", gap: 18, alignItems: "flex-start", padding: 16, borderRadius: 14, border: "1px solid rgba(0,0,0,.08)", background: "rgba(20,122,94,.04)", marginBottom: 18 } },
33
+ { style: { display: "flex", flexWrap: "wrap", gap: 16, alignItems: "flex-start", padding: 16, borderRadius: 14, border: "1px solid rgba(0,0,0,.08)", background: "rgba(20,122,94,.04)", marginBottom: 18, boxSizing: "border-box", width: "100%", maxWidth: 620 } },
33
34
  React.createElement("div", {
34
- style: { width: 132, height: 132, flex: "0 0 132px", background: "#fff", borderRadius: 10, padding: 8, border: "1px solid rgba(0,0,0,.06)", boxSizing: "border-box" },
35
+ style: { width: 120, height: 120, flex: "0 0 120px", background: "#fff", borderRadius: 10, padding: 8, border: "1px solid rgba(0,0,0,.06)", boxSizing: "border-box" },
35
36
  dangerouslySetInnerHTML: { __html: QR_SVG }
36
37
  }),
37
38
  React.createElement(
38
39
  "div",
39
- { style: { flex: 1, minWidth: 0 } },
40
+ { style: { flex: "1 1 220px", minWidth: 0 } },
40
41
  React.createElement("div", { style: { fontWeight: 600, fontSize: 15, marginBottom: 6 } }, "在 iPhone 上使用 DSH"),
41
42
  React.createElement(
42
43
  "div",
43
44
  { style: { fontSize: 13, opacity: 0.72, lineHeight: 1.6, marginBottom: 10 } },
44
- "用手机扫描二维码打开 DSH Pocket iOS 的最新 Release,下载 IPA 后用 AltStore / Sideloadly 自签安装(也可以直接下载下方 IPA)。装好后在 App 里扫描电脑上 dsh-pocket 的二维码即可连接本机 DSH。"
45
+ "用手机扫描二维码从 App Store 下载 DSH Pocket iOS;没有 App Store 的地区可从 GitHub Release 下载 IPA 自签安装。装好后在 App 里扫描电脑上 dsh-pocket 的二维码即可连接本机 DSH。"
45
46
  ),
46
47
  React.createElement(
47
48
  "div",
48
49
  { style: { display: "flex", gap: 10, flexWrap: "wrap" } },
49
- React.createElement("a", { href: RELEASE_URL, target: "_blank", rel: "noreferrer", style: linkStyle(true) }, "打开 Release 页面"),
50
+ React.createElement("a", { href: APP_STORE_URL, target: "_blank", rel: "noreferrer", style: linkStyle(true) }, "在 App Store 下载"),
51
+ React.createElement("a", { href: RELEASE_URL, target: "_blank", rel: "noreferrer", style: linkStyle(false) }, "GitHub Release(自签)"),
50
52
  React.createElement("a", { href: DOWNLOAD_URL, target: "_blank", rel: "noreferrer", style: linkStyle(false) }, "直接下载 IPA")
51
53
  )
52
54
  )
@@ -54,18 +56,18 @@ window.__ModuleLoader__.load({
54
56
  }
55
57
 
56
58
  var CARD_HTML =
57
- '<div style="display:flex;gap:16px;align-items:flex-start;padding:16px;border-radius:14px;border:1px solid rgba(0,0,0,.08);background:rgba(20,122,94,.04);margin:0 0 16px 0;text-align:left">' +
58
- '<div style="width:120px;height:120px;flex:0 0 120px;background:#fff;border-radius:10px;padding:6px;border:1px solid rgba(0,0,0,.06);box-sizing:border-box">' + QR_SVG + "</div>" +
59
- '<div style="flex:1;min-width:0">' +
59
+ '<div style="box-sizing:border-box;width:100%;max-width:620px;display:flex;flex-wrap:wrap;gap:16px;align-items:flex-start;padding:16px;border-radius:14px;border:1px solid rgba(0,0,0,.08);background:rgba(20,122,94,.04);margin:0 0 16px 0;text-align:left">' +
60
+ '<div style="box-sizing:border-box;width:110px;height:110px;flex:0 0 110px;background:#fff;border-radius:10px;padding:6px;border:1px solid rgba(0,0,0,.06)">' + QR_SVG + "</div>" +
61
+ '<div style="flex:1 1 220px;min-width:0">' +
60
62
  '<div style="font-weight:600;font-size:15px;margin-bottom:6px">在 iPhone 上使用 DSH</div>' +
61
- '<div style="font-size:13px;opacity:.72;line-height:1.6;margin-bottom:10px">扫码打开 DSH Pocket iOS 的最新 Release,下载 IPA 后自签安装;装好后在 App 里扫描上方二维码连接本机 DSH。</div>' +
63
+ '<div style="font-size:13px;opacity:.72;line-height:1.6;margin-bottom:10px">扫码从 App Store 下载 DSH Pocket iOS;没有 App Store 的地区可从 GitHub Release 下载 IPA 自签安装。装好后在 App 里扫描上方二维码连接本机 DSH。</div>' +
62
64
  '<div style="display:flex;gap:10px;flex-wrap:wrap">' +
63
- '<a href="' + RELEASE_URL + '" target="_blank" rel="noreferrer" style="display:inline-flex;align-items:center;padding:7px 12px;border-radius:999px;font-size:13px;font-weight:600;text-decoration:none;color:#fff;background:#147A5E">打开 Release 页面</a>' +
64
- '<a href="' + DOWNLOAD_URL + '" target="_blank" rel="noreferrer" style="display:inline-flex;align-items:center;padding:7px 12px;border-radius:999px;font-size:13px;font-weight:600;text-decoration:none;color:#147A5E;background:rgba(20,122,94,.08);border:1px solid rgba(20,122,94,.25)">直接下载源码 zip</a>' +
65
+ '<a href="' + APP_STORE_URL + '" target="_blank" rel="noreferrer" style="display:inline-flex;align-items:center;padding:7px 12px;border-radius:999px;font-size:13px;font-weight:600;text-decoration:none;color:#fff;background:#147A5E">在 App Store 下载</a>' +
66
+ '<a href="' + RELEASE_URL + '" target="_blank" rel="noreferrer" style="display:inline-flex;align-items:center;padding:7px 12px;border-radius:999px;font-size:13px;font-weight:600;text-decoration:none;color:#147A5E;background:rgba(20,122,94,.08);border:1px solid rgba(20,122,94,.25)">GitHub Release(自签)</a>' +
67
+ '<a href="' + DOWNLOAD_URL + '" target="_blank" rel="noreferrer" style="display:inline-flex;align-items:center;padding:7px 12px;border-radius:999px;font-size:13px;font-weight:600;text-decoration:none;color:#147A5E;background:rgba(20,122,94,.08);border:1px solid rgba(20,122,94,.25)">直接下载 IPA</a>' +
65
68
  "</div>" +
66
69
  "</div>" +
67
70
  "</div>";
68
-
69
71
  /** 尽力把卡片插到「手机访问 → 局域网访问」上方;失败时不影响原生设置入口。 */
70
72
  function insertCardInPocketPage() {
71
73
  if (typeof document === "undefined") return;
@@ -77,17 +79,21 @@ window.__ModuleLoader__.load({
77
79
  if (el.childElementCount === 0 && (el.textContent || "").trim() === "局域网访问" && el.offsetParent !== null) { label = el; break; }
78
80
  }
79
81
  if (!label) return;
80
- var container = label.parentElement;
81
- for (var depth = 0; depth < 6 && container; depth++) {
82
- if (container.querySelector("img,canvas,svg")) {
83
- var card = document.createElement("div");
84
- card.id = CARD_ID;
85
- card.innerHTML = CARD_HTML;
86
- container.insertBefore(card, container.firstChild);
87
- return;
88
- }
89
- container = container.parentElement;
82
+ // 从标签向上找「手机访问」页签的滚动内容容器;只在这里插入,避免落到设置弹窗的导航列里。
83
+ var node = label.parentElement;
84
+ var scroller = null;
85
+ for (var depth = 0; depth < 8 && node && node !== document.body; depth++) {
86
+ var style = window.getComputedStyle(node);
87
+ var width = node.getBoundingClientRect().width;
88
+ var scrollable = style.overflowY === "auto" || style.overflowY === "scroll";
89
+ if (width >= 260 && scrollable) { scroller = node; break; }
90
+ node = node.parentElement;
90
91
  }
92
+ if (!scroller) return;
93
+ var card = document.createElement("div");
94
+ card.id = CARD_ID;
95
+ card.innerHTML = CARD_HTML;
96
+ scroller.insertBefore(card, scroller.firstChild);
91
97
  }
92
98
 
93
99
  var observer = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-pocket-ios",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "在 DSH 设置页加入 iOS 客户端下载二维码与连接引导(配合 dsh-pocket + DSH Pocket iOS)",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -49,4 +49,4 @@
49
49
  "type": "git",
50
50
  "url": "git+https://github.com/jqlong17/dsh-pocket-ios.git"
51
51
  }
52
- }
52
+ }