dsh-apk-vm 0.6.2 → 0.8.1

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/client.js CHANGED
@@ -30,7 +30,7 @@ window.__ModuleLoader__.load({
30
30
  var SWIPE_THRESHOLD_PX = 24;
31
31
  var FRAME_INTERVAL_MS = 500;
32
32
  var STATE_INTERVAL_MS = 2000;
33
- var CLIENT_VERSION = '0.2.1';
33
+ var CLIENT_VERSION = '0.8.1';
34
34
 
35
35
  /* ------------------------------------------------------------------ *
36
36
  * Optional dsh-better-sidebar integration.
@@ -53,6 +53,26 @@ window.__ModuleLoader__.load({
53
53
  return betterSidebar;
54
54
  }
55
55
 
56
+ function readUiFlag(key, fallback) {
57
+ try {
58
+ if (typeof window === 'undefined' || !window.localStorage) return fallback;
59
+ var value = window.localStorage.getItem(key);
60
+ return value === null ? fallback : value === '1';
61
+ } catch (error) {
62
+ return fallback;
63
+ }
64
+ }
65
+
66
+ function writeUiFlag(key, value) {
67
+ try {
68
+ if (typeof window !== 'undefined' && window.localStorage) {
69
+ window.localStorage.setItem(key, value ? '1' : '0');
70
+ }
71
+ } catch (error) {
72
+ /* localStorage may be unavailable in hardened webviews */
73
+ }
74
+ }
75
+
56
76
  function publishBetterSidebar(next) {
57
77
  if (betterSidebar === next) return;
58
78
  betterSidebar = next;
@@ -105,6 +125,18 @@ window.__ModuleLoader__.load({
105
125
  'action.openSidebar': 'Open in side bar',
106
126
  'action.expand': 'Expand',
107
127
  'action.restore': 'Exit expanded',
128
+ 'action.float': 'Float window',
129
+ 'action.dock': 'Dock panel',
130
+ 'action.tools': 'Tools',
131
+ 'action.hideTools': 'Hide tools',
132
+ 'stream.quality': 'Quality',
133
+ 'stream.quality.low': 'Low 540p · 30 fps',
134
+ 'stream.quality.balanced': 'Balanced 720p · 60 fps',
135
+ 'stream.quality.high': 'High 960p · 60 fps',
136
+ 'stream.quality.custom': 'Custom',
137
+ 'stage.firstBoot': 'First boot can take ~30 s; later starts use the quick-boot snapshot.',
138
+ 'version.mismatch': 'The panel UI is stale (client {client}, host {host}). Reload the panel; if it stays stale, restart DSH once.',
139
+ 'version.reload': 'Reload UI',
108
140
  'a11y.refresh': 'Refresh VM state',
109
141
  'a11y.retry': 'Retry the request',
110
142
  'a11y.openSidebar': 'Open the APK VM in dsh-better-sidebar',
@@ -159,7 +191,12 @@ window.__ModuleLoader__.load({
159
191
  'debug.liveStop': 'Stop live',
160
192
  'debug.crash': 'Crash log',
161
193
  'debug.clipboardSet': 'Copy field to device',
162
- 'debug.clipboardGet': 'Get device clipboard',
194
+ 'debug.clipboardGet': 'Copy device clipboard to host',
195
+ 'debug.clipboardPasteHost': 'Paste host clipboard to device',
196
+ 'debug.clipboardPasteHostDone': 'Host clipboard pasted to device',
197
+ 'debug.clipboardUnavailable': 'Browser clipboard is unavailable; use the field instead',
198
+ 'debug.visualTest': 'UI check',
199
+ 'debug.visualTestDone': 'UI check complete',
163
200
  'debug.clipboardEmpty': 'Type text in the input field first',
164
201
  'debug.clipboardSetDone': 'Device clipboard updated',
165
202
  'debug.clipboardGot': 'Device clipboard copied to host',
@@ -208,6 +245,10 @@ window.__ModuleLoader__.load({
208
245
  'network.testFail': 'Connectivity check failed',
209
246
  'network.pcap': 'Download pcap',
210
247
  'network.pcapPath': 'Host pcap path (.pcap, next start)',
248
+ 'network.harPath': 'HAR file path (.har)',
249
+ 'network.harLoad': 'Load HAR',
250
+ 'network.harLoaded': 'HAR loaded',
251
+ 'network.harEmpty': 'No matching requests.',
211
252
  'network.restartRequired': 'Restart the VM to apply custom DNS',
212
253
  'network.sharedHint': 'Shared forwards are reachable from other VMs through the emulator host alias.',
213
254
  'network.guestUrl': 'Guest URL: {url}',
@@ -222,6 +263,15 @@ window.__ModuleLoader__.load({
222
263
  'flow.saved': 'Saved {name}',
223
264
  'flow.done': 'Replayed {name}',
224
265
  'flow.count': '{n} step(s)',
266
+ 'snapshots.title': 'VM snapshots',
267
+ 'snapshots.placeholder': 'snapshot name',
268
+ 'snapshots.save': 'Save',
269
+ 'snapshots.restore': 'Restore',
270
+ 'snapshots.delete': 'Delete',
271
+ 'snapshots.empty': 'No named snapshots yet.',
272
+ 'snapshots.saved': 'Snapshot saved: {name}',
273
+ 'snapshots.restored': 'Restored snapshot: {name}',
274
+ 'snapshots.deleted': 'Deleted snapshot: {name}',
225
275
  'storage.title': 'Storage',
226
276
  'storage.refresh': 'Refresh',
227
277
  'storage.cleanTemp': 'Clean temp',
@@ -249,6 +299,9 @@ window.__ModuleLoader__.load({
249
299
  'setup.installImage': 'Download image',
250
300
  'setup.installTools': 'Install SDK tools',
251
301
  'setup.bootstrapSdk': 'Bootstrap SDK',
302
+ 'setup.oneClick': 'One-click setup',
303
+ 'setup.oneClickRunning': 'Setting up SDK, image and AVD…',
304
+ 'setup.oneClickDone': 'Setup finished; starting the VM…',
252
305
  'setup.refresh': 'Re-check',
253
306
  'setup.switch': 'Switch AVD',
254
307
  'setup.loading': 'Checking environment…',
@@ -260,12 +313,25 @@ window.__ModuleLoader__.load({
260
313
  'instances.created': 'Created instance {id}',
261
314
  'instances.destroyed': 'Destroyed instance {id}',
262
315
  'instances.manage': 'VM instances',
316
+ 'grid.title': 'Grid view',
317
+ 'grid.empty': 'No running instances to show.',
318
+ 'grid.close': 'Close grid',
263
319
  'instances.stop': 'Stop',
264
320
  'instances.stopped': 'Stopped instance {id}',
265
321
  'instances.idle': 'idle {seconds}s',
266
322
  'devices.title': 'Physical/remote adb device',
267
323
  'devices.select': 'Select device…',
268
324
  'devices.attach': 'Attach',
325
+ 'devices.remotePlaceholder': 'host:port',
326
+ 'remote.title': 'Remote VM (SSH)',
327
+ 'remote.host': 'SSH host',
328
+ 'remote.user': 'SSH user',
329
+ 'remote.key': 'SSH key path (optional)',
330
+ 'remote.remotePort': 'Remote adb port',
331
+ 'remote.connect': 'Connect tunnel',
332
+ 'remote.disconnect': 'Disconnect',
333
+ 'remote.connected': 'SSH tunnel connected',
334
+ 'remote.disconnected': 'SSH tunnel closed',
269
335
  'devices.detach': 'Detach',
270
336
  'devices.attached': 'Attached {serial}',
271
337
  'devices.detached': 'Detached external device',
@@ -276,8 +342,16 @@ window.__ModuleLoader__.load({
276
342
  'apps.empty': 'No third-party apps installed.',
277
343
  'apps.thirdParty': 'third-party only',
278
344
  'apps.stop': 'Stop',
345
+ 'apps.launch': 'Launch',
279
346
  'apps.clear': 'Clear data',
280
347
  'apps.uninstall': 'Uninstall',
348
+ 'apps.deepLink': 'Deep link',
349
+ 'apps.deepLinkPlaceholder': 'myapp://path or https://…',
350
+ 'apps.openDeepLink': 'Open link',
351
+ 'apps.permission': 'Permission',
352
+ 'apps.permissionPlaceholder': 'android.permission.CAMERA',
353
+ 'apps.grant': 'Grant',
354
+ 'apps.revoke': 'Revoke',
281
355
  'apps.done': '{action}: {packageName}',
282
356
  'debug.empty': 'No debug output yet.',
283
357
  'debug.identity': '{release} · API {sdk} · {abi}',
@@ -340,6 +414,18 @@ window.__ModuleLoader__.load({
340
414
  'action.openSidebar': '在侧栏打开',
341
415
  'action.expand': '放大',
342
416
  'action.restore': '退出放大',
417
+ 'action.float': '浮窗',
418
+ 'action.dock': '停靠面板',
419
+ 'action.tools': '工具',
420
+ 'action.hideTools': '收起工具',
421
+ 'stream.quality': '清晰度',
422
+ 'stream.quality.low': '低 540p · 30 fps',
423
+ 'stream.quality.balanced': '均衡 720p · 60 fps',
424
+ 'stream.quality.high': '高 960p · 60 fps',
425
+ 'stream.quality.custom': '自定义',
426
+ 'stage.firstBoot': '首次启动约需 30 秒;之后会使用快速启动快照。',
427
+ 'version.mismatch': '面板 UI 是旧缓存(客户端 {client},主机 {host})。刷新面板;仍不更新则重启一次 DSH。',
428
+ 'version.reload': '刷新 UI',
343
429
  'a11y.refresh': '刷新虚拟机状态',
344
430
  'a11y.retry': '重试请求',
345
431
  'a11y.openSidebar': '在 dsh-better-sidebar 中打开 APK 虚拟机',
@@ -394,7 +480,12 @@ window.__ModuleLoader__.load({
394
480
  'debug.liveStop': '停止实时',
395
481
  'debug.crash': '崩溃日志',
396
482
  'debug.clipboardSet': '文本写入设备剪贴板',
397
- 'debug.clipboardGet': '读取设备剪贴板',
483
+ 'debug.clipboardGet': '复制设备剪贴板到电脑',
484
+ 'debug.clipboardPasteHost': '把电脑剪贴板粘贴到设备',
485
+ 'debug.clipboardPasteHostDone': '已把电脑剪贴板写入设备',
486
+ 'debug.clipboardUnavailable': '浏览器剪贴板不可用,请改用输入框',
487
+ 'debug.visualTest': 'UI 检查',
488
+ 'debug.visualTestDone': 'UI 检查完成',
398
489
  'debug.clipboardEmpty': '请先在上方输入框输入文本',
399
490
  'debug.clipboardSetDone': '已写入设备剪贴板',
400
491
  'debug.clipboardGot': '已复制设备剪贴板到主机',
@@ -443,6 +534,10 @@ window.__ModuleLoader__.load({
443
534
  'network.testFail': '连通性检查失败',
444
535
  'network.pcap': '下载 pcap',
445
536
  'network.pcapPath': '宿主机 pcap 路径(.pcap,下次启动)',
537
+ 'network.harPath': 'HAR 文件路径(.har)',
538
+ 'network.harLoad': '加载 HAR',
539
+ 'network.harLoaded': 'HAR 已加载',
540
+ 'network.harEmpty': '没有匹配的请求。',
446
541
  'network.restartRequired': '重启虚拟机后生效自定义 DNS',
447
542
  'network.sharedHint': '共享转发可被其他 VM 通过模拟器宿主别名访问。',
448
543
  'network.guestUrl': 'Guest URL: {url}',
@@ -457,6 +552,15 @@ window.__ModuleLoader__.load({
457
552
  'flow.saved': '已保存 {name}',
458
553
  'flow.done': '已回放 {name}',
459
554
  'flow.count': '{n} 步',
555
+ 'snapshots.title': 'VM 快照',
556
+ 'snapshots.placeholder': '快照名称',
557
+ 'snapshots.save': '保存',
558
+ 'snapshots.restore': '恢复',
559
+ 'snapshots.delete': '删除',
560
+ 'snapshots.empty': '还没有命名快照。',
561
+ 'snapshots.saved': '已保存快照:{name}',
562
+ 'snapshots.restored': '已恢复快照:{name}',
563
+ 'snapshots.deleted': '已删除快照:{name}',
460
564
  'storage.title': '存储',
461
565
  'storage.refresh': '刷新',
462
566
  'storage.cleanTemp': '清理临时文件',
@@ -484,6 +588,9 @@ window.__ModuleLoader__.load({
484
588
  'setup.installImage': '下载镜像',
485
589
  'setup.installTools': '安装 SDK 工具',
486
590
  'setup.bootstrapSdk': '从零安装 SDK',
591
+ 'setup.oneClick': '一键初始化',
592
+ 'setup.oneClickRunning': '正在安装 SDK、镜像并创建 AVD…',
593
+ 'setup.oneClickDone': '初始化完成,正在启动虚拟机…',
487
594
  'setup.refresh': '重新检测',
488
595
  'setup.switch': '切换 AVD',
489
596
  'setup.loading': '正在检测环境…',
@@ -495,12 +602,25 @@ window.__ModuleLoader__.load({
495
602
  'instances.created': '已创建实例 {id}',
496
603
  'instances.destroyed': '已销毁实例 {id}',
497
604
  'instances.manage': '虚拟机实例',
605
+ 'grid.title': '网格视图',
606
+ 'grid.empty': '没有正在运行的实例。',
607
+ 'grid.close': '关闭网格',
498
608
  'instances.stop': '停止',
499
609
  'instances.stopped': '已停止实例 {id}',
500
610
  'instances.idle': '空闲 {seconds}s',
501
611
  'devices.title': '物理/远程 adb 设备',
502
612
  'devices.select': '选择设备…',
503
613
  'devices.attach': '连接',
614
+ 'devices.remotePlaceholder': '主机:端口',
615
+ 'remote.title': '远程 VM(SSH)',
616
+ 'remote.host': 'SSH 主机',
617
+ 'remote.user': 'SSH 用户',
618
+ 'remote.key': 'SSH 私钥路径(可选)',
619
+ 'remote.remotePort': '远端 adb 端口',
620
+ 'remote.connect': '连接隧道',
621
+ 'remote.disconnect': '断开',
622
+ 'remote.connected': 'SSH 隧道已连接',
623
+ 'remote.disconnected': 'SSH 隧道已关闭',
504
624
  'devices.detach': '断开',
505
625
  'devices.attached': '已连接 {serial}',
506
626
  'devices.detached': '已断开外部设备',
@@ -511,8 +631,16 @@ window.__ModuleLoader__.load({
511
631
  'apps.empty': '没有已安装的第三方应用。',
512
632
  'apps.thirdParty': '仅第三方',
513
633
  'apps.stop': '停止',
634
+ 'apps.launch': '启动',
514
635
  'apps.clear': '清数据',
515
636
  'apps.uninstall': '卸载',
637
+ 'apps.deepLink': 'Deep Link',
638
+ 'apps.deepLinkPlaceholder': 'myapp://path 或 https://…',
639
+ 'apps.openDeepLink': '打开链接',
640
+ 'apps.permission': '权限',
641
+ 'apps.permissionPlaceholder': 'android.permission.CAMERA',
642
+ 'apps.grant': '授予',
643
+ 'apps.revoke': '撤销',
516
644
  'apps.done': '{action}:{packageName}',
517
645
  'debug.empty': '暂无调试输出。',
518
646
  'debug.identity': '{release} · API {sdk} · {abi}',
@@ -1070,7 +1198,7 @@ window.__ModuleLoader__.load({
1070
1198
  '@media (max-width:900px){.apkvm-header{flex-wrap:wrap}}' +
1071
1199
  '.apkvm-embedded .apkvm-header{flex-wrap:wrap}' +
1072
1200
  '.apkvm-page.apkvm-maximized{position:fixed;inset:0;z-index:2147483000;width:100vw;height:100vh;background:var(--dsw-alias-bg-base);box-shadow:0 0 0 1px var(--dsw-alias-border-l2)}' +
1073
- '.apkvm-page.apkvm-maximized .apkvm-header{flex:0 0 auto;background:var(--dsw-alias-bg-base)}' +
1201
+ '.apkvm-page.apkvm-maximized .apkvm-header{flex:0 0 auto;background:var(--dsw-alias-bg-base);padding-right:142px}' +
1074
1202
  '.apkvm-page.apkvm-maximized .apkvm-body{flex:1 1 auto;min-height:0;padding:10px 16px 14px;gap:10px;overflow:hidden;flex-direction:row}' +
1075
1203
  '.apkvm-page.apkvm-maximized .apkvm-aside{display:none}' +
1076
1204
  '.apkvm-page.apkvm-maximized .apkvm-stage{flex:1 1 auto;min-height:0;max-height:none}' +
@@ -1078,7 +1206,28 @@ window.__ModuleLoader__.load({
1078
1206
  '.apkvm-page.apkvm-maximized .apkvm-phone{height:100%;max-height:calc(100vh - 150px);padding:6px;border-radius:22px}' +
1079
1207
  '.apkvm-page.apkvm-maximized .apkvm-screen{height:100%;max-height:calc(100vh - 170px);border-radius:16px}' +
1080
1208
  '.apkvm-page.apkvm-maximized .apkvm-controls{max-width:760px}' +
1081
- '.apkvm-page.apkvm-maximized .apkvm-stagehint{max-width:760px}';
1209
+ '.apkvm-page.apkvm-maximized .apkvm-stagehint{max-width:760px}' +
1210
+ '.apkvm-page.apkvm-maximized .apkvm-subtitle,.apkvm-page.apkvm-maximized .apkvm-pillmeta{display:none}' +
1211
+ '.apkvm-page.apkvm-tools-collapsed .apkvm-aside{display:none}' +
1212
+ '.apkvm-max-close{position:absolute;top:9px;right:12px;z-index:6;appearance:none;font:inherit;font-size:12px;font-weight:600;height:30px;padding:0 12px;border-radius:8px;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);cursor:pointer}' +
1213
+ '.apkvm-max-close:hover{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-brand-primary)}' +
1214
+ '.apkvm-quality{font:inherit;font-size:11px;height:24px;max-width:150px;padding:0 5px;border-radius:7px;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary);flex:none}' +
1215
+ '.apkvm-version-banner{flex:0 0 auto}' +
1216
+ '.apkvm-version-banner .apkvm-banner-text{white-space:normal}' +
1217
+ '.apkvm-grid-overlay{position:fixed;inset:0;z-index:2147483000;background:var(--dsw-alias-bg-base);display:flex;flex-direction:column;gap:10px;padding:12px 14px}' +
1218
+ '.apkvm-grid-head{display:flex;align-items:center;gap:8px;flex:0 0 auto}' +
1219
+ '.apkvm-grid{flex:1 1 auto;min-height:0;overflow:auto;display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:10px;align-content:start}' +
1220
+ '.apkvm-grid-card{appearance:none;font:inherit;text-align:left;cursor:pointer;border:1px solid var(--dsw-alias-border-l2);border-radius:12px;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);padding:8px;display:flex;flex-direction:column;gap:6px;min-height:260px}' +
1221
+ '.apkvm-grid-card:hover{border-color:var(--dsw-alias-brand-primary)}' +
1222
+ '.apkvm-grid-card img{flex:1 1 auto;min-height:0;width:100%;height:240px;object-fit:contain;background:var(--dsw-alias-bg-base);border-radius:8px}' +
1223
+ '.apkvm-grid-meta{display:flex;align-items:center;gap:6px;font-size:11px;color:var(--dsw-alias-label-secondary)}' +
1224
+ '.apkvm-page.apkvm-floating .apkvm-stage{position:fixed;right:14px;bottom:14px;z-index:2147483000;width:min(360px,92vw);height:min(700px,88vh);padding:6px;border:1px solid var(--dsw-alias-border-l2);border-radius:16px;background:var(--dsw-alias-bg-layer-1);overflow:hidden}' +
1225
+ '.apkvm-page.apkvm-floating .apkvm-stage .apkvm-phonewrap{min-height:0;flex:1 1 auto}' +
1226
+ '.apkvm-page.apkvm-floating .apkvm-stage .apkvm-phone{height:100%;padding:4px;border-radius:14px}' +
1227
+ '.apkvm-page.apkvm-floating .apkvm-stage .apkvm-screen{border-radius:11px}' +
1228
+ '.apkvm-page.apkvm-floating .apkvm-stage .apkvm-controls{gap:3px;max-width:100%}' +
1229
+ '.apkvm-page.apkvm-floating .apkvm-stage .apkvm-textrow{display:none}' +
1230
+ '.apkvm-page.apkvm-floating .apkvm-stage .apkvm-stagehint{display:none}';
1082
1231
 
1083
1232
  /* ------------------------------------------------------------------ *
1084
1233
  * Render-error boundary: an unexpected exception inside the panel keeps
@@ -1186,6 +1335,15 @@ window.__ModuleLoader__.load({
1186
1335
  var appActionBusyState = React.useState('');
1187
1336
  var appActionBusy = appActionBusyState[0];
1188
1337
  var setAppActionBusy = appActionBusyState[1];
1338
+ var deepLinkState = React.useState('');
1339
+ var deepLink = deepLinkState[0];
1340
+ var setDeepLink = deepLinkState[1];
1341
+ var permissionPackageState = React.useState('');
1342
+ var permissionPackage = permissionPackageState[0];
1343
+ var setPermissionPackage = permissionPackageState[1];
1344
+ var permissionNameState = React.useState('');
1345
+ var permissionName = permissionNameState[0];
1346
+ var setPermissionName = permissionNameState[1];
1189
1347
 
1190
1348
  var vmBusyState = React.useState(false);
1191
1349
  var vmBusy = vmBusyState[0];
@@ -1226,6 +1384,27 @@ window.__ModuleLoader__.load({
1226
1384
  var devicePickState = React.useState('');
1227
1385
  var devicePick = devicePickState[0];
1228
1386
  var setDevicePick = devicePickState[1];
1387
+ var remoteSerialState = React.useState('');
1388
+ var remoteSerial = remoteSerialState[0];
1389
+ var setRemoteSerial = remoteSerialState[1];
1390
+ var remoteHostState = React.useState('');
1391
+ var remoteHost = remoteHostState[0];
1392
+ var setRemoteHost = remoteHostState[1];
1393
+ var remoteUserState = React.useState('');
1394
+ var remoteUser = remoteUserState[0];
1395
+ var setRemoteUser = remoteUserState[1];
1396
+ var remoteKeyState = React.useState('');
1397
+ var remoteKey = remoteKeyState[0];
1398
+ var setRemoteKey = remoteKeyState[1];
1399
+ var remotePortState = React.useState('5558');
1400
+ var remotePort = remotePortState[0];
1401
+ var setRemotePort = remotePortState[1];
1402
+ var remoteSshBusyState = React.useState(false);
1403
+ var remoteSshBusy = remoteSshBusyState[0];
1404
+ var setRemoteSshBusy = remoteSshBusyState[1];
1405
+ var remoteSshState = React.useState(null);
1406
+ var remoteSsh = remoteSshState[0];
1407
+ var setRemoteSsh = remoteSshState[1];
1229
1408
  var deviceBusyState = React.useState(false);
1230
1409
  var deviceBusy = deviceBusyState[0];
1231
1410
  var setDeviceBusy = deviceBusyState[1];
@@ -1240,6 +1419,12 @@ window.__ModuleLoader__.load({
1240
1419
  var instancesListState = React.useState([]);
1241
1420
  var instancesList = instancesListState[0];
1242
1421
  var setInstancesList = instancesListState[1];
1422
+ var gridOpenState = React.useState(false);
1423
+ var gridOpen = gridOpenState[0];
1424
+ var setGridOpen = gridOpenState[1];
1425
+ var gridTickState = React.useState(Date.now());
1426
+ var gridTick = gridTickState[0];
1427
+ var setGridTick = gridTickState[1];
1243
1428
  var instanceBusyState = React.useState(false);
1244
1429
  var instanceBusy = instanceBusyState[0];
1245
1430
  var setInstanceBusy = instanceBusyState[1];
@@ -1303,6 +1488,15 @@ window.__ModuleLoader__.load({
1303
1488
  var storageConfirmState = React.useState('');
1304
1489
  var storageConfirm = storageConfirmState[0];
1305
1490
  var setStorageConfirm = storageConfirmState[1];
1491
+ var snapshotNamesState = React.useState([]);
1492
+ var snapshotNames = snapshotNamesState[0];
1493
+ var setSnapshotNames = snapshotNamesState[1];
1494
+ var snapshotInputState = React.useState('');
1495
+ var snapshotInput = snapshotInputState[0];
1496
+ var setSnapshotInput = snapshotInputState[1];
1497
+ var snapshotBusyState = React.useState('');
1498
+ var snapshotBusy = snapshotBusyState[0];
1499
+ var setSnapshotBusy = snapshotBusyState[1];
1306
1500
 
1307
1501
  var proxyState = React.useState({ host: '', port: '' });
1308
1502
  var proxy = proxyState[0];
@@ -1337,6 +1531,15 @@ window.__ModuleLoader__.load({
1337
1531
  var pcapPathState = React.useState('');
1338
1532
  var pcapPath = pcapPathState[0];
1339
1533
  var setPcapPath = pcapPathState[1];
1534
+ var harPathState = React.useState('');
1535
+ var harPath = harPathState[0];
1536
+ var setHarPath = harPathState[1];
1537
+ var harResultState = React.useState(null);
1538
+ var harResult = harResultState[0];
1539
+ var setHarResult = harResultState[1];
1540
+ var harBusyState = React.useState(false);
1541
+ var harBusy = harBusyState[0];
1542
+ var setHarBusy = harBusyState[1];
1340
1543
 
1341
1544
  var actualFpsState = React.useState(0);
1342
1545
  var actualFps = actualFpsState[0];
@@ -1388,12 +1591,31 @@ window.__ModuleLoader__.load({
1388
1591
  var decoderRef = React.useRef(null);
1389
1592
  var wsRef = React.useRef(null);
1390
1593
  var pageRef = React.useRef(null);
1391
- var maximizedState = React.useState(false);
1594
+ var maximizedState = React.useState(function () {
1595
+ return readUiFlag('apk-vm.maximized', false);
1596
+ });
1392
1597
  var isMaximized = maximizedState[0];
1393
1598
  var setIsMaximized = maximizedState[1];
1599
+ var toolsState = React.useState(!embedded);
1600
+ var toolsOpen = toolsState[0];
1601
+ var setToolsOpen = toolsState[1];
1602
+ var floatingState = React.useState(false);
1603
+ var isFloating = floatingState[0];
1604
+ var setIsFloating = floatingState[1];
1605
+ var qualityBusyState = React.useState('');
1606
+ var qualityBusy = qualityBusyState[0];
1607
+ var setQualityBusy = qualityBusyState[1];
1394
1608
 
1395
1609
  /* ---- derived snapshot values --------------------------------- */
1396
1610
  var vmInfo = snapshot ? snapshot.vm : null;
1611
+ var hostVersion = snapshot && snapshot.pluginVersion ? String(snapshot.pluginVersion) : '';
1612
+ var versionMismatch = Boolean(hostVersion && hostVersion !== CLIENT_VERSION);
1613
+ var h264Status =
1614
+ snapshot && isObject(snapshot.stream) && isObject(snapshot.stream.h264)
1615
+ ? snapshot.stream.h264
1616
+ : null;
1617
+ var streamPreset = h264Status && h264Status.preset ? String(h264Status.preset) : 'custom';
1618
+ var streamQualityValue = qualityBusy || streamPreset;
1397
1619
  var clientReport = snapshot && isObject(snapshot.client) ? snapshot.client : null;
1398
1620
  var wsOrigin = snapshot && snapshot.origin ? snapshot.origin : '';
1399
1621
  var apkInfo = snapshot ? snapshot.apk : null;
@@ -1451,6 +1673,7 @@ window.__ModuleLoader__.load({
1451
1673
  pillMeta.push(T(bootKey, { s: bootSeconds }));
1452
1674
  }
1453
1675
  }
1676
+ pillMeta.push('v' + CLIENT_VERSION);
1454
1677
  var subtitleText = apkInfo
1455
1678
  ? T('apk.current', { name: apkInfo.label || apkInfo.packageName || apkInfo.path })
1456
1679
  : T('subtitle');
@@ -1543,9 +1766,22 @@ window.__ModuleLoader__.load({
1543
1766
  // Load network details once the VM becomes ready (the first render often
1544
1767
  // happens while the state is still loading).
1545
1768
  React.useEffect(function () {
1546
- if (ready) loadNetwork();
1769
+ if (ready) {
1770
+ loadNetwork();
1771
+ loadSnapshots();
1772
+ }
1547
1773
  }, [ready, activeInstance]);
1548
1774
 
1775
+ React.useEffect(function () {
1776
+ if (!gridOpen) return undefined;
1777
+ var timer = setInterval(function () {
1778
+ if (mountedRef.current) setGridTick(Date.now());
1779
+ }, 1500);
1780
+ return function () {
1781
+ clearInterval(timer);
1782
+ };
1783
+ }, [gridOpen]);
1784
+
1549
1785
  // Escape leaves the expanded VM view; the expand button is inside the
1550
1786
  // full-screen overlay too, so mouse-only users are never trapped.
1551
1787
  React.useEffect(function () {
@@ -1553,7 +1789,10 @@ window.__ModuleLoader__.load({
1553
1789
  return undefined;
1554
1790
  }
1555
1791
  function onKeyDown(event) {
1556
- if (event && event.key === 'Escape') setIsMaximized(false);
1792
+ if (event && event.key === 'Escape') {
1793
+ setIsMaximized(false);
1794
+ writeUiFlag('apk-vm.maximized', false);
1795
+ }
1557
1796
  }
1558
1797
  document.addEventListener('keydown', onKeyDown);
1559
1798
  return function () {
@@ -1920,6 +2159,11 @@ window.__ModuleLoader__.load({
1920
2159
  return id === 'default' ? '/apk-vm' + pathname : '/apk-vm/instances/' + encodeURIComponent(id) + pathname;
1921
2160
  }
1922
2161
 
2162
+ function instanceFrameSrc(id) {
2163
+ var prefix = id === 'default' ? '/apk-vm/frame' : '/apk-vm/instances/' + encodeURIComponent(id) + '/frame';
2164
+ return prefix + '?t=' + String(gridTick);
2165
+ }
2166
+
1923
2167
  function setActiveInstanceId(id) {
1924
2168
  var next = id || 'default';
1925
2169
  activeInstanceRef.current = next;
@@ -2272,6 +2516,64 @@ window.__ModuleLoader__.load({
2272
2516
  });
2273
2517
  }
2274
2518
 
2519
+ function toggleMaximized() {
2520
+ setIsMaximized(function (value) {
2521
+ var next = !value;
2522
+ writeUiFlag('apk-vm.maximized', next);
2523
+ return next;
2524
+ });
2525
+ }
2526
+
2527
+ function toggleTools() {
2528
+ setToolsOpen(function (value) {
2529
+ return !value;
2530
+ });
2531
+ }
2532
+
2533
+ function applyStreamQuality(preset) {
2534
+ if (!ready || qualityBusy || activeInstance !== 'default') return;
2535
+ setQualityBusy(preset);
2536
+ requestJson(
2537
+ '/apk-vm/stream/quality',
2538
+ { method: 'POST', body: JSON.stringify({ preset: preset }) },
2539
+ T
2540
+ ).then(function (result) {
2541
+ if (!mountedRef.current) return;
2542
+ setQualityBusy('');
2543
+ if (!result.ok) {
2544
+ pushToast('error', T('err.action') + ': ' + result.error);
2545
+ return;
2546
+ }
2547
+ pushToast('success', T('stream.quality') + ': ' + T('stream.quality.' + preset));
2548
+ loadState();
2549
+ });
2550
+ }
2551
+
2552
+ function reloadUi() {
2553
+ if (typeof window !== 'undefined' && window.location && typeof window.location.reload === 'function') {
2554
+ window.location.reload();
2555
+ }
2556
+ }
2557
+
2558
+ function loadHar() {
2559
+ var target = String(harPath || '').trim();
2560
+ if (harBusy || !target) return;
2561
+ setHarBusy(true);
2562
+ requestJson(instancePath('/network/har'), {
2563
+ method: 'POST',
2564
+ body: JSON.stringify({ path: target }),
2565
+ }, T).then(function (result) {
2566
+ if (!mountedRef.current) return;
2567
+ setHarBusy(false);
2568
+ if (!result.ok) {
2569
+ pushToast('error', (result.error || T('err.action')).slice(0, 500));
2570
+ return;
2571
+ }
2572
+ setHarResult(isObject(result.data) ? result.data : null);
2573
+ pushToast('success', T('network.harLoaded'));
2574
+ });
2575
+ }
2576
+
2275
2577
  function loadNetwork() {
2276
2578
  if (!ready) return Promise.resolve(null);
2277
2579
  setNetworkBusy('load');
@@ -2417,6 +2719,37 @@ window.__ModuleLoader__.load({
2417
2719
  });
2418
2720
  }
2419
2721
 
2722
+ function loadSnapshots() {
2723
+ return requestJson(instancePath('/snapshots'), null, T).then(function (result) {
2724
+ if (!mountedRef.current) return result;
2725
+ if (result.ok && isObject(result.data) && Array.isArray(result.data.names)) {
2726
+ setSnapshotNames(result.data.names);
2727
+ }
2728
+ return result;
2729
+ });
2730
+ }
2731
+
2732
+ function snapshotAction(action, name) {
2733
+ if (snapshotBusy) return;
2734
+ setSnapshotBusy(action + ':' + name);
2735
+ requestJson(instancePath('/snapshots'), {
2736
+ method: 'POST',
2737
+ body: JSON.stringify({ action: action, name: name }),
2738
+ }, T).then(function (result) {
2739
+ if (!mountedRef.current) return;
2740
+ setSnapshotBusy('');
2741
+ if (!result.ok) {
2742
+ pushToast('error', (result.error || T('err.action')).slice(0, 400));
2743
+ return;
2744
+ }
2745
+ var key = action === 'save' ? 'snapshots.saved' : action === 'load' ? 'snapshots.restored' : 'snapshots.deleted';
2746
+ pushToast('success', T(key, { name: name }));
2747
+ if (action === 'save') setSnapshotInput('');
2748
+ loadSnapshots();
2749
+ if (action === 'load') loadState();
2750
+ });
2751
+ }
2752
+
2420
2753
  function loadStorage() {
2421
2754
  setStorageBusy('load');
2422
2755
  setStorageError('');
@@ -2532,6 +2865,53 @@ window.__ModuleLoader__.load({
2532
2865
  });
2533
2866
  }
2534
2867
 
2868
+ function openDeepLinkAction() {
2869
+ if (!ready || appActionBusy) return;
2870
+ var target = String(deepLink || '').trim();
2871
+ if (!target) {
2872
+ pushToast('error', T('apps.deepLinkPlaceholder'));
2873
+ return;
2874
+ }
2875
+ setAppActionBusy('open-url');
2876
+ requestJson(instancePath('/debug/action'), {
2877
+ method: 'POST',
2878
+ body: JSON.stringify({ action: 'open-url', url: target }),
2879
+ }, T).then(function (result) {
2880
+ if (!mountedRef.current) return;
2881
+ setAppActionBusy('');
2882
+ if (!result.ok) {
2883
+ pushToast('error', (result.error || T('err.action')).slice(0, 400));
2884
+ return;
2885
+ }
2886
+ pushToast('success', T('apps.deepLink') + ': ' + target);
2887
+ loadState();
2888
+ });
2889
+ }
2890
+
2891
+ function changePermission(granted) {
2892
+ if (!ready || appActionBusy) return;
2893
+ var pkg = String(permissionPackage || '').trim();
2894
+ var permission = String(permissionName || '').trim();
2895
+ if (!pkg || !permission) {
2896
+ pushToast('error', T('apps.permissionPlaceholder'));
2897
+ return;
2898
+ }
2899
+ var action = granted ? 'grant' : 'revoke';
2900
+ setAppActionBusy(action + ':' + pkg);
2901
+ requestJson(instancePath('/debug/action'), {
2902
+ method: 'POST',
2903
+ body: JSON.stringify({ action: action, packageName: pkg, permission: permission }),
2904
+ }, T).then(function (result) {
2905
+ if (!mountedRef.current) return;
2906
+ setAppActionBusy('');
2907
+ if (!result.ok) {
2908
+ pushToast('error', (result.error || T('err.action')).slice(0, 400));
2909
+ return;
2910
+ }
2911
+ pushToast('success', T('apps.permission') + ': ' + permission);
2912
+ });
2913
+ }
2914
+
2535
2915
  function toggleApps() {
2536
2916
  var next = !appsOpen;
2537
2917
  setAppsOpen(next);
@@ -2612,6 +2992,70 @@ window.__ModuleLoader__.load({
2612
2992
  });
2613
2993
  }
2614
2994
 
2995
+ function attachRemoteDevice() {
2996
+ var serial = String(remoteSerial || '').trim();
2997
+ if (!serial || deviceBusy) return;
2998
+ setDeviceBusy(true);
2999
+ setDeviceError('');
3000
+ requestJson('/apk-vm/device', { method: 'POST', body: JSON.stringify({ serial: serial }) }, T).then(function (result) {
3001
+ if (!mountedRef.current) return;
3002
+ setDeviceBusy(false);
3003
+ if (!result.ok) {
3004
+ var data = isObject(result.data) ? result.data : {};
3005
+ pushToast('error', (data.error || result.error || T('err.action')).slice(0, 500));
3006
+ return;
3007
+ }
3008
+ pushToast('success', T('devices.attached', { serial: serial }));
3009
+ setRemoteSerial('');
3010
+ loadState();
3011
+ loadDevices();
3012
+ loadSetup(true);
3013
+ });
3014
+ }
3015
+
3016
+ function connectRemoteSsh() {
3017
+ if (remoteSshBusy || !remoteHost.trim() || !remoteUser.trim()) return;
3018
+ setRemoteSshBusy(true);
3019
+ requestJson('/apk-vm/remote', {
3020
+ method: 'POST',
3021
+ body: JSON.stringify({
3022
+ action: 'connect',
3023
+ host: remoteHost.trim(),
3024
+ user: remoteUser.trim(),
3025
+ keyPath: remoteKey.trim() || undefined,
3026
+ remotePort: Number(remotePort) || 5558,
3027
+ }),
3028
+ }, T).then(function (result) {
3029
+ if (!mountedRef.current) return;
3030
+ setRemoteSshBusy(false);
3031
+ if (!result.ok) {
3032
+ pushToast('error', (result.error || T('err.action')).slice(0, 500));
3033
+ return;
3034
+ }
3035
+ setRemoteSsh(result.data && result.data.tunnel ? result.data.tunnel : null);
3036
+ pushToast('success', T('remote.connected'));
3037
+ loadState();
3038
+ loadDevices();
3039
+ });
3040
+ }
3041
+
3042
+ function disconnectRemoteSsh() {
3043
+ if (remoteSshBusy) return;
3044
+ setRemoteSshBusy(true);
3045
+ requestJson('/apk-vm/remote', { method: 'POST', body: JSON.stringify({ action: 'disconnect' }) }, T).then(function (result) {
3046
+ if (!mountedRef.current) return;
3047
+ setRemoteSshBusy(false);
3048
+ if (!result.ok) {
3049
+ pushToast('error', (result.error || T('err.action')).slice(0, 500));
3050
+ return;
3051
+ }
3052
+ setRemoteSsh(null);
3053
+ pushToast('success', T('remote.disconnected'));
3054
+ loadState();
3055
+ loadDevices();
3056
+ });
3057
+ }
3058
+
2615
3059
  function detachDevice() {
2616
3060
  if (deviceBusy) return;
2617
3061
  setDeviceBusy(true);
@@ -2633,7 +3077,11 @@ window.__ModuleLoader__.load({
2633
3077
  function runSetupAction(action) {
2634
3078
  if (setupBusy) return;
2635
3079
  setSetupBusy(true);
2636
- requestJson('/apk-vm/setup', { method: 'POST', body: JSON.stringify({ action: action }) }, T).then(function (result) {
3080
+ requestJson(
3081
+ '/apk-vm/setup',
3082
+ { method: 'POST', body: JSON.stringify({ action: action, confirmDownload: true }) },
3083
+ T
3084
+ ).then(function (result) {
2637
3085
  if (!mountedRef.current) return;
2638
3086
  setSetupBusy(false);
2639
3087
  var data = isObject(result.data) ? result.data : {};
@@ -2648,6 +3096,57 @@ window.__ModuleLoader__.load({
2648
3096
  });
2649
3097
  }
2650
3098
 
3099
+ function runOneClickSetup() {
3100
+ if (setupBusy) return;
3101
+ var order = ['bootstrap-sdk', 'install-tools', 'install-image', 'create-avd'];
3102
+ var steps = order.filter(function (id) {
3103
+ return (setupActions || []).some(function (entry) {
3104
+ return entry.id === id;
3105
+ });
3106
+ });
3107
+ if (!steps.length) {
3108
+ pushToast('error', T('setup.ok'));
3109
+ return;
3110
+ }
3111
+ setSetupBusy(true);
3112
+ pushToast('success', T('setup.oneClickRunning'));
3113
+ var failed = false;
3114
+ var chain = Promise.resolve();
3115
+ steps.forEach(function (action) {
3116
+ chain = chain.then(function () {
3117
+ if (failed) return null;
3118
+ return requestJson(
3119
+ '/apk-vm/setup',
3120
+ { method: 'POST', body: JSON.stringify({ action: action, confirmDownload: true }) },
3121
+ T
3122
+ ).then(function (result) {
3123
+ var data = isObject(result.data) ? result.data : {};
3124
+ if (!result.ok || data.ok === false) {
3125
+ failed = true;
3126
+ var detail = data.result && data.result.error ? data.result.error : (data.result && data.result.output ? data.result.output : result.error || '');
3127
+ pushToast('error', String(detail || T('err.state')).slice(0, 500));
3128
+ }
3129
+ });
3130
+ });
3131
+ });
3132
+ chain
3133
+ .then(function () {
3134
+ if (!mountedRef.current) return;
3135
+ setSetupBusy(false);
3136
+ loadSetup(true);
3137
+ loadState();
3138
+ if (!failed) {
3139
+ pushToast('success', T('setup.oneClickDone'));
3140
+ runVmAction('start');
3141
+ }
3142
+ })
3143
+ .catch(function (error) {
3144
+ if (!mountedRef.current) return;
3145
+ setSetupBusy(false);
3146
+ pushToast('error', String(error && error.message ? error.message : error).slice(0, 500));
3147
+ });
3148
+ }
3149
+
2651
3150
  /* ---- actions -------------------------------------------------- */
2652
3151
  function pushToast(kind, text) {
2653
3152
  if (!mountedRef.current) return;
@@ -2872,6 +3371,9 @@ window.__ModuleLoader__.load({
2872
3371
  });
2873
3372
  }
2874
3373
 
3374
+ // Clipboard is intentionally passive: host clipboard is read or written
3375
+ // only inside these explicit click handlers. Never poll, listen to
3376
+ // clipboard events, or sync in the background.
2875
3377
  function setDeviceClipboard() {
2876
3378
  if (!ready) return;
2877
3379
  var text = String(textInput == null ? '' : textInput);
@@ -2909,6 +3411,61 @@ window.__ModuleLoader__.load({
2909
3411
  });
2910
3412
  }
2911
3413
 
3414
+ function pasteHostClipboardToDevice() {
3415
+ if (!ready) return;
3416
+ if (
3417
+ typeof navigator === 'undefined' ||
3418
+ !navigator.clipboard ||
3419
+ typeof navigator.clipboard.readText !== 'function'
3420
+ ) {
3421
+ pushToast('error', T('debug.clipboardUnavailable'));
3422
+ return;
3423
+ }
3424
+ navigator.clipboard.readText().then(
3425
+ function (text) {
3426
+ if (!mountedRef.current) return;
3427
+ if (!text) {
3428
+ pushToast('error', T('debug.clipboardEmpty'));
3429
+ return;
3430
+ }
3431
+ requestJson(
3432
+ instancePath('/clipboard'),
3433
+ { method: 'POST', body: JSON.stringify({ text: text, paste: false }) },
3434
+ T
3435
+ ).then(function (result) {
3436
+ if (!mountedRef.current) return;
3437
+ if (!result.ok) {
3438
+ pushToast('error', (result.error || T('err.action')).slice(0, 300));
3439
+ return;
3440
+ }
3441
+ setDebugOutput('clipboard host -> device (' + text.length + ' chars)');
3442
+ pushToast('success', T('debug.clipboardPasteHostDone'));
3443
+ });
3444
+ },
3445
+ function () {
3446
+ pushToast('error', T('debug.clipboardUnavailable'));
3447
+ }
3448
+ );
3449
+ }
3450
+
3451
+ function runUiTest() {
3452
+ if (!ready || debugBusy) return;
3453
+ setDebugBusy(true);
3454
+ requestJson(instancePath('/ui-test'), {
3455
+ method: 'POST',
3456
+ body: JSON.stringify({ name: 'panel', assertions: [], updateBaseline: false }),
3457
+ }, T).then(function (result) {
3458
+ if (!mountedRef.current) return;
3459
+ setDebugBusy(false);
3460
+ if (!result.ok) {
3461
+ pushToast('error', (result.error || T('err.action')).slice(0, 500));
3462
+ return;
3463
+ }
3464
+ setDebugOutput(String((result.data && (result.data.markdown || result.data.report)) || ''));
3465
+ pushToast('success', T('debug.visualTestDone'));
3466
+ });
3467
+ }
3468
+
2912
3469
  function runDebugInfo() {
2913
3470
  runDebugRequest(instancePath('/debug/info'), null, function (data) {
2914
3471
  return JSON.stringify(data, null, 2);
@@ -3474,6 +4031,31 @@ window.__ModuleLoader__.load({
3474
4031
  h(
3475
4032
  'div',
3476
4033
  { className: 'apkvm-toolsline' },
4034
+ h('input', {
4035
+ className: 'apkvm-input',
4036
+ type: 'text',
4037
+ value: remoteSerial,
4038
+ placeholder: T('devices.remotePlaceholder'),
4039
+ spellCheck: false,
4040
+ disabled: deviceBusy,
4041
+ style: { flex: '0 1 96px', minWidth: '0' },
4042
+ onChange: function (event) {
4043
+ setRemoteSerial(event && event.target ? String(event.target.value) : '');
4044
+ },
4045
+ }),
4046
+ h(
4047
+ 'button',
4048
+ {
4049
+ type: 'button',
4050
+ className: 'apkvm-mini',
4051
+ disabled: deviceBusy || !remoteSerial.trim(),
4052
+ onClick: function (event) {
4053
+ event.preventDefault();
4054
+ attachRemoteDevice();
4055
+ },
4056
+ },
4057
+ T('devices.attach')
4058
+ ),
3477
4059
  h(
3478
4060
  'select',
3479
4061
  {
@@ -3523,6 +4105,15 @@ window.__ModuleLoader__.load({
3523
4105
  h(
3524
4106
  'div',
3525
4107
  { style: { display: 'flex', alignItems: 'center', gap: '5px', flexWrap: 'wrap' } },
4108
+ setupActions.length > 1
4109
+ ? actionBtn(T('setup.oneClick'), {
4110
+ key: 'setup-one-click',
4111
+ small: true,
4112
+ variant: 'primary',
4113
+ disabled: setupBusy,
4114
+ onClick: runOneClickSetup,
4115
+ })
4116
+ : null,
3526
4117
  setupActions.map(function (entry) {
3527
4118
  var label = entry.id === 'create-avd'
3528
4119
  ? T('setup.createAvd')
@@ -3584,7 +4175,7 @@ window.__ModuleLoader__.load({
3584
4175
  ref: fileInputRef,
3585
4176
  className: 'apkvm-fileinput',
3586
4177
  type: 'file',
3587
- accept: '.apk,.apks,.xapk,application/vnd.android.package-archive,application/octet-stream',
4178
+ accept: '.apk,.apks,.xapk,.aab,application/vnd.android.package-archive,application/octet-stream',
3588
4179
  onChange: onFileInputChange,
3589
4180
  'aria-label': T('upload.button'),
3590
4181
  }),
@@ -3766,6 +4357,89 @@ window.__ModuleLoader__.load({
3766
4357
  ),
3767
4358
  h('span', { className: 'apkvm-dim' }, T('apps.thirdParty'))
3768
4359
  ),
4360
+ h(
4361
+ 'div',
4362
+ { style: { display: 'flex', alignItems: 'center', gap: '4px', flexWrap: 'wrap' } },
4363
+ h('input', {
4364
+ className: 'apkvm-input',
4365
+ type: 'text',
4366
+ value: deepLink,
4367
+ placeholder: T('apps.deepLinkPlaceholder'),
4368
+ spellCheck: false,
4369
+ disabled: !ready || Boolean(appActionBusy),
4370
+ style: { flex: '1 1 160px', minWidth: '0' },
4371
+ onChange: function (event) {
4372
+ setDeepLink(event && event.target ? String(event.target.value) : '');
4373
+ },
4374
+ }),
4375
+ h(
4376
+ 'button',
4377
+ {
4378
+ type: 'button',
4379
+ className: 'apkvm-mini',
4380
+ disabled: !ready || Boolean(appActionBusy) || !deepLink.trim(),
4381
+ onClick: function (event) {
4382
+ event.preventDefault();
4383
+ openDeepLinkAction();
4384
+ },
4385
+ },
4386
+ T('apps.openDeepLink')
4387
+ )
4388
+ ),
4389
+ h(
4390
+ 'div',
4391
+ { style: { display: 'flex', alignItems: 'center', gap: '4px', flexWrap: 'wrap' } },
4392
+ h('input', {
4393
+ className: 'apkvm-input',
4394
+ type: 'text',
4395
+ value: permissionPackage,
4396
+ placeholder: 'package',
4397
+ spellCheck: false,
4398
+ disabled: !ready || Boolean(appActionBusy),
4399
+ style: { flex: '0 1 120px', minWidth: '0' },
4400
+ onChange: function (event) {
4401
+ setPermissionPackage(event && event.target ? String(event.target.value) : '');
4402
+ },
4403
+ }),
4404
+ h('input', {
4405
+ className: 'apkvm-input',
4406
+ type: 'text',
4407
+ value: permissionName,
4408
+ placeholder: T('apps.permissionPlaceholder'),
4409
+ spellCheck: false,
4410
+ disabled: !ready || Boolean(appActionBusy),
4411
+ style: { flex: '1 1 150px', minWidth: '0' },
4412
+ onChange: function (event) {
4413
+ setPermissionName(event && event.target ? String(event.target.value) : '');
4414
+ },
4415
+ }),
4416
+ h(
4417
+ 'button',
4418
+ {
4419
+ type: 'button',
4420
+ className: 'apkvm-mini',
4421
+ disabled: !ready || Boolean(appActionBusy) || !permissionPackage.trim() || !permissionName.trim(),
4422
+ onClick: function (event) {
4423
+ event.preventDefault();
4424
+ changePermission(true);
4425
+ },
4426
+ },
4427
+ T('apps.grant')
4428
+ ),
4429
+ h(
4430
+ 'button',
4431
+ {
4432
+ type: 'button',
4433
+ className: 'apkvm-mini',
4434
+ disabled: !ready || Boolean(appActionBusy) || !permissionPackage.trim() || !permissionName.trim(),
4435
+ onClick: function (event) {
4436
+ event.preventDefault();
4437
+ changePermission(false);
4438
+ },
4439
+ },
4440
+ T('apps.revoke')
4441
+ )
4442
+ ),
3769
4443
  appsError ? h('div', { className: 'apkvm-error' }, appsError) : null,
3770
4444
  installedApps.length
3771
4445
  ? h(
@@ -3781,6 +4455,19 @@ window.__ModuleLoader__.load({
3781
4455
  h(
3782
4456
  'span',
3783
4457
  { className: 'apkvm-appactions' },
4458
+ h(
4459
+ 'button',
4460
+ {
4461
+ type: 'button',
4462
+ className: 'apkvm-mini',
4463
+ disabled: !ready || Boolean(appActionBusy),
4464
+ onClick: function (event) {
4465
+ event.preventDefault();
4466
+ runAppAction('launch', pkg);
4467
+ },
4468
+ },
4469
+ T('apps.launch')
4470
+ ),
3784
4471
  h(
3785
4472
  'button',
3786
4473
  {
@@ -3890,6 +4577,7 @@ window.__ModuleLoader__.load({
3890
4577
  onClick: toggleLiveLogcat,
3891
4578
  }),
3892
4579
  actionBtn(T('debug.crash'), { key: 'debug-crash', small: true, disabled: !ready || debugBusy, onClick: runCrashLogcat }),
4580
+ actionBtn(T('debug.visualTest'), { key: 'debug-ui-test', small: true, disabled: !ready || debugBusy, onClick: runUiTest }),
3893
4581
  actionBtn(T('debug.clipboardSet'), {
3894
4582
  key: 'debug-clipboard-set',
3895
4583
  small: true,
@@ -3902,6 +4590,12 @@ window.__ModuleLoader__.load({
3902
4590
  disabled: !ready,
3903
4591
  onClick: getDeviceClipboard,
3904
4592
  }),
4593
+ actionBtn(T('debug.clipboardPasteHost'), {
4594
+ key: 'debug-clipboard-paste-host',
4595
+ small: true,
4596
+ disabled: !ready,
4597
+ onClick: pasteHostClipboardToDevice,
4598
+ }),
3905
4599
  actionBtn(T('debug.props'), { key: 'debug-props', small: true, disabled: !ready || debugBusy, onClick: runDebugInfo }),
3906
4600
  actionBtn(T('debug.rootAction'), { key: 'debug-root', small: true, disabled: !ready || debugBusy || rootActive, onClick: runDebugRoot }),
3907
4601
  actionBtn(T('debug.ui'), { key: 'debug-ui', small: true, disabled: !ready || debugBusy, onClick: runDebugUi }),
@@ -4266,6 +4960,57 @@ window.__ModuleLoader__.load({
4266
4960
  },
4267
4961
  'aria-label': T('network.pcapPath'),
4268
4962
  }),
4963
+ h(
4964
+ 'div',
4965
+ { style: { display: 'flex', alignItems: 'center', gap: '4px', flexWrap: 'wrap' } },
4966
+ h('input', {
4967
+ className: 'apkvm-input',
4968
+ type: 'text',
4969
+ value: harPath,
4970
+ placeholder: T('network.harPath'),
4971
+ spellCheck: false,
4972
+ disabled: harBusy,
4973
+ style: { flex: '1 1 150px', minWidth: '0' },
4974
+ onChange: function (event) {
4975
+ setHarPath(event && event.target ? String(event.target.value) : '');
4976
+ },
4977
+ }),
4978
+ actionBtn(harBusy ? '…' : T('network.harLoad'), {
4979
+ key: 'har-load',
4980
+ small: true,
4981
+ disabled: harBusy || !harPath.trim(),
4982
+ onClick: loadHar,
4983
+ })
4984
+ ),
4985
+ harResult && harResult.summary
4986
+ ? h(
4987
+ 'div',
4988
+ { className: 'apkvm-dim' },
4989
+ 'HAR ' +
4990
+ harResult.summary.total +
4991
+ ' · 2xx ' +
4992
+ (harResult.summary.statusClasses && harResult.summary.statusClasses['2xx'] ? harResult.summary.statusClasses['2xx'] : 0) +
4993
+ ' · 4xx ' +
4994
+ (harResult.summary.statusClasses && harResult.summary.statusClasses['4xx'] ? harResult.summary.statusClasses['4xx'] : 0) +
4995
+ ' · 5xx ' +
4996
+ (harResult.summary.statusClasses && harResult.summary.statusClasses['5xx'] ? harResult.summary.statusClasses['5xx'] : 0) +
4997
+ ' · ' +
4998
+ formatBytes(harResult.summary.totalBytes || 0)
4999
+ )
5000
+ : null,
5001
+ harResult && Array.isArray(harResult.entries) && harResult.entries.length
5002
+ ? h(
5003
+ 'div',
5004
+ { style: { display: 'flex', flexDirection: 'column', gap: '2px', maxHeight: '130px', overflow: 'auto' } },
5005
+ harResult.entries.slice(0, 10).map(function (entry, index) {
5006
+ return h(
5007
+ 'div',
5008
+ { key: 'har-entry-' + index, className: 'apkvm-dim', title: entry.curl || entry.url, style: { overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } },
5009
+ String(entry.method || '') + ' ' + String(entry.status || '') + ' · ' + String(entry.url || '')
5010
+ );
5011
+ })
5012
+ )
5013
+ : null,
4269
5014
  h(
4270
5015
  'div',
4271
5016
  { style: { display: 'flex', alignItems: 'center', gap: '5px', flexWrap: 'wrap' } },
@@ -4417,6 +5162,153 @@ window.__ModuleLoader__.load({
4417
5162
  )
4418
5163
  );
4419
5164
 
5165
+ var snapshotCard = h(
5166
+ 'details',
5167
+ { className: 'apkvm-card apkvm-debug' },
5168
+ h(
5169
+ 'div',
5170
+ { className: 'apkvm-debug-summary', style: { cursor: 'default' } },
5171
+ h('span', { className: 'apkvm-card-title' }, T('snapshots.title')),
5172
+ h('span', { className: 'apkvm-dim', style: { marginLeft: 'auto' } }, String(snapshotNames.length))
5173
+ ),
5174
+ h(
5175
+ 'div',
5176
+ { className: 'apkvm-debug-body' },
5177
+ h(
5178
+ 'div',
5179
+ { style: { display: 'flex', alignItems: 'center', gap: '4px', flexWrap: 'wrap' } },
5180
+ h('input', {
5181
+ className: 'apkvm-input',
5182
+ type: 'text',
5183
+ value: snapshotInput,
5184
+ placeholder: T('snapshots.placeholder'),
5185
+ spellCheck: false,
5186
+ disabled: Boolean(snapshotBusy),
5187
+ style: { flex: '1 1 120px', minWidth: '0' },
5188
+ onChange: function (event) {
5189
+ setSnapshotInput(event && event.target ? String(event.target.value) : '');
5190
+ },
5191
+ }),
5192
+ actionBtn(T('snapshots.save'), {
5193
+ key: 'snapshot-save',
5194
+ small: true,
5195
+ disabled: !ready || Boolean(snapshotBusy) || !snapshotInput.trim(),
5196
+ onClick: function () {
5197
+ snapshotAction('save', snapshotInput.trim());
5198
+ },
5199
+ })
5200
+ ),
5201
+ snapshotNames.length
5202
+ ? snapshotNames.map(function (name) {
5203
+ return h(
5204
+ 'div',
5205
+ { key: 'snapshot-' + name, style: { display: 'flex', alignItems: 'center', gap: '3px' } },
5206
+ h('span', { className: 'apkvm-dim', style: { flex: '1 1 auto', minWidth: '0', overflow: 'hidden', textOverflow: 'ellipsis' } }, name),
5207
+ actionBtn(T('snapshots.restore'), {
5208
+ key: 'snapshot-restore-' + name,
5209
+ small: true,
5210
+ disabled: Boolean(snapshotBusy) || !ready,
5211
+ onClick: function () {
5212
+ snapshotAction('load', name);
5213
+ },
5214
+ }),
5215
+ actionBtn(T('snapshots.delete'), {
5216
+ key: 'snapshot-delete-' + name,
5217
+ small: true,
5218
+ variant: 'danger',
5219
+ disabled: Boolean(snapshotBusy),
5220
+ onClick: function () {
5221
+ snapshotAction('delete', name);
5222
+ },
5223
+ })
5224
+ );
5225
+ })
5226
+ : h('div', { className: 'apkvm-dim' }, T('snapshots.empty'))
5227
+ )
5228
+ );
5229
+
5230
+ var remoteCard = h(
5231
+ 'details',
5232
+ { className: 'apkvm-card apkvm-debug' },
5233
+ h(
5234
+ 'summary',
5235
+ { className: 'apkvm-debug-summary' },
5236
+ h('span', { className: 'apkvm-card-title' }, T('remote.title')),
5237
+ h('span', { className: 'apkvm-dim', style: { marginLeft: 'auto' } }, remoteSsh ? remoteSsh.state || '' : ''),
5238
+ h('span', { className: 'apkvm-chevron', 'aria-hidden': 'true' }, '▸')
5239
+ ),
5240
+ h(
5241
+ 'div',
5242
+ { className: 'apkvm-debug-body' },
5243
+ h('input', {
5244
+ className: 'apkvm-input',
5245
+ type: 'text',
5246
+ value: remoteHost,
5247
+ placeholder: T('remote.host'),
5248
+ spellCheck: false,
5249
+ disabled: remoteSshBusy,
5250
+ onChange: function (event) {
5251
+ setRemoteHost(event && event.target ? String(event.target.value) : '');
5252
+ },
5253
+ }),
5254
+ h('input', {
5255
+ className: 'apkvm-input',
5256
+ type: 'text',
5257
+ value: remoteUser,
5258
+ placeholder: T('remote.user'),
5259
+ spellCheck: false,
5260
+ disabled: remoteSshBusy,
5261
+ onChange: function (event) {
5262
+ setRemoteUser(event && event.target ? String(event.target.value) : '');
5263
+ },
5264
+ }),
5265
+ h('input', {
5266
+ className: 'apkvm-input',
5267
+ type: 'text',
5268
+ value: remoteKey,
5269
+ placeholder: T('remote.key'),
5270
+ spellCheck: false,
5271
+ disabled: remoteSshBusy,
5272
+ onChange: function (event) {
5273
+ setRemoteKey(event && event.target ? String(event.target.value) : '');
5274
+ },
5275
+ }),
5276
+ h('input', {
5277
+ className: 'apkvm-input',
5278
+ type: 'text',
5279
+ value: remotePort,
5280
+ placeholder: T('remote.remotePort'),
5281
+ spellCheck: false,
5282
+ disabled: remoteSshBusy,
5283
+ onChange: function (event) {
5284
+ setRemotePort(event && event.target ? String(event.target.value) : '');
5285
+ },
5286
+ }),
5287
+ h(
5288
+ 'div',
5289
+ { style: { display: 'flex', alignItems: 'center', gap: '5px', flexWrap: 'wrap' } },
5290
+ actionBtn(remoteSshBusy ? '…' : T('remote.connect'), {
5291
+ key: 'remote-connect',
5292
+ small: true,
5293
+ disabled: remoteSshBusy || !remoteHost.trim() || !remoteUser.trim(),
5294
+ onClick: connectRemoteSsh,
5295
+ }),
5296
+ remoteSsh
5297
+ ? actionBtn(T('remote.disconnect'), {
5298
+ key: 'remote-disconnect',
5299
+ small: true,
5300
+ variant: 'danger',
5301
+ disabled: remoteSshBusy,
5302
+ onClick: disconnectRemoteSsh,
5303
+ })
5304
+ : null
5305
+ ),
5306
+ remoteSsh && remoteSsh.serial
5307
+ ? h('div', { className: 'apkvm-dim' }, 'adb ' + remoteSsh.serial)
5308
+ : null
5309
+ )
5310
+ );
5311
+
4420
5312
  var primaryAction =
4421
5313
  ready || busyState
4422
5314
  ? actionBtn(vmBusy ? T('action.stopping') : T('action.stop'), {
@@ -4528,6 +5420,16 @@ window.__ModuleLoader__.load({
4528
5420
  onClick: destroyActiveInstance,
4529
5421
  })
4530
5422
  : null,
5423
+ instancesList.length > 1
5424
+ ? actionBtn(T('grid.title'), {
5425
+ key: 'grid-view',
5426
+ small: true,
5427
+ onClick: function () {
5428
+ setGridTick(Date.now());
5429
+ setGridOpen(true);
5430
+ },
5431
+ })
5432
+ : null,
4531
5433
  h(
4532
5434
  'span',
4533
5435
  {
@@ -4548,18 +5450,48 @@ window.__ModuleLoader__.load({
4548
5450
  ' · ' +
4549
5451
  (videoMode === 'h264' ? T('fps.mode.h264') : T('fps.mode.png'))
4550
5452
  ),
5453
+ h264Status
5454
+ ? h(
5455
+ 'select',
5456
+ {
5457
+ className: 'apkvm-quality',
5458
+ value: streamQualityValue,
5459
+ title: T('stream.quality'),
5460
+ disabled: !ready || Boolean(qualityBusy) || activeInstance !== 'default' || h264Status.enabled === false,
5461
+ onChange: function (event) {
5462
+ applyStreamQuality(event && event.target ? String(event.target.value) : '');
5463
+ },
5464
+ },
5465
+ ['low', 'balanced', 'high'].map(function (name) {
5466
+ return h('option', { key: name, value: name }, T('stream.quality.' + name));
5467
+ }),
5468
+ streamPreset === 'custom' ? h('option', { key: 'custom', value: 'custom', disabled: true }, T('stream.quality.custom')) : null
5469
+ )
5470
+ : null,
4551
5471
  primaryAction,
4552
- actionBtn(T(isMaximized ? 'action.restore' : 'action.expand'), {
4553
- key: 'maximize',
5472
+ embedded
5473
+ ? actionBtn(T(toolsOpen ? 'action.hideTools' : 'action.tools'), {
5474
+ key: 'tools',
5475
+ small: true,
5476
+ onClick: toggleTools,
5477
+ })
5478
+ : null,
5479
+ actionBtn(T(isFloating ? 'action.dock' : 'action.float'), {
5480
+ key: 'float-window',
4554
5481
  small: true,
4555
- icon: h('span', { 'aria-hidden': 'true', style: { fontSize: '14px', lineHeight: '14px' } }, isMaximized ? '⛜' : '⛶'),
4556
- ariaLabel: T(isMaximized ? 'action.restore' : 'action.expand'),
4557
5482
  onClick: function () {
4558
- setIsMaximized(function (value) {
5483
+ setIsFloating(function (value) {
4559
5484
  return !value;
4560
5485
  });
4561
5486
  },
4562
5487
  }),
5488
+ actionBtn(T(isMaximized ? 'action.restore' : 'action.expand'), {
5489
+ key: 'maximize',
5490
+ small: true,
5491
+ icon: h('span', { 'aria-hidden': 'true', style: { fontSize: '14px', lineHeight: '14px' } }, '⛶'),
5492
+ ariaLabel: T(isMaximized ? 'action.restore' : 'action.expand'),
5493
+ onClick: toggleMaximized,
5494
+ }),
4563
5495
  !embedded && sidebarService
4564
5496
  ? actionBtn(T('action.openSidebar'), {
4565
5497
  key: 'open-sidebar',
@@ -4596,6 +5528,19 @@ window.__ModuleLoader__.load({
4596
5528
  )
4597
5529
  : null;
4598
5530
 
5531
+ var versionBanner = versionMismatch
5532
+ ? h(
5533
+ 'div',
5534
+ { className: 'apkvm-banner error apkvm-version-banner', role: 'alert' },
5535
+ h('span', { className: 'apkvm-banner-text' }, T('version.mismatch', { client: CLIENT_VERSION, host: hostVersion })),
5536
+ actionBtn(T('version.reload'), {
5537
+ key: 'version-reload',
5538
+ small: true,
5539
+ onClick: reloadUi,
5540
+ })
5541
+ )
5542
+ : null;
5543
+
4599
5544
  var stateErrorBanner =
4600
5545
  stateError && !toast
4601
5546
  ? h(
@@ -4654,6 +5599,13 @@ window.__ModuleLoader__.load({
4654
5599
  onKeyDown: onScreenKeyDown,
4655
5600
  onContextMenu: onContextMenu,
4656
5601
  onDragStart: onContextMenu,
5602
+ onDoubleClick: function (event) {
5603
+ if (event) {
5604
+ event.preventDefault();
5605
+ event.stopPropagation();
5606
+ }
5607
+ toggleMaximized();
5608
+ },
4657
5609
  },
4658
5610
  frameUrl && videoMode !== 'h264'
4659
5611
  ? h('img', { className: 'apkvm-frame', src: frameUrl, alt: T('screen.alt'), draggable: false })
@@ -4699,6 +5651,12 @@ window.__ModuleLoader__.load({
4699
5651
  disabled: !ready,
4700
5652
  onClick: downloadScreenshot,
4701
5653
  }),
5654
+ actionBtn(T('debug.rotate'), {
5655
+ key: 'quick-rotate',
5656
+ small: true,
5657
+ disabled: !ready || debugBusy,
5658
+ onClick: runDebugRotate,
5659
+ }),
4702
5660
  actionBtn(inspectMode ? T('inspect.close') : T('inspect.toggle'), {
4703
5661
  key: 'inspect-toggle',
4704
5662
  small: true,
@@ -4730,6 +5688,9 @@ window.__ModuleLoader__.load({
4730
5688
  )
4731
5689
  ),
4732
5690
  h('div', { className: 'apkvm-stagehint' }, T('screen.hint')),
5691
+ !ready && (displayState === 'starting' || displayState === 'booting')
5692
+ ? h('div', { className: 'apkvm-stagehint' }, T('stage.firstBoot'))
5693
+ : null,
4733
5694
  ready && videoMode !== 'h264' && clientReport && clientReport.h264Supported === false
4734
5695
  ? h('div', { className: 'apkvm-stagehint' }, T('fps.fallbackHint'))
4735
5696
  : null,
@@ -4741,7 +5702,12 @@ window.__ModuleLoader__.load({
4741
5702
  return h(
4742
5703
  'div',
4743
5704
  {
4744
- className: 'apkvm-page' + (embedded ? ' apkvm-embedded' : '') + (isMaximized ? ' apkvm-maximized' : ''),
5705
+ className:
5706
+ 'apkvm-page' +
5707
+ (embedded ? ' apkvm-embedded' : '') +
5708
+ (isMaximized ? ' apkvm-maximized' : '') +
5709
+ (isFloating ? ' apkvm-floating' : '') +
5710
+ (embedded && !toolsOpen ? ' apkvm-tools-collapsed' : ''),
4745
5711
  ref: pageRef,
4746
5712
  onDragEnter: onPageDragEnter,
4747
5713
  onDragOver: onPageDragOver,
@@ -4750,6 +5716,20 @@ window.__ModuleLoader__.load({
4750
5716
  },
4751
5717
  h('style', { key: 'apkvm-style' }, CSS_TEXT),
4752
5718
  headerEl,
5719
+ isMaximized
5720
+ ? h(
5721
+ 'button',
5722
+ {
5723
+ type: 'button',
5724
+ className: 'apkvm-max-close',
5725
+ onClick: toggleMaximized,
5726
+ 'aria-label': T('action.restore'),
5727
+ title: T('action.restore'),
5728
+ },
5729
+ '✕ ' + T('action.restore')
5730
+ )
5731
+ : null,
5732
+ versionBanner,
4753
5733
  stateErrorBanner,
4754
5734
  toastBanner,
4755
5735
  h(
@@ -4765,6 +5745,8 @@ window.__ModuleLoader__.load({
4765
5745
  flowCard,
4766
5746
  networkCard,
4767
5747
  storageCard,
5748
+ snapshotCard,
5749
+ remoteCard,
4768
5750
  appsCard,
4769
5751
  diagCard,
4770
5752
  h('div', { className: 'apkvm-footnote', title: T('hint.boot') }, T('hint.short')),
@@ -4779,6 +5761,54 @@ window.__ModuleLoader__.load({
4779
5761
  h('span', null, T('upload.drop')),
4780
5762
  h('span', { className: 'apkvm-dim' }, T('upload.detail'))
4781
5763
  )
5764
+ : null,
5765
+ gridOpen
5766
+ ? h(
5767
+ 'div',
5768
+ { className: 'apkvm-grid-overlay' },
5769
+ h(
5770
+ 'div',
5771
+ { className: 'apkvm-grid-head' },
5772
+ h('span', { className: 'apkvm-card-title' }, T('grid.title')),
5773
+ h('span', { className: 'apkvm-dim' }, instancesList.length + ' VM'),
5774
+ h('span', { className: 'apkvm-spacer' }),
5775
+ actionBtn(T('grid.close'), {
5776
+ key: 'grid-close',
5777
+ small: true,
5778
+ onClick: function () {
5779
+ setGridOpen(false);
5780
+ },
5781
+ })
5782
+ ),
5783
+ h(
5784
+ 'div',
5785
+ { className: 'apkvm-grid' },
5786
+ instancesList.map(function (entry) {
5787
+ var isReady = entry.state === 'ready';
5788
+ return h(
5789
+ 'button',
5790
+ {
5791
+ type: 'button',
5792
+ className: 'apkvm-grid-card',
5793
+ key: 'grid-' + entry.id,
5794
+ onClick: function () {
5795
+ setActiveInstanceId(entry.id);
5796
+ setGridOpen(false);
5797
+ },
5798
+ },
5799
+ isReady
5800
+ ? h('img', { src: instanceFrameSrc(entry.id), alt: entry.avdName || entry.id })
5801
+ : h('div', { className: 'apkvm-dim' }, entry.state || 'stopped'),
5802
+ h(
5803
+ 'span',
5804
+ { className: 'apkvm-grid-meta' },
5805
+ h('span', { className: 'apkvm-appname' }, entry.avdName || entry.id),
5806
+ h('span', { className: 'apkvm-dim' }, entry.state || '')
5807
+ )
5808
+ );
5809
+ })
5810
+ )
5811
+ )
4782
5812
  : null
4783
5813
  );
4784
5814
  }