@aixnn/aixautots 0.6.17 → 0.6.20
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/dist/{automation-queue-DO8fOG6l.d.ts → automation-queue-GhfQtZLm.d.ts} +2 -2
- package/dist/{chunk-TJ2QIP5M.js → chunk-4NRIEM5Z.js} +249 -33
- package/dist/{chunk-WOPEKCVC.js → chunk-DAU3FVCV.js} +2 -2
- package/dist/chunk-DTXXQPOU.js +693 -0
- package/dist/{chunk-7BJPVSEZ.js → chunk-ED6CB3B4.js} +222 -12
- package/dist/{chunk-NIEGPH3E.js → chunk-FJKMRWYC.js} +55 -23
- package/dist/{chunk-ZDCTHR7D.js → chunk-H7KZUU67.js} +2 -2
- package/dist/{chunk-FJPIY4YI.js → chunk-HQ2L4NQ2.js} +262 -10
- package/dist/{chunk-LOKPZ677.js → chunk-JQBSGFAR.js} +2 -2
- package/dist/{chunk-2KPZSPV6.js → chunk-OJK35AQD.js} +105 -17
- package/dist/chunk-QISBQ532.js +1665 -0
- package/dist/{chunk-KASSYUGM.js → chunk-RFOJSDYI.js} +2 -2
- package/dist/{chunk-QEK25NUA.js → chunk-UEZVXYGP.js} +12 -5
- package/dist/{config-CBUhr4Gl.d.ts → config-C79rcedl.d.ts} +52 -10
- package/dist/core/index.d.ts +13 -9
- package/dist/core/index.js +2 -2
- package/dist/core/network-adb-node.d.ts +23 -0
- package/dist/core/network-adb-node.js +171 -0
- package/dist/{script-debugger-DoT02din.d.ts → device-channel-OiZwAqNQ.d.ts} +41 -55
- package/dist/{device-normalize-Vl5JYbAI.d.ts → device-normalize-ODrxJb-a.d.ts} +1 -1
- package/dist/device-session-PVHD6PNR.js +1 -0
- package/dist/i18n/index.js +1 -1
- package/dist/{mirror-session-Y1InpkUY.d.ts → mirror-session-DifANocH.d.ts} +2 -2
- package/dist/react/index.d.ts +19 -12
- package/dist/react/index.js +3 -3
- package/dist/script-debugger-DjxpvdaN.d.ts +56 -0
- package/dist/{task-agent-runner-Cl2ickJ1.d.ts → task-agent-runner-CAt-z8gr.d.ts} +3 -3
- package/dist/{types-Cp1ohbTb.d.ts → types-CBI5SIH5.d.ts} +102 -4
- package/dist/ui/billing.d.ts +43 -6
- package/dist/ui/billing.js +190 -309
- package/dist/ui/device-create.d.ts +1 -1
- package/dist/ui/device-create.js +7 -7
- package/dist/ui/device-mirror.js +5 -5
- package/dist/ui/devices.d.ts +5 -5
- package/dist/ui/devices.js +9 -9
- package/dist/ui/editor.d.ts +2 -2
- package/dist/ui/editor.js +5 -5
- package/dist/ui/index.d.ts +6 -4
- package/dist/ui/index.js +13 -492
- package/dist/ui/inspector.js +4 -4
- package/dist/ui/ip-commerce.d.ts +2 -2
- package/dist/ui/ip-commerce.js +5 -5
- package/dist/ui/market.js +4 -4
- package/dist/ui/mirror.d.ts +3 -3
- package/dist/ui/script-studio.js +4 -4
- package/dist/ui/scripts.d.ts +1 -1
- package/dist/ui/scripts.js +4 -4
- package/dist/ui/settings.d.ts +164 -0
- package/dist/ui/settings.js +10 -0
- package/dist/ui/tasks.js +9 -9
- package/package.json +9 -1
- package/dist/device-session-3XK2SZDF.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { joinUrl, AixAuthError, AixLocked, AixError, resolveConfig, ReconnectingSocket, AixTimeout, parseIncoming, isRetFrame, errorFromRet, isFridaEventFrame, isScriptletEventFrame,
|
|
1
|
+
import { joinUrl, AixAuthError, AixLocked, AixError, resolveConfig, ReconnectingSocket, AixTimeout, AixProtocolError, parseIncoming, isRetFrame, errorFromRet, isStatusFrame, isFridaEventFrame, isScriptletEventFrame, executionWsTicketUrl, isExecutionFrame, mintViewerToken, getIceServers, mintViewerGrant, validateViewerGrant, validUuid, executionStreamEventsAfter } from './chunk-OJK35AQD.js';
|
|
2
2
|
|
|
3
3
|
// src/core/ws-access.ts
|
|
4
4
|
async function mintDeviceAccess(cfg, deviceId) {
|
|
@@ -40,22 +40,85 @@ function fallbackUuid() {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
var DeviceTunnel = class {
|
|
43
|
-
constructor(streamId, sink) {
|
|
43
|
+
constructor(streamId, sink, canSend = () => true) {
|
|
44
44
|
this.streamId = streamId;
|
|
45
45
|
this.sink = sink;
|
|
46
|
+
this.canSend = canSend;
|
|
46
47
|
this.dataListeners = /* @__PURE__ */ new Set();
|
|
48
|
+
this.closeListeners = /* @__PURE__ */ new Set();
|
|
49
|
+
this.closed = false;
|
|
50
|
+
this.opened = false;
|
|
51
|
+
this.readyPromise = new Promise((resolve, reject) => {
|
|
52
|
+
this.readyResolve = resolve;
|
|
53
|
+
this.readyReject = reject;
|
|
54
|
+
});
|
|
55
|
+
void this.readyPromise.catch(() => {
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/** Resolves only when the server confirms this stream opened, never on permission grant. */
|
|
59
|
+
waitReady(timeoutMs = 1e4) {
|
|
60
|
+
if (!this.opened && !this.closed && !this.readyTimer) {
|
|
61
|
+
this.readyTimer = setTimeout(() => {
|
|
62
|
+
this._end("ADB stream open timed out");
|
|
63
|
+
try {
|
|
64
|
+
this.sink({ t: "close", stream: this.streamId });
|
|
65
|
+
} catch {
|
|
66
|
+
}
|
|
67
|
+
}, timeoutMs);
|
|
68
|
+
}
|
|
69
|
+
return this.readyPromise;
|
|
47
70
|
}
|
|
48
71
|
send(bytes) {
|
|
49
|
-
this.
|
|
72
|
+
if (this.closed || !this.canSend()) throw new AixError("stream closed or no longer granted", "auth");
|
|
73
|
+
try {
|
|
74
|
+
this.sink({ t: "data", stream: this.streamId, b64: bytesToB64(bytes) });
|
|
75
|
+
} catch (e) {
|
|
76
|
+
try {
|
|
77
|
+
this.close();
|
|
78
|
+
} catch {
|
|
79
|
+
}
|
|
80
|
+
throw e;
|
|
81
|
+
}
|
|
50
82
|
}
|
|
51
83
|
onData(cb) {
|
|
52
84
|
this.dataListeners.add(cb);
|
|
53
85
|
return () => this.dataListeners.delete(cb);
|
|
54
86
|
}
|
|
87
|
+
onClose(cb) {
|
|
88
|
+
this.closeListeners.add(cb);
|
|
89
|
+
return () => this.closeListeners.delete(cb);
|
|
90
|
+
}
|
|
91
|
+
_opened() {
|
|
92
|
+
if (!this.closed) {
|
|
93
|
+
this.opened = true;
|
|
94
|
+
this._clearTimer();
|
|
95
|
+
this.readyResolve?.();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
55
98
|
_deliver(b) {
|
|
56
|
-
for (const cb of this.dataListeners) cb(b);
|
|
99
|
+
if (!this.closed) for (const cb of this.dataListeners) cb(b);
|
|
100
|
+
}
|
|
101
|
+
_end(reason) {
|
|
102
|
+
if (this.closed) return;
|
|
103
|
+
this.closed = true;
|
|
104
|
+
this._clearTimer();
|
|
105
|
+
if (!this.opened) this.readyReject?.(new AixError(reason ?? "stream closed", "offline"));
|
|
106
|
+
for (const cb of this.closeListeners) {
|
|
107
|
+
try {
|
|
108
|
+
cb(reason);
|
|
109
|
+
} catch {
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
this.dataListeners.clear();
|
|
113
|
+
this.closeListeners.clear();
|
|
114
|
+
}
|
|
115
|
+
_clearTimer() {
|
|
116
|
+
if (this.readyTimer) clearTimeout(this.readyTimer);
|
|
117
|
+
this.readyTimer = void 0;
|
|
57
118
|
}
|
|
58
119
|
close() {
|
|
120
|
+
if (this.closed) return;
|
|
121
|
+
this._end("stream closed");
|
|
59
122
|
this.sink({ t: "close", stream: this.streamId });
|
|
60
123
|
}
|
|
61
124
|
};
|
|
@@ -71,21 +134,49 @@ var DeviceChannel = class _DeviceChannel {
|
|
|
71
134
|
this.scriptletListeners = /* @__PURE__ */ new Set();
|
|
72
135
|
this.statusListeners = /* @__PURE__ */ new Set();
|
|
73
136
|
this.tunnels = /* @__PURE__ */ new Map();
|
|
137
|
+
this.networkAdbEnabled = false;
|
|
138
|
+
this.networkAdbListeners = /* @__PURE__ */ new Set();
|
|
139
|
+
this.networkAdbStreams = /* @__PURE__ */ new Set();
|
|
140
|
+
this.networkAdbGeneration = 0;
|
|
141
|
+
this.networkAdbOperation = Promise.resolve();
|
|
142
|
+
this.networkAdbIntent = 0;
|
|
74
143
|
}
|
|
75
144
|
static async open(cfg, deviceId, opts) {
|
|
76
145
|
const resolved = "fetchFn" in cfg ? cfg : resolveConfig(cfg);
|
|
77
146
|
const prefer = opts?.prefer ?? "direct";
|
|
78
147
|
const ch = new _DeviceChannel(resolved, deviceId);
|
|
148
|
+
let ready;
|
|
149
|
+
const connected = new Promise((resolve) => {
|
|
150
|
+
ready = resolve;
|
|
151
|
+
});
|
|
79
152
|
const socket = new ReconnectingSocket({
|
|
80
153
|
urlProvider: async () => {
|
|
81
154
|
const access = await mintDeviceAccess(resolved, deviceId);
|
|
82
155
|
return wsUrlFromAccess(access, prefer);
|
|
83
156
|
},
|
|
84
157
|
wsFactory: resolved.wsFactory,
|
|
85
|
-
onMessage: (text) => ch.onMessage(text)
|
|
158
|
+
onMessage: (text) => ch.onMessage(text),
|
|
159
|
+
onOpen: () => {
|
|
160
|
+
ch.emitNetworkAdb();
|
|
161
|
+
ready();
|
|
162
|
+
},
|
|
163
|
+
onClose: () => ch.resetNetworkAdb()
|
|
86
164
|
});
|
|
87
165
|
ch.socketRef = socket;
|
|
88
166
|
await socket.start();
|
|
167
|
+
if (!socket.isConnected()) {
|
|
168
|
+
let timer;
|
|
169
|
+
try {
|
|
170
|
+
await Promise.race([connected, new Promise((_, reject) => {
|
|
171
|
+
timer = setTimeout(() => reject(new AixTimeout("device channel connection timed out")), 1e4);
|
|
172
|
+
})]);
|
|
173
|
+
} catch (error) {
|
|
174
|
+
ch.close();
|
|
175
|
+
throw error;
|
|
176
|
+
} finally {
|
|
177
|
+
clearTimeout(timer);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
89
180
|
return ch;
|
|
90
181
|
}
|
|
91
182
|
nextId() {
|
|
@@ -119,9 +210,92 @@ var DeviceChannel = class _DeviceChannel {
|
|
|
119
210
|
this.scriptletListeners.add(cb);
|
|
120
211
|
return () => this.scriptletListeners.delete(cb);
|
|
121
212
|
}
|
|
213
|
+
if (event === "network_adb") {
|
|
214
|
+
this.networkAdbListeners.add(cb);
|
|
215
|
+
return () => this.networkAdbListeners.delete(cb);
|
|
216
|
+
}
|
|
122
217
|
this.statusListeners.add(cb);
|
|
123
218
|
return () => this.statusListeners.delete(cb);
|
|
124
219
|
}
|
|
220
|
+
/** Permission is scoped to this socket only; an ack does not establish an ADB byte connection. */
|
|
221
|
+
get networkAdbState() {
|
|
222
|
+
return { enabled: this.networkAdbEnabled, socketConnected: !this.channelClosed && this.socketRef.isConnected() };
|
|
223
|
+
}
|
|
224
|
+
emitNetworkAdb() {
|
|
225
|
+
const state = this.networkAdbState;
|
|
226
|
+
for (const cb of this.networkAdbListeners) {
|
|
227
|
+
try {
|
|
228
|
+
cb(state);
|
|
229
|
+
} catch {
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
resetNetworkAdb() {
|
|
234
|
+
this.networkAdbGeneration++;
|
|
235
|
+
this.networkAdbEnabled = false;
|
|
236
|
+
this.networkAdbStreams.clear();
|
|
237
|
+
for (const tun of this.tunnels.values()) tun._end("socket disconnected");
|
|
238
|
+
this.tunnels.clear();
|
|
239
|
+
for (const [, p] of this.pending) {
|
|
240
|
+
clearTimeout(p.timer);
|
|
241
|
+
p.reject(new AixError("socket disconnected", "offline"));
|
|
242
|
+
}
|
|
243
|
+
this.pending.clear();
|
|
244
|
+
this.emitNetworkAdb();
|
|
245
|
+
}
|
|
246
|
+
setNetworkAdb(enabled) {
|
|
247
|
+
const intent = ++this.networkAdbIntent;
|
|
248
|
+
if (enabled === false) {
|
|
249
|
+
this.networkAdbEnabled = false;
|
|
250
|
+
for (const id of this.networkAdbStreams) {
|
|
251
|
+
try {
|
|
252
|
+
this.tunnels.get(id)?.close();
|
|
253
|
+
} catch {
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
this.networkAdbStreams.clear();
|
|
257
|
+
this.emitNetworkAdb();
|
|
258
|
+
}
|
|
259
|
+
const next = this.networkAdbOperation.then(() => this.applyNetworkAdb(enabled, intent));
|
|
260
|
+
this.networkAdbOperation = next.catch(() => {
|
|
261
|
+
this.close();
|
|
262
|
+
});
|
|
263
|
+
return next;
|
|
264
|
+
}
|
|
265
|
+
async applyNetworkAdb(enabled, intent) {
|
|
266
|
+
if (typeof enabled !== "boolean") throw new AixProtocolError("network_adb enabled must be boolean");
|
|
267
|
+
if (this.channelClosed || !this.socketRef.isConnected()) throw new AixError("socket not connected", "offline");
|
|
268
|
+
const generation = this.networkAdbGeneration;
|
|
269
|
+
const value = await this.request({ t: "network_adb", enabled });
|
|
270
|
+
if (generation !== this.networkAdbGeneration || this.channelClosed) throw new AixError("socket disconnected", "offline");
|
|
271
|
+
if (typeof value !== "object" || value === null || value.enabled !== enabled) {
|
|
272
|
+
throw new AixProtocolError("invalid network_adb acknowledgment");
|
|
273
|
+
}
|
|
274
|
+
if (intent !== this.networkAdbIntent) return { enabled: false };
|
|
275
|
+
this.networkAdbEnabled = enabled;
|
|
276
|
+
if (!enabled) {
|
|
277
|
+
this.networkAdbStreams.clear();
|
|
278
|
+
}
|
|
279
|
+
this.emitNetworkAdb();
|
|
280
|
+
return { enabled };
|
|
281
|
+
}
|
|
282
|
+
/** Opens raw ADB bytes on this granted channel, not a local TCP listener. */
|
|
283
|
+
async openNetworkAdbTunnel() {
|
|
284
|
+
if (!this.networkAdbEnabled || this.channelClosed || !this.socketRef.isConnected()) {
|
|
285
|
+
throw new AixError("network ADB is not granted on this socket", "auth");
|
|
286
|
+
}
|
|
287
|
+
const tun = this.openTunnel("adb");
|
|
288
|
+
try {
|
|
289
|
+
await tun.waitReady();
|
|
290
|
+
return tun;
|
|
291
|
+
} catch (e) {
|
|
292
|
+
try {
|
|
293
|
+
tun.close();
|
|
294
|
+
} catch {
|
|
295
|
+
}
|
|
296
|
+
throw e;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
125
299
|
fridaRun(script, target, spawn = false) {
|
|
126
300
|
return this.request({ t: "frida_run", script, target, spawn });
|
|
127
301
|
}
|
|
@@ -159,6 +333,15 @@ var DeviceChannel = class _DeviceChannel {
|
|
|
159
333
|
return;
|
|
160
334
|
}
|
|
161
335
|
}
|
|
336
|
+
if (frame.t === "close") {
|
|
337
|
+
const raw = frame;
|
|
338
|
+
if (typeof raw.stream === "string") this.endTunnel(raw.stream, typeof raw.code === "string" ? raw.code : "remote closed");
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
if (isStatusFrame(frame) && typeof frame.stream === "string") {
|
|
342
|
+
if (frame.state === "opened") this.tunnels.get(frame.stream)?._opened();
|
|
343
|
+
else if (frame.state === "error") this.endTunnel(frame.stream, frame.detail ?? "stream error");
|
|
344
|
+
}
|
|
162
345
|
if (isFridaEventFrame(frame)) {
|
|
163
346
|
const { t: _t, ...payload } = frame;
|
|
164
347
|
for (const cb of this.fridaListeners) cb(payload);
|
|
@@ -175,13 +358,28 @@ var DeviceChannel = class _DeviceChannel {
|
|
|
175
358
|
return;
|
|
176
359
|
}
|
|
177
360
|
}
|
|
361
|
+
endTunnel(streamId, reason) {
|
|
362
|
+
this.tunnels.get(streamId)?._end(reason);
|
|
363
|
+
this.tunnels.delete(streamId);
|
|
364
|
+
this.networkAdbStreams.delete(streamId);
|
|
365
|
+
}
|
|
178
366
|
openTunnel(kind, addr) {
|
|
179
367
|
if (this.channelClosed) throw new AixError("channel is closed", "offline");
|
|
180
368
|
if (!this.socketRef.isConnected()) throw new AixError("socket not connected", "offline");
|
|
369
|
+
if (kind === "adb" && !this.networkAdbEnabled) throw new AixError("network ADB is not granted on this socket", "auth");
|
|
181
370
|
const streamId = globalThis.crypto?.randomUUID?.() ?? fallbackUuid();
|
|
182
|
-
const send = (frame) =>
|
|
183
|
-
|
|
371
|
+
const send = (frame) => {
|
|
372
|
+
const text = JSON.stringify(frame);
|
|
373
|
+
if (kind === "adb" && frame.t === "data") this.socketRef.sendBounded(text, 1048576);
|
|
374
|
+
else this.socketRef.send(text);
|
|
375
|
+
};
|
|
376
|
+
const tun = new DeviceTunnel(streamId, send, () => kind !== "adb" || this.networkAdbEnabled && this.networkAdbStreams.has(streamId));
|
|
184
377
|
this.tunnels.set(streamId, tun);
|
|
378
|
+
if (kind === "adb") this.networkAdbStreams.add(streamId);
|
|
379
|
+
tun.onClose(() => {
|
|
380
|
+
this.tunnels.delete(streamId);
|
|
381
|
+
this.networkAdbStreams.delete(streamId);
|
|
382
|
+
});
|
|
185
383
|
send({ t: "open", stream: streamId, kind, addr });
|
|
186
384
|
return tun;
|
|
187
385
|
}
|
|
@@ -193,6 +391,9 @@ var DeviceChannel = class _DeviceChannel {
|
|
|
193
391
|
}
|
|
194
392
|
close() {
|
|
195
393
|
this.channelClosed = true;
|
|
394
|
+
this.networkAdbEnabled = false;
|
|
395
|
+
this.networkAdbGeneration++;
|
|
396
|
+
this.emitNetworkAdb();
|
|
196
397
|
for (const tun of this.tunnels.values()) {
|
|
197
398
|
try {
|
|
198
399
|
tun.close();
|
|
@@ -200,6 +401,7 @@ var DeviceChannel = class _DeviceChannel {
|
|
|
200
401
|
}
|
|
201
402
|
}
|
|
202
403
|
this.tunnels.clear();
|
|
404
|
+
this.networkAdbStreams.clear();
|
|
203
405
|
for (const [, p] of this.pending) {
|
|
204
406
|
clearTimeout(p.timer);
|
|
205
407
|
p.reject(new AixError("channel closed", "offline"));
|
|
@@ -557,13 +759,20 @@ var MirrorSession = class _MirrorSession {
|
|
|
557
759
|
let open = false;
|
|
558
760
|
let joined = false;
|
|
559
761
|
let stopped = false;
|
|
762
|
+
let viewerToken = "";
|
|
560
763
|
const joinIfReady = () => {
|
|
561
|
-
if (stopped || !open || joined || !ms || ms.left) return;
|
|
764
|
+
if (stopped || !open || joined || !ms || ms.left || !viewerToken) return;
|
|
562
765
|
joined = true;
|
|
563
|
-
ms.
|
|
766
|
+
ms.token = viewerToken;
|
|
767
|
+
ms.sendSignal({ type: "join", session, role: "viewer", token: viewerToken });
|
|
564
768
|
};
|
|
565
769
|
const socket = new ReconnectingSocket({
|
|
566
|
-
|
|
770
|
+
// Each socket open mints against the backend that will accept the join.
|
|
771
|
+
// A process restart drops the in-memory grant; reusing the old token stays black.
|
|
772
|
+
urlProvider: async () => {
|
|
773
|
+
viewerToken = await mintViewerToken(resolved, session);
|
|
774
|
+
return signalWsUrl(resolved.baseUrl);
|
|
775
|
+
},
|
|
567
776
|
wsFactory: resolved.wsFactory,
|
|
568
777
|
onOpen: () => {
|
|
569
778
|
if (!open) {
|
|
@@ -595,10 +804,11 @@ var MirrorSession = class _MirrorSession {
|
|
|
595
804
|
};
|
|
596
805
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
597
806
|
try {
|
|
598
|
-
const [iceServers
|
|
599
|
-
Promise.all([getIceServers(resolved),
|
|
807
|
+
const [iceServers] = await Promise.race([
|
|
808
|
+
Promise.all([getIceServers(resolved), socket.start()]),
|
|
600
809
|
aborted
|
|
601
810
|
]);
|
|
811
|
+
const token = viewerToken;
|
|
602
812
|
if (stopped || signal?.aborted) throw abortError();
|
|
603
813
|
ms = new _MirrorSession(resolved, session, socket, iceServers, token);
|
|
604
814
|
joinIfReady();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { IpCommercePanel } from './chunk-JQBSGFAR.js';
|
|
2
|
+
import { IosDeviceDiagnostics } from './chunk-RFOJSDYI.js';
|
|
3
3
|
import { canConnectPhysicalDevice } from './chunk-ZB5ET67B.js';
|
|
4
|
-
import { useAixT } from './chunk-FJPIY4YI.js';
|
|
5
4
|
import { cn, Select, Dialog, Button, Input, Badge } from './chunk-7RQTSTR6.js';
|
|
6
|
-
import {
|
|
5
|
+
import { useAixT } from './chunk-HQ2L4NQ2.js';
|
|
6
|
+
import { useNodes, useClient, useDevices } from './chunk-UEZVXYGP.js';
|
|
7
7
|
import { useState, useEffect, useMemo, useCallback, useRef } from 'react';
|
|
8
8
|
import { Server, RefreshCw, Smartphone, Usb, Wifi, Info } from 'lucide-react';
|
|
9
9
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -208,9 +208,9 @@ function VirtualSpecStep({ spec, onChange, nodeId, onValidityChange }) {
|
|
|
208
208
|
os_version: void 0,
|
|
209
209
|
android_version: void 0,
|
|
210
210
|
model: void 0,
|
|
211
|
-
// Android
|
|
212
|
-
frida: next === "android" ?
|
|
213
|
-
kernelsu: next === "android" ?
|
|
211
|
+
// Only Android virtual devices offer these optional development capabilities.
|
|
212
|
+
frida: next === "android" ? false : void 0,
|
|
213
|
+
kernelsu: next === "android" ? false : void 0
|
|
214
214
|
});
|
|
215
215
|
};
|
|
216
216
|
const setImage = (id) => {
|
|
@@ -320,11 +320,6 @@ function VirtualSpecStep({ spec, onChange, nodeId, onValidityChange }) {
|
|
|
320
320
|
if (!brand) return;
|
|
321
321
|
patch({ model: pickModel(brand) });
|
|
322
322
|
}, [brand, av, catalog]);
|
|
323
|
-
useEffect(() => {
|
|
324
|
-
if (platform === "android" && (spec.frida === void 0 || spec.kernelsu === void 0)) {
|
|
325
|
-
patch({ frida: spec.frida ?? true, kernelsu: spec.kernelsu ?? true });
|
|
326
|
-
}
|
|
327
|
-
}, [platform]);
|
|
328
323
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
329
324
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
330
325
|
/* @__PURE__ */ jsx("label", { className: "text-[11px] text-muted-foreground", children: "\u5E73\u53F0 platform" }),
|
|
@@ -403,7 +398,34 @@ function VirtualSpecStep({ spec, onChange, nodeId, onValidityChange }) {
|
|
|
403
398
|
),
|
|
404
399
|
/* @__PURE__ */ jsx("p", { className: "mt-0.5 text-[10px] text-muted-foreground/60", children: "auto:\u8282\u70B9\u6709 GPU \u81EA\u52A8\u786C\u4EF6\u52A0\u901F,\u65E0 GPU \u81EA\u52A8\u8F6F\u4EF6\u6E32\u67D3\u3002\u4E00\u955C\u50CF\u901A\u5403,\u65E0\u9700\u4E3A GPU \u5355\u72EC\u51FA\u955C\u50CF\u3002" })
|
|
405
400
|
] }),
|
|
406
|
-
platform === "android" && /* @__PURE__ */
|
|
401
|
+
platform === "android" && /* @__PURE__ */ jsxs("fieldset", { className: "space-y-2 rounded-md border border-border p-3", children: [
|
|
402
|
+
/* @__PURE__ */ jsx("legend", { className: "px-1 text-xs font-medium text-foreground", children: "\u5F00\u53D1\u8C03\u8BD5\u9009\u9879\uFF08\u9ED8\u8BA4\u4E0D\u989D\u5916\u8BF7\u6C42\uFF09" }),
|
|
403
|
+
/* @__PURE__ */ jsxs("label", { className: "flex min-h-11 cursor-pointer items-center gap-3 text-sm text-foreground", children: [
|
|
404
|
+
/* @__PURE__ */ jsx(
|
|
405
|
+
"input",
|
|
406
|
+
{
|
|
407
|
+
type: "checkbox",
|
|
408
|
+
checked: spec.kernelsu === true,
|
|
409
|
+
onChange: (e) => patch({ kernelsu: e.target.checked }),
|
|
410
|
+
className: "h-4 w-4 shrink-0 accent-primary"
|
|
411
|
+
}
|
|
412
|
+
),
|
|
413
|
+
"\u542F\u7528 Root\uFF08KernelSU\uFF09"
|
|
414
|
+
] }),
|
|
415
|
+
/* @__PURE__ */ jsxs("label", { className: "flex min-h-11 cursor-pointer items-center gap-3 text-sm text-foreground", children: [
|
|
416
|
+
/* @__PURE__ */ jsx(
|
|
417
|
+
"input",
|
|
418
|
+
{
|
|
419
|
+
type: "checkbox",
|
|
420
|
+
checked: spec.frida === true,
|
|
421
|
+
onChange: (e) => patch({ frida: e.target.checked }),
|
|
422
|
+
className: "h-4 w-4 shrink-0 accent-primary"
|
|
423
|
+
}
|
|
424
|
+
),
|
|
425
|
+
"\u542F\u7528 Frida \u52A8\u6001\u8C03\u8BD5"
|
|
426
|
+
] }),
|
|
427
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "\u9ED8\u8BA4\u4E0D\u8BF7\u6C42\u989D\u5916 Root \u6216 Frida \u914D\u7F6E\uFF0C\u4E0D\u8868\u793A\u6240\u9009\u955C\u50CF\u672C\u8EAB\u5DF2\u5173\u95ED\u8FD9\u4E9B\u80FD\u529B\uFF1B\u5B9E\u9645\u53EF\u7528\u6027\u53D6\u51B3\u4E8E\u955C\u50CF\u4E0E\u8282\u70B9\u652F\u6301\u3002\u4EC5\u65B0\u5EFA\u8BBE\u5907\u65F6\u914D\u7F6E\uFF0C\u4FEE\u6539\u73B0\u6709\u8BBE\u5907\u53EF\u80FD\u9700\u8981\u91CD\u5EFA\u3002" })
|
|
428
|
+
] })
|
|
407
429
|
] });
|
|
408
430
|
}
|
|
409
431
|
function AddWirelessDeviceDialog({ open, onClose, nodeId: initialNode, platform: initialPlatform }) {
|
|
@@ -810,11 +832,14 @@ function RealDiscoverStep({ nodeId, picked, onPick }) {
|
|
|
810
832
|
}
|
|
811
833
|
|
|
812
834
|
// src/ui/devices/proxy.ts
|
|
813
|
-
function
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
835
|
+
function customProxyAddress(value) {
|
|
836
|
+
if (!isSupportedProxyUrl(value) || !value) return null;
|
|
837
|
+
const url = new URL(value);
|
|
838
|
+
return `${url.hostname}:${Number(value.slice(value.lastIndexOf(":") + 1))}`;
|
|
839
|
+
}
|
|
840
|
+
function safeCustomProxyAddress(value) {
|
|
841
|
+
if (typeof value !== "string" || !/^[A-Za-z0-9._-]+:[0-9]{1,5}$/.test(value)) return null;
|
|
842
|
+
return customProxyAddress(`http://${value}`) === value ? value : null;
|
|
818
843
|
}
|
|
819
844
|
function isRedactedProxyUrl(value) {
|
|
820
845
|
return value.includes(":***@");
|
|
@@ -835,6 +860,11 @@ function isSupportedProxyUrl(value) {
|
|
|
835
860
|
return false;
|
|
836
861
|
}
|
|
837
862
|
}
|
|
863
|
+
function normalizeManualProxyUrl(value) {
|
|
864
|
+
const trimmed = value.trim();
|
|
865
|
+
const candidate = /^[A-Za-z0-9.-]+:[0-9]{1,5}$/.test(trimmed) ? `http://${trimmed}` : /^http:\/\/[A-Za-z0-9.-]+:[0-9]{1,5}\/$/.test(trimmed) ? trimmed.slice(0, -1) : trimmed;
|
|
866
|
+
return candidate !== trimmed && isSupportedProxyUrl(candidate) ? candidate : trimmed;
|
|
867
|
+
}
|
|
838
868
|
function proxySummaryFromDevice(device) {
|
|
839
869
|
const value = device?.meta && typeof device.meta.proxy_summary === "object" ? device.meta.proxy_summary : null;
|
|
840
870
|
if (!value || Array.isArray(value)) return null;
|
|
@@ -912,7 +942,7 @@ var LOCALE_OPTIONS = [
|
|
|
912
942
|
function ProxySpoofStep({ spec, onChange, isReal, showProxy = !isReal, proxyDisabled = false, proxyAction }) {
|
|
913
943
|
const proxy = spec.proxy ?? "";
|
|
914
944
|
const locale = spec.config?.locale ?? "";
|
|
915
|
-
const proxyInvalid = proxy.trim().length > 0 && !isSupportedProxyUrl(proxy
|
|
945
|
+
const proxyInvalid = proxy.trim().length > 0 && !isSupportedProxyUrl(normalizeManualProxyUrl(proxy));
|
|
916
946
|
const setProxy = (url) => {
|
|
917
947
|
const trimmed = url.trim();
|
|
918
948
|
if (!trimmed) {
|
|
@@ -941,11 +971,12 @@ function ProxySpoofStep({ spec, onChange, isReal, showProxy = !isReal, proxyDisa
|
|
|
941
971
|
disabled: proxyDisabled,
|
|
942
972
|
value: proxy,
|
|
943
973
|
onChange: (e) => setProxy(e.target.value),
|
|
974
|
+
onBlur: () => setProxy(normalizeManualProxyUrl(proxy)),
|
|
944
975
|
placeholder: "http://host:8080 \u6216 http://user:password@host:8080",
|
|
945
976
|
className: proxyInvalid ? "border-destructive" : void 0
|
|
946
977
|
}
|
|
947
978
|
),
|
|
948
|
-
/* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: proxyDisabled ? "\u5F53\u524D\u8282\u70B9\u6682\u4E0D\u652F\u6301\u4EE3\u7406\uFF0C\u8BBE\u5907\u5C06\u4F7F\u7528\u8282\u70B9\u7F51\u7EDC\u3002" : "\u586B\u5199 HTTP \u4EE3\u7406\u5730\u5740\uFF1B\u7528\u6237\u540D\u548C\u5BC6\u7801\u53EF\u9009\u3002\u7559\u7A7A\u5219\u4F7F\u7528\u8282\u70B9\u7F51\u7EDC\u3002" }),
|
|
979
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: proxyDisabled ? "\u5F53\u524D\u8282\u70B9\u6682\u4E0D\u652F\u6301\u4EE3\u7406\uFF0C\u8BBE\u5907\u5C06\u4F7F\u7528\u8282\u70B9\u7F51\u7EDC\u3002" : "\u586B\u5199 HTTP \u4EE3\u7406\u5730\u5740\uFF08\u5982 http://proxy.example.com:7890\uFF09\uFF1B\u7528\u6237\u540D\u548C\u5BC6\u7801\u53EF\u9009\u3002\u4EC5\u5728\u652F\u6301\u7684 Windows/WSL \u8282\u70B9\uFF0C127.0.0.1 \u624D\u6620\u5C04\u5230\u5BBF\u4E3B\u673A WSL \u7F51\u5173\uFF1B\u4EE3\u7406\u987B\u76D1\u542C\u53EF\u4ECE\u8BE5\u7F51\u5173\u8BBF\u95EE\u7684\u5730\u5740\uFF0C\u4E0D\u80FD\u53EA\u7ED1\u5B9A\u56DE\u73AF\u5730\u5740\u3002\u7559\u7A7A\u5219\u4F7F\u7528\u8282\u70B9\u7F51\u7EDC\u3002" }),
|
|
949
980
|
proxyInvalid && /* @__PURE__ */ jsx("p", { className: "mt-1 text-[11px] text-destructive", children: "\u8BF7\u8F93\u5165 http://\u4E3B\u673A:\u7AEF\u53E3 \u6216 http://\u7528\u6237\u540D:\u5BC6\u7801@\u4E3B\u673A:\u7AEF\u53E3\uFF1B\u4E0D\u652F\u6301 socks/https\u3002" }),
|
|
950
981
|
proxyAction
|
|
951
982
|
] })
|
|
@@ -980,7 +1011,7 @@ function createProxyCapabilities(kind, spec, node) {
|
|
|
980
1011
|
const custom = android && cap?.supported === true;
|
|
981
1012
|
return { custom, managed: custom && cap?.revision_fencing === true && node?.reported_caps?.device_provision_v2 === true };
|
|
982
1013
|
}
|
|
983
|
-
var emptySpec = { platform: "android" };
|
|
1014
|
+
var emptySpec = { platform: "android", frida: false, kernelsu: false };
|
|
984
1015
|
function DeviceCreate({ open, onClose, onCreated }) {
|
|
985
1016
|
const client = useClient();
|
|
986
1017
|
const t = useAixT();
|
|
@@ -1013,7 +1044,7 @@ function DeviceCreate({ open, onClose, onCreated }) {
|
|
|
1013
1044
|
setAixipsOpen(false);
|
|
1014
1045
|
setManagedPending(false);
|
|
1015
1046
|
}, [open]);
|
|
1016
|
-
const proxyOk = kind !== "virtual" || !spec.proxy?.trim() || proxyCapabilities.custom && isSupportedProxyUrl(spec.proxy
|
|
1047
|
+
const proxyOk = kind !== "virtual" || !spec.proxy?.trim() || proxyCapabilities.custom && isSupportedProxyUrl(normalizeManualProxyUrl(spec.proxy));
|
|
1017
1048
|
const canNext = (() => {
|
|
1018
1049
|
if (step === 0) return true;
|
|
1019
1050
|
if (step === 1) return !!nodeId;
|
|
@@ -1043,6 +1074,7 @@ function DeviceCreate({ open, onClose, onCreated }) {
|
|
|
1043
1074
|
}
|
|
1044
1075
|
const provisionSpec = { ...spec, node_id: nodeId };
|
|
1045
1076
|
if (kind !== "virtual" || !provisionSpec.proxy?.trim()) delete provisionSpec.proxy;
|
|
1077
|
+
else provisionSpec.proxy = normalizeManualProxyUrl(provisionSpec.proxy);
|
|
1046
1078
|
setBusy(true);
|
|
1047
1079
|
setError("");
|
|
1048
1080
|
try {
|
|
@@ -1218,4 +1250,4 @@ function TypeCard({
|
|
|
1218
1250
|
);
|
|
1219
1251
|
}
|
|
1220
1252
|
|
|
1221
|
-
export { AddWirelessDeviceDialog, DeviceCreate, NodePicker, ProxySpoofStep, RealDiscoverStep, VirtualSpecStep, createProxyProbeGuard, deviceProxyCapabilities, isProxyApplyStatus, isProxyProbeUnsupported, isRedactedProxyUrl, isSupportedProxyUrl, proxyCapabilityReason, proxyProbeExitIp, proxyProbeMessage, proxySummaryFromDevice,
|
|
1253
|
+
export { AddWirelessDeviceDialog, DeviceCreate, NodePicker, ProxySpoofStep, RealDiscoverStep, VirtualSpecStep, createProxyProbeGuard, customProxyAddress, deviceProxyCapabilities, isProxyApplyStatus, isProxyProbeUnsupported, isRedactedProxyUrl, isSupportedProxyUrl, normalizeManualProxyUrl, proxyCapabilityReason, proxyProbeExitIp, proxyProbeMessage, proxySummaryFromDevice, safeCustomProxyAddress, usesAndroidSystemProxy };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ControlBar, MirrorView } from './chunk-MBBVYSPD.js';
|
|
2
2
|
import { canConnectPhysicalDevice } from './chunk-ZB5ET67B.js';
|
|
3
|
-
import { useAixT } from './chunk-FJPIY4YI.js';
|
|
4
3
|
import { Dialog, Select, Button, useToast, ToastViewport, Popover } from './chunk-7RQTSTR6.js';
|
|
5
|
-
import {
|
|
4
|
+
import { useAixT } from './chunk-HQ2L4NQ2.js';
|
|
5
|
+
import { useClient, useDevices, useMirror, createAgentTaskRunner, useTaskAgentRun } from './chunk-UEZVXYGP.js';
|
|
6
6
|
import { useState, useRef, useEffect, useId, useCallback, useMemo } from 'react';
|
|
7
7
|
import { ClipboardPaste, Wrench, Check, Settings2, VolumeX, Volume2, RotateCw, X, PanelsTopLeft, Minimize2, Maximize2, Rocket, Loader2, Square, Video, Download } from 'lucide-react';
|
|
8
8
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|