comate-ui-inspector 0.1.2-alpha.4 → 0.1.2-alpha.5
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/extension/popup.html +58 -10
- package/extension/popup.js +10 -0
- package/package.json +1 -1
package/extension/popup.html
CHANGED
|
@@ -2,13 +2,20 @@
|
|
|
2
2
|
<html lang="zh">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
|
-
<meta
|
|
5
|
+
<meta
|
|
6
|
+
name="viewport"
|
|
7
|
+
content="width=device-width, initial-scale=1"
|
|
8
|
+
/>
|
|
6
9
|
<style>
|
|
7
10
|
body {
|
|
8
11
|
width: 320px;
|
|
9
12
|
margin: 0;
|
|
10
13
|
padding: 14px;
|
|
11
|
-
font:
|
|
14
|
+
font:
|
|
15
|
+
13px/1.5 -apple-system,
|
|
16
|
+
BlinkMacSystemFont,
|
|
17
|
+
'Segoe UI',
|
|
18
|
+
sans-serif;
|
|
12
19
|
color: #1f2328;
|
|
13
20
|
}
|
|
14
21
|
h1 {
|
|
@@ -96,8 +103,17 @@
|
|
|
96
103
|
<section>
|
|
97
104
|
<div class="label">生效域名</div>
|
|
98
105
|
<div class="row">
|
|
99
|
-
<input
|
|
100
|
-
|
|
106
|
+
<input
|
|
107
|
+
id="domain-input"
|
|
108
|
+
type="text"
|
|
109
|
+
placeholder="如 https://local.oreateai.com"
|
|
110
|
+
/>
|
|
111
|
+
<button
|
|
112
|
+
id="add-domain"
|
|
113
|
+
class="primary"
|
|
114
|
+
>
|
|
115
|
+
添加
|
|
116
|
+
</button>
|
|
101
117
|
</div>
|
|
102
118
|
<ul id="domain-list"></ul>
|
|
103
119
|
<div class="hint">添加时浏览器会请求该域名的访问权限,允许后即在该域名注入选取脚本。</div>
|
|
@@ -105,15 +121,47 @@
|
|
|
105
121
|
|
|
106
122
|
<section>
|
|
107
123
|
<div class="label">传输通路</div>
|
|
108
|
-
<label class="radio"
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
124
|
+
<label class="radio">
|
|
125
|
+
<input
|
|
126
|
+
type="radio"
|
|
127
|
+
name="transport"
|
|
128
|
+
value="native"
|
|
129
|
+
/>
|
|
130
|
+
本地(Native Messaging,默认)
|
|
131
|
+
</label>
|
|
132
|
+
<label class="radio">
|
|
133
|
+
<input
|
|
134
|
+
type="radio"
|
|
135
|
+
name="transport"
|
|
136
|
+
value="http"
|
|
137
|
+
/>
|
|
138
|
+
远程(HTTP bridge)
|
|
139
|
+
</label>
|
|
140
|
+
<div id="bridge-config">
|
|
141
|
+
<div
|
|
142
|
+
class="row"
|
|
143
|
+
style="margin-top: 6px"
|
|
144
|
+
>
|
|
145
|
+
<input
|
|
146
|
+
id="bridge-url"
|
|
147
|
+
type="text"
|
|
148
|
+
placeholder="http://127.0.0.1:8917"
|
|
149
|
+
/>
|
|
150
|
+
</div>
|
|
151
|
+
<div class="hint">
|
|
152
|
+
远程开发:在远程机跑
|
|
153
|
+
<code>ui-inspector bridge</code>
|
|
154
|
+
,SSH 把端口转发到本地 127.0.0.1。
|
|
155
|
+
</div>
|
|
112
156
|
</div>
|
|
113
|
-
<div class="hint">远程开发:在远程机跑 <code>ui-inspector bridge</code>,SSH 把端口转发到本地 127.0.0.1。</div>
|
|
114
157
|
</section>
|
|
115
158
|
|
|
116
|
-
<button
|
|
159
|
+
<button
|
|
160
|
+
id="save"
|
|
161
|
+
class="primary"
|
|
162
|
+
>
|
|
163
|
+
保存传输设置
|
|
164
|
+
</button>
|
|
117
165
|
<div id="msg"></div>
|
|
118
166
|
|
|
119
167
|
<script src="popup.js"></script>
|
package/extension/popup.js
CHANGED
|
@@ -99,12 +99,19 @@ async function removeDomain(match) {
|
|
|
99
99
|
msg(`已删除 ${match}`);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
// 「本地」模式不需要 bridge 地址,隐藏输入框;「远程」才显示。
|
|
103
|
+
function toggleBridge() {
|
|
104
|
+
const transport = document.querySelector('input[name="transport"]:checked')?.value || 'native';
|
|
105
|
+
$('bridge-config').style.display = transport === 'http' ? 'block' : 'none';
|
|
106
|
+
}
|
|
107
|
+
|
|
102
108
|
async function renderTransport() {
|
|
103
109
|
const {transport, bridgeUrl} = await getConfig();
|
|
104
110
|
for (const r of document.querySelectorAll('input[name="transport"]')) {
|
|
105
111
|
r.checked = r.value === transport;
|
|
106
112
|
}
|
|
107
113
|
$('bridge-url').value = bridgeUrl;
|
|
114
|
+
toggleBridge();
|
|
108
115
|
}
|
|
109
116
|
|
|
110
117
|
async function saveTransport() {
|
|
@@ -116,6 +123,9 @@ async function saveTransport() {
|
|
|
116
123
|
|
|
117
124
|
$('add-domain').onclick = addDomain;
|
|
118
125
|
$('save').onclick = saveTransport;
|
|
126
|
+
for (const r of document.querySelectorAll('input[name="transport"]')) {
|
|
127
|
+
r.addEventListener('change', toggleBridge);
|
|
128
|
+
}
|
|
119
129
|
$('domain-input').addEventListener('keydown', e => {
|
|
120
130
|
if (e.key === 'Enter') {
|
|
121
131
|
addDomain();
|
package/package.json
CHANGED