dsh-pocket-ios 0.1.0 → 0.1.2
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 +6 -4
- package/client/client.js +27 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
在 DSH 的**设置 → 手机访问**里加入 iOS 客户端下载二维码与连接引导,把「手机访问」和
|
|
4
4
|
[DSH Pocket iOS](https://github.com/jqlong17/dsh-pocket-ios) 串起来。
|
|
5
5
|
|
|
6
|
+
当前版本:**0.1.1**(npm `dsh-pocket-ios`)。卡片里的「直接下载 IPA」指向
|
|
7
|
+
[最新 Release 的 DSHPocket.ipa](https://github.com/jqlong17/dsh-pocket-ios/releases/latest/download/DSHPocket.ipa)。
|
|
8
|
+
|
|
6
9
|
## 它做什么
|
|
7
10
|
|
|
8
11
|
- 设置页新增「iOS 客户端」入口(`settings.section` 插槽,原生渲染);
|
|
@@ -13,13 +16,12 @@
|
|
|
13
16
|
## 安装
|
|
14
17
|
|
|
15
18
|
```bash
|
|
16
|
-
#
|
|
17
|
-
dsh plugin add dsh-pocket dsh-pocket-ios
|
|
18
|
-
|
|
19
|
-
# 若 dsh-pocket 已在用,只装本插件即可:
|
|
19
|
+
# 从 npm 安装(会自动带上依赖 dsh-pocket)
|
|
20
20
|
dsh plugin add dsh-pocket-ios
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
+
npm: <https://www.npmjs.com/package/dsh-pocket-ios>
|
|
24
|
+
|
|
23
25
|
安装后重启 DSH(或按提示重启),打开 **设置 → 手机访问** 即可看到 iOS 入口。
|
|
24
26
|
|
|
25
27
|
> 为什么依赖 dsh-pocket 而不是复制它的 patch:复制上游 patch 会在上游变更时失真,且用户
|
package/client/client.js
CHANGED
|
@@ -5,9 +5,9 @@ window.__ModuleLoader__.load({
|
|
|
5
5
|
var exports = module.exports;
|
|
6
6
|
var React = require("react");
|
|
7
7
|
|
|
8
|
-
var RELEASE_URL = "https://github.com/jqlong17/dsh-pocket-ios/releases/
|
|
9
|
-
var DOWNLOAD_URL = "https://github.com/jqlong17/dsh-pocket-ios/
|
|
10
|
-
var QR_SVG = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"
|
|
8
|
+
var RELEASE_URL = "https://github.com/jqlong17/dsh-pocket-ios/releases/latest";
|
|
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=\"100%\" height=\"100%\" 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 0h1m3 0h1m1 0h1m2 0h1m1 0h1m2 0h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0 31.5h1m5 0h1m2 0h4m1 0h1m4 0h1m1 0h3m1 0h2m1 0h3M0 32.5h7m1 0h4m3 0h4m3 0h6m3 0h1\"/></svg>\n";
|
|
11
11
|
var CARD_ID = "dsh-pocket-ios-card";
|
|
12
12
|
|
|
13
13
|
function linkStyle(primary) {
|
|
@@ -29,43 +29,42 @@ window.__ModuleLoader__.load({
|
|
|
29
29
|
function IOSCard() {
|
|
30
30
|
return React.createElement(
|
|
31
31
|
"div",
|
|
32
|
-
{ style: { display: "flex", gap:
|
|
32
|
+
{ 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
33
|
React.createElement("div", {
|
|
34
|
-
style: { width:
|
|
34
|
+
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
35
|
dangerouslySetInnerHTML: { __html: QR_SVG }
|
|
36
36
|
}),
|
|
37
37
|
React.createElement(
|
|
38
38
|
"div",
|
|
39
|
-
{ style: { flex: 1, minWidth: 0 } },
|
|
39
|
+
{ style: { flex: "1 1 220px", minWidth: 0 } },
|
|
40
40
|
React.createElement("div", { style: { fontWeight: 600, fontSize: 15, marginBottom: 6 } }, "在 iPhone 上使用 DSH"),
|
|
41
41
|
React.createElement(
|
|
42
42
|
"div",
|
|
43
43
|
{ style: { fontSize: 13, opacity: 0.72, lineHeight: 1.6, marginBottom: 10 } },
|
|
44
|
-
"用手机扫描二维码打开 DSH Pocket iOS
|
|
44
|
+
"用手机扫描二维码打开 DSH Pocket iOS 的最新 Release,下载 IPA 后用 AltStore / Sideloadly 自签安装(也可以直接下载下方 IPA)。装好后在 App 里扫描电脑上 dsh-pocket 的二维码即可连接本机 DSH。"
|
|
45
45
|
),
|
|
46
46
|
React.createElement(
|
|
47
47
|
"div",
|
|
48
48
|
{ style: { display: "flex", gap: 10, flexWrap: "wrap" } },
|
|
49
49
|
React.createElement("a", { href: RELEASE_URL, target: "_blank", rel: "noreferrer", style: linkStyle(true) }, "打开 Release 页面"),
|
|
50
|
-
React.createElement("a", { href: DOWNLOAD_URL, target: "_blank", rel: "noreferrer", style: linkStyle(false) }, "
|
|
50
|
+
React.createElement("a", { href: DOWNLOAD_URL, target: "_blank", rel: "noreferrer", style: linkStyle(false) }, "直接下载 IPA")
|
|
51
51
|
)
|
|
52
52
|
)
|
|
53
53
|
);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
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:
|
|
59
|
-
'<div style="flex:1;min-width:0">' +
|
|
57
|
+
'<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">' +
|
|
58
|
+
'<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>" +
|
|
59
|
+
'<div style="flex:1 1 220px;min-width:0">' +
|
|
60
60
|
'<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
|
|
61
|
+
'<div style="font-size:13px;opacity:.72;line-height:1.6;margin-bottom:10px">扫码打开 DSH Pocket iOS 的最新 Release,下载 IPA 后自签安装;装好后在 App 里扫描上方二维码连接本机 DSH。</div>' +
|
|
62
62
|
'<div style="display:flex;gap:10px;flex-wrap:wrap">' +
|
|
63
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)"
|
|
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)">直接下载 IPA</a>' +
|
|
65
65
|
"</div>" +
|
|
66
66
|
"</div>" +
|
|
67
67
|
"</div>";
|
|
68
|
-
|
|
69
68
|
/** 尽力把卡片插到「手机访问 → 局域网访问」上方;失败时不影响原生设置入口。 */
|
|
70
69
|
function insertCardInPocketPage() {
|
|
71
70
|
if (typeof document === "undefined") return;
|
|
@@ -77,17 +76,21 @@ window.__ModuleLoader__.load({
|
|
|
77
76
|
if (el.childElementCount === 0 && (el.textContent || "").trim() === "局域网访问" && el.offsetParent !== null) { label = el; break; }
|
|
78
77
|
}
|
|
79
78
|
if (!label) return;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
container = container.parentElement;
|
|
79
|
+
// 从标签向上找「手机访问」页签的滚动内容容器;只在这里插入,避免落到设置弹窗的导航列里。
|
|
80
|
+
var node = label.parentElement;
|
|
81
|
+
var scroller = null;
|
|
82
|
+
for (var depth = 0; depth < 8 && node && node !== document.body; depth++) {
|
|
83
|
+
var style = window.getComputedStyle(node);
|
|
84
|
+
var width = node.getBoundingClientRect().width;
|
|
85
|
+
var scrollable = style.overflowY === "auto" || style.overflowY === "scroll";
|
|
86
|
+
if (width >= 260 && scrollable) { scroller = node; break; }
|
|
87
|
+
node = node.parentElement;
|
|
90
88
|
}
|
|
89
|
+
if (!scroller) return;
|
|
90
|
+
var card = document.createElement("div");
|
|
91
|
+
card.id = CARD_ID;
|
|
92
|
+
card.innerHTML = CARD_HTML;
|
|
93
|
+
scroller.insertBefore(card, scroller.firstChild);
|
|
91
94
|
}
|
|
92
95
|
|
|
93
96
|
var observer = null;
|