dsh-apk-vm 0.12.0 → 0.12.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/CHANGELOG.md +54 -4
- package/DEMO.md +9 -6
- package/README.md +71 -13
- package/SECURITY.md +19 -2
- package/client.js +738 -14
- package/cordis.patch.yml +22 -0
- package/docs/PRIVACY.md +11 -0
- package/docs/README.md +17 -9
- package/docs/SUBMISSION.md +2 -1
- package/docs/screenshot-activity.png +0 -0
- package/docs/screenshot-apk-files.png +0 -0
- package/docs/screenshot-debug.png +0 -0
- package/docs/screenshot-device.png +0 -0
- package/docs/screenshot-environment.png +0 -0
- package/docs/screenshot-panel.png +0 -0
- package/icon.svg +18 -7
- package/index.js +505 -44
- package/lib/android.js +48 -1
- package/lib/emulator-inventory.js +1526 -0
- package/lib/instances.js +97 -1
- package/lib/media.js +820 -0
- package/lib/remote-instance.js +608 -0
- package/lib/remote.js +1180 -0
- package/package.json +19 -4
- package/docs/screenshot-sidebar.png +0 -0
package/client.js
CHANGED
|
@@ -411,6 +411,41 @@ window.__ModuleLoader__.load({
|
|
|
411
411
|
'remote.disconnect': 'Disconnect',
|
|
412
412
|
'remote.connected': 'SSH tunnel connected',
|
|
413
413
|
'remote.disconnected': 'SSH tunnel closed',
|
|
414
|
+
'remote.avd': 'Remote AVD name',
|
|
415
|
+
'remote.launch': 'Start a headless emulator on the remote host',
|
|
416
|
+
'remote.launchHint': 'Runs a fixed nohup command over SSH; the remote host needs `emulator` on PATH or a remote emulator path',
|
|
417
|
+
'remote.stopEmulator': 'Stop the remote emulator when disconnecting',
|
|
418
|
+
'remote.profileSaved': 'Saved host: {host}',
|
|
419
|
+
'remote.forget': 'Forget saved profile',
|
|
420
|
+
'remote.launching': 'Starting the remote emulator…',
|
|
421
|
+
'remote.log': 'Remote log',
|
|
422
|
+
'remote.serial': 'Serial',
|
|
423
|
+
'remote.noTunnel': 'Not connected',
|
|
424
|
+
'action.failed': 'Request failed',
|
|
425
|
+
'media.title': 'Camera & microphone',
|
|
426
|
+
'media.back': 'Back camera',
|
|
427
|
+
'media.front': 'Front camera',
|
|
428
|
+
'media.posterName': 'Poster name',
|
|
429
|
+
'media.posterPath': 'Poster image path (host)',
|
|
430
|
+
'media.posterAdd': 'Add poster',
|
|
431
|
+
'media.mic': 'Microphone',
|
|
432
|
+
'media.micOff': 'off',
|
|
433
|
+
'media.micHost': 'host passthrough',
|
|
434
|
+
'media.micFile': 'file loop (Linux/remote)',
|
|
435
|
+
'media.micPath': 'Audio file path',
|
|
436
|
+
'media.micBackend': 'Audio backend',
|
|
437
|
+
'media.apply': 'Save settings',
|
|
438
|
+
'media.applyRestart': 'Save & restart VM',
|
|
439
|
+
'media.saved': 'Camera/microphone settings saved',
|
|
440
|
+
'media.hint': 'Camera and microphone flags apply on the next boot of the default VM.',
|
|
441
|
+
'emulators.title': 'Available emulators',
|
|
442
|
+
'emulators.refresh': 'Refresh',
|
|
443
|
+
'emulators.local': 'Local AVDs',
|
|
444
|
+
'emulators.empty': 'No emulators reported.',
|
|
445
|
+
'emulators.hostDown': 'unreachable',
|
|
446
|
+
'remote.sessions': 'Remote sessions',
|
|
447
|
+
'remote.sessionDisconnect': 'Disconnect',
|
|
448
|
+
'remote.sessionKill': 'Disconnect & stop',
|
|
414
449
|
'devices.detach': 'Detach',
|
|
415
450
|
'devices.attached': 'Attached {serial}',
|
|
416
451
|
'devices.detached': 'Detached external device',
|
|
@@ -779,6 +814,41 @@ window.__ModuleLoader__.load({
|
|
|
779
814
|
'remote.disconnect': '断开',
|
|
780
815
|
'remote.connected': 'SSH 隧道已连接',
|
|
781
816
|
'remote.disconnected': 'SSH 隧道已关闭',
|
|
817
|
+
'remote.avd': '远端 AVD 名称',
|
|
818
|
+
'remote.launch': '在远端启动无界面模拟器',
|
|
819
|
+
'remote.launchHint': '通过 SSH 执行固定的 nohup 命令;需要远端 emulator 在 PATH 中或填写远端 emulator 路径',
|
|
820
|
+
'remote.stopEmulator': '断开时停止远端模拟器',
|
|
821
|
+
'remote.profileSaved': '已保存的主机:{host}',
|
|
822
|
+
'remote.forget': '清除已保存配置',
|
|
823
|
+
'remote.launching': '正在启动远端模拟器…',
|
|
824
|
+
'remote.log': '远端日志',
|
|
825
|
+
'remote.serial': '设备序列号',
|
|
826
|
+
'remote.noTunnel': '未连接',
|
|
827
|
+
'action.failed': '操作失败',
|
|
828
|
+
'media.title': '摄像头与麦克风',
|
|
829
|
+
'media.back': '后置摄像头',
|
|
830
|
+
'media.front': '前置摄像头',
|
|
831
|
+
'media.posterName': '海报名称',
|
|
832
|
+
'media.posterPath': '海报图片路径(宿主机)',
|
|
833
|
+
'media.posterAdd': '添加海报',
|
|
834
|
+
'media.mic': '麦克风',
|
|
835
|
+
'media.micOff': '关闭',
|
|
836
|
+
'media.micHost': '宿主机透传',
|
|
837
|
+
'media.micFile': '文件循环(Linux/远端)',
|
|
838
|
+
'media.micPath': '音频文件路径',
|
|
839
|
+
'media.micBackend': '音频后端',
|
|
840
|
+
'media.apply': '保存设置',
|
|
841
|
+
'media.applyRestart': '保存并重启虚拟机',
|
|
842
|
+
'media.saved': '摄像头/麦克风设置已保存',
|
|
843
|
+
'media.hint': '摄像头与麦克风参数在默认虚拟机下次启动时生效。',
|
|
844
|
+
'emulators.title': '可用模拟器',
|
|
845
|
+
'emulators.refresh': '刷新',
|
|
846
|
+
'emulators.local': '本地 AVD',
|
|
847
|
+
'emulators.empty': '未发现可用模拟器。',
|
|
848
|
+
'emulators.hostDown': '不可达',
|
|
849
|
+
'remote.sessions': '远端会话',
|
|
850
|
+
'remote.sessionDisconnect': '断开',
|
|
851
|
+
'remote.sessionKill': '断开并停止模拟器',
|
|
782
852
|
'devices.detach': '断开',
|
|
783
853
|
'devices.attached': '已连接 {serial}',
|
|
784
854
|
'devices.detached': '已断开外部设备',
|
|
@@ -1269,8 +1339,24 @@ window.__ModuleLoader__.load({
|
|
|
1269
1339
|
'.apkvm-banner-text{flex:1 1 auto;min-width:0;word-break:break-word}' +
|
|
1270
1340
|
'.apkvm-banner-close{appearance:none;border:0;background:transparent;color:inherit;font:inherit;font-size:15px;line-height:1;padding:2px 4px;cursor:pointer;border-radius:5px;opacity:.75}' +
|
|
1271
1341
|
'.apkvm-banner-close:hover{opacity:1}' +
|
|
1272
|
-
'.apkvm-body{flex:1 1 auto;min-height:0;display:flex;gap:
|
|
1273
|
-
|
|
1342
|
+
'.apkvm-body{flex:1 1 auto;min-height:0;display:flex;flex-direction:row;gap:12px;padding:14px 20px 18px;overflow:hidden;align-items:stretch}' +
|
|
1343
|
+
/* Wide-window dashboard: the phone keeps its natural 9:19.5 height, so the
|
|
1344
|
+
cards move from the single left rail into a two-column rail on the right
|
|
1345
|
+
instead of leaving empty margins around the preview. The Activity card
|
|
1346
|
+
opens by default and stretches its timeline to the available height. */
|
|
1347
|
+
'.apkvm-body.apkvm-dashboard{display:grid;grid-template-columns:280px auto minmax(0,1fr);gap:12px;align-items:stretch}' +
|
|
1348
|
+
/* The APK list is the flexible card in the single-rail layout; in the
|
|
1349
|
+
dashboard the rail is not the only content column, so keep it compact. */
|
|
1350
|
+
'.apkvm-dashboard .apkvm-apkcard{flex:none;min-height:0}' +
|
|
1351
|
+
'.apkvm-dashboard .apkvm-apkcard .apkvm-list{flex:none;max-height:min(38vh,360px);min-height:60px}' +
|
|
1352
|
+
'.apkvm-dashboard .apkvm-side{flex-direction:column;gap:8px}' +
|
|
1353
|
+
'.apkvm-dashboard .apkvm-side .apkvm-activity[open]{display:flex;flex-direction:column;flex:1 1 auto;min-height:0}' +
|
|
1354
|
+
'.apkvm-dashboard .apkvm-side .apkvm-activity[open]>.apkvm-activity-body{flex:1 1 auto;min-height:0;display:flex;flex-direction:column}' +
|
|
1355
|
+
'.apkvm-dashboard .apkvm-side .apkvm-activity[open] .apkvm-activity-list{flex:1 1 auto;max-height:none}' +
|
|
1356
|
+
'.apkvm-aside{min-width:0;min-height:0;display:flex;flex-direction:column;gap:10px;overflow-y:auto;overflow-x:hidden;padding-right:2px}' +
|
|
1357
|
+
'.apkvm-side{min-width:0;min-height:0;display:flex;flex-direction:column;gap:8px;overflow-y:auto;overflow-x:hidden;padding-right:2px}' +
|
|
1358
|
+
'.apkvm-sidecol{min-width:0;display:flex;flex-direction:column;gap:8px}' +
|
|
1359
|
+
'.apkvm-sidecol>.apkvm-card{flex:none}' +
|
|
1274
1360
|
'.apkvm-card{flex:none;display:flex;flex-direction:column;gap:8px;padding:10px 11px;border:1px solid var(--dsw-alias-border-l1);border-radius:12px;background:var(--dsw-alias-bg-layer-1);min-width:0}' +
|
|
1275
1361
|
'.apkvm-cardhead{display:flex;align-items:center;gap:8px;flex-wrap:wrap;min-width:0}' +
|
|
1276
1362
|
'.apkvm-card-title{font-size:11px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--dsw-alias-label-secondary);margin:0}' +
|
|
@@ -1319,15 +1405,17 @@ window.__ModuleLoader__.load({
|
|
|
1319
1405
|
'.apkvm-scroll::-webkit-scrollbar{width:8px;height:8px}' +
|
|
1320
1406
|
'.apkvm-scroll::-webkit-scrollbar-thumb{background:var(--dsw-alias-border-l2);border-radius:4px}' +
|
|
1321
1407
|
'.apkvm-scroll::-webkit-scrollbar-track{background:transparent}' +
|
|
1322
|
-
'@media (max-width:
|
|
1408
|
+
'@media (max-width:1279px){.apkvm-body{display:flex;flex-direction:column;overflow-y:auto;gap:12px}.apkvm-aside{flex:0 0 auto;width:100%;overflow:visible;gap:8px}.apkvm-side{flex:none;width:100%;overflow:visible}.apkvm-list{max-height:200px}.apkvm-stage{min-height:440px}.apkvm-phonewrap{min-height:340px}.apkvm-subtitle{max-width:60vw}}' +
|
|
1409
|
+
'@media (max-width:900px){.apkvm-body{display:flex;flex-direction:column;overflow-y:auto}.apkvm-aside{flex:0 0 auto;width:100%;overflow:visible}.apkvm-list{max-height:200px}.apkvm-stage{min-height:440px}.apkvm-phonewrap{min-height:340px}.apkvm-subtitle{max-width:60vw}}' +
|
|
1323
1410
|
'@media (max-width:560px){.apkvm-header{padding:10px 12px}.apkvm-body{padding:10px 12px 14px}.apkvm-toolbar{gap:4px}}' +
|
|
1324
1411
|
/* dsh-better-sidebar tab layout: a native side pane is narrow, so stack
|
|
1325
1412
|
the APK list above the phone frame and keep the header compact. */
|
|
1326
1413
|
'.apkvm-page.apkvm-embedded{height:100%;min-height:0;background:var(--dsw-alias-bg-base)}' +
|
|
1327
1414
|
'.apkvm-embedded .apkvm-header{padding:9px 12px;gap:6px;flex-wrap:wrap}' +
|
|
1328
1415
|
'.apkvm-embedded .apkvm-subtitle{display:none}' +
|
|
1329
|
-
'.apkvm-embedded .apkvm-body{flex-direction:column;overflow-y:auto;gap:8px;padding:10px 12px 14px}' +
|
|
1416
|
+
'.apkvm-embedded .apkvm-body{display:flex;flex-direction:column;overflow-y:auto;gap:8px;padding:10px 12px 14px}' +
|
|
1330
1417
|
'.apkvm-embedded .apkvm-aside{flex:0 0 auto;width:100%;overflow:visible;padding-right:0;gap:8px}' +
|
|
1418
|
+
'.apkvm-embedded .apkvm-side{flex:none;width:100%;overflow:visible;gap:8px}' +
|
|
1331
1419
|
'.apkvm-embedded .apkvm-list{max-height:170px}' +
|
|
1332
1420
|
'.apkvm-embedded .apkvm-log{max-height:110px}' +
|
|
1333
1421
|
'.apkvm-embedded .apkvm-stage{min-height:400px;flex:0 0 auto}' +
|
|
@@ -1414,8 +1502,9 @@ window.__ModuleLoader__.load({
|
|
|
1414
1502
|
'.apkvm-embedded .apkvm-header{flex-wrap:wrap}' +
|
|
1415
1503
|
'.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)}' +
|
|
1416
1504
|
'.apkvm-page.apkvm-maximized .apkvm-header{flex:0 0 auto;background:var(--dsw-alias-bg-base);padding-right:142px}' +
|
|
1417
|
-
'.apkvm-page.apkvm-maximized .apkvm-body{flex:1 1 auto;min-height:0;padding:10px 16px 14px;gap:10px;overflow:hidden;flex-direction:row}' +
|
|
1505
|
+
'.apkvm-page.apkvm-maximized .apkvm-body{flex:1 1 auto;min-height:0;padding:10px 16px 14px;gap:10px;overflow:hidden;display:flex;flex-direction:row}' +
|
|
1418
1506
|
'.apkvm-page.apkvm-maximized .apkvm-aside{display:none}' +
|
|
1507
|
+
'.apkvm-page.apkvm-maximized .apkvm-side{display:none}' +
|
|
1419
1508
|
'.apkvm-page.apkvm-maximized .apkvm-stage{flex:1 1 auto;min-height:0;max-height:none}' +
|
|
1420
1509
|
'.apkvm-page.apkvm-maximized .apkvm-phonewrap{flex:1 1 auto;min-height:0;padding:0}' +
|
|
1421
1510
|
'.apkvm-page.apkvm-maximized .apkvm-phone{height:100%;max-height:calc(100vh - 150px);padding:6px;border-radius:22px}' +
|
|
@@ -1424,6 +1513,7 @@ window.__ModuleLoader__.load({
|
|
|
1424
1513
|
'.apkvm-page.apkvm-maximized .apkvm-stagehint{max-width:760px}' +
|
|
1425
1514
|
'.apkvm-page.apkvm-maximized .apkvm-subtitle,.apkvm-page.apkvm-maximized .apkvm-pillmeta{display:none}' +
|
|
1426
1515
|
'.apkvm-page.apkvm-tools-collapsed .apkvm-aside{display:none}' +
|
|
1516
|
+
'.apkvm-page.apkvm-tools-collapsed .apkvm-side{display:none}' +
|
|
1427
1517
|
'.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}' +
|
|
1428
1518
|
'.apkvm-max-close:hover{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-brand-primary)}' +
|
|
1429
1519
|
'.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}' +
|
|
@@ -1509,7 +1599,7 @@ window.__ModuleLoader__.load({
|
|
|
1509
1599
|
var instanceOptions = Array.isArray(propsSafe.instances) ? propsSafe.instances : [];
|
|
1510
1600
|
var panelVisible = propsSafe.visible === undefined ? true : propsSafe.visible !== false;
|
|
1511
1601
|
|
|
1512
|
-
var openState = React.useState(
|
|
1602
|
+
var openState = React.useState(propsSafe.defaultOpen === true);
|
|
1513
1603
|
var open = openState[0];
|
|
1514
1604
|
var setOpen = openState[1];
|
|
1515
1605
|
|
|
@@ -2045,6 +2135,42 @@ window.__ModuleLoader__.load({
|
|
|
2045
2135
|
* order so React can re-render it safely across Host state transitions.
|
|
2046
2136
|
* ------------------------------------------------------------------ */
|
|
2047
2137
|
|
|
2138
|
+
/* Wide-window dashboard breakpoint. Driven from JS (matchMedia) instead of
|
|
2139
|
+
CSS only so the card DOM can move between the single left rail and the
|
|
2140
|
+
two-column dashboard rail; the cards stay mounted in one place at a time. */
|
|
2141
|
+
var DASHBOARD_MIN_WIDTH = 1600;
|
|
2142
|
+
|
|
2143
|
+
function useWideDashboard() {
|
|
2144
|
+
var pair = React.useState(
|
|
2145
|
+
typeof window === 'undefined' ? false : window.innerWidth >= DASHBOARD_MIN_WIDTH
|
|
2146
|
+
);
|
|
2147
|
+
var wide = pair[0];
|
|
2148
|
+
var setWide = pair[1];
|
|
2149
|
+
React.useEffect(function () {
|
|
2150
|
+
if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') {
|
|
2151
|
+
return undefined;
|
|
2152
|
+
}
|
|
2153
|
+
var query = window.matchMedia('(min-width: ' + DASHBOARD_MIN_WIDTH + 'px)');
|
|
2154
|
+
function sync() {
|
|
2155
|
+
setWide(query.matches);
|
|
2156
|
+
}
|
|
2157
|
+
sync();
|
|
2158
|
+
if (typeof query.addEventListener === 'function') {
|
|
2159
|
+
query.addEventListener('change', sync);
|
|
2160
|
+
} else if (typeof query.addListener === 'function') {
|
|
2161
|
+
query.addListener(sync);
|
|
2162
|
+
}
|
|
2163
|
+
return function () {
|
|
2164
|
+
if (typeof query.removeEventListener === 'function') {
|
|
2165
|
+
query.removeEventListener('change', sync);
|
|
2166
|
+
} else if (typeof query.removeListener === 'function') {
|
|
2167
|
+
query.removeListener(sync);
|
|
2168
|
+
}
|
|
2169
|
+
};
|
|
2170
|
+
}, []);
|
|
2171
|
+
return wide;
|
|
2172
|
+
}
|
|
2173
|
+
|
|
2048
2174
|
function createPage(getTranslate) {
|
|
2049
2175
|
var ActivityCard = createActivityCard(getTranslate);
|
|
2050
2176
|
|
|
@@ -2056,6 +2182,7 @@ window.__ModuleLoader__.load({
|
|
|
2056
2182
|
`main` panel has no such prop and is always treated as visible. */
|
|
2057
2183
|
var embedded = propsSafe.embedded === true;
|
|
2058
2184
|
var tabVisible = propsSafe.visible === undefined ? true : propsSafe.visible !== false;
|
|
2185
|
+
var wideDashboard = useWideDashboard() && !embedded;
|
|
2059
2186
|
|
|
2060
2187
|
/* ---- state ---------------------------------------------------- */
|
|
2061
2188
|
var snapshotState = React.useState(null);
|
|
@@ -2170,6 +2297,221 @@ window.__ModuleLoader__.load({
|
|
|
2170
2297
|
var remoteSshState = React.useState(null);
|
|
2171
2298
|
var remoteSsh = remoteSshState[0];
|
|
2172
2299
|
var setRemoteSsh = remoteSshState[1];
|
|
2300
|
+
var remoteAvdState = React.useState('');
|
|
2301
|
+
var remoteAvd = remoteAvdState[0];
|
|
2302
|
+
var setRemoteAvd = remoteAvdState[1];
|
|
2303
|
+
var remoteLaunchState = React.useState(false);
|
|
2304
|
+
var remoteLaunchOn = remoteLaunchState[0];
|
|
2305
|
+
var setRemoteLaunchOn = remoteLaunchState[1];
|
|
2306
|
+
var remoteStopOnDisconnectState = React.useState(true);
|
|
2307
|
+
var remoteStopOnDisconnect = remoteStopOnDisconnectState[0];
|
|
2308
|
+
var setRemoteStopOnDisconnect = remoteStopOnDisconnectState[1];
|
|
2309
|
+
var remoteLaunchInfoState = React.useState(null);
|
|
2310
|
+
var remoteLaunchInfo = remoteLaunchInfoState[0];
|
|
2311
|
+
var setRemoteLaunchInfo = remoteLaunchInfoState[1];
|
|
2312
|
+
var remoteProfileState = React.useState(null);
|
|
2313
|
+
var remoteProfile = remoteProfileState[0];
|
|
2314
|
+
var setRemoteProfile = remoteProfileState[1];
|
|
2315
|
+
var remoteSessionsState = React.useState([]);
|
|
2316
|
+
var remoteSessions = remoteSessionsState[0];
|
|
2317
|
+
var setRemoteSessions = remoteSessionsState[1];
|
|
2318
|
+
var remoteProfilesState = React.useState([]);
|
|
2319
|
+
var remoteProfiles = remoteProfilesState[0];
|
|
2320
|
+
var setRemoteProfiles = remoteProfilesState[1];
|
|
2321
|
+
var mediaSettingsState = React.useState(null);
|
|
2322
|
+
var mediaSettings = mediaSettingsState[0];
|
|
2323
|
+
var setMediaSettings = mediaSettingsState[1];
|
|
2324
|
+
var mediaBusyState = React.useState(false);
|
|
2325
|
+
var mediaBusy = mediaBusyState[0];
|
|
2326
|
+
var setMediaBusy = mediaBusyState[1];
|
|
2327
|
+
var mediaPosterNameState = React.useState('');
|
|
2328
|
+
var mediaPosterName = mediaPosterNameState[0];
|
|
2329
|
+
var setMediaPosterName = mediaPosterNameState[1];
|
|
2330
|
+
var mediaPosterPathState = React.useState('');
|
|
2331
|
+
var mediaPosterPath = mediaPosterPathState[0];
|
|
2332
|
+
var setMediaPosterPath = mediaPosterPathState[1];
|
|
2333
|
+
var emulatorInventoryState = React.useState(null);
|
|
2334
|
+
var emulatorInventory = emulatorInventoryState[0];
|
|
2335
|
+
var setEmulatorInventory = emulatorInventoryState[1];
|
|
2336
|
+
var emulatorBusyState = React.useState(false);
|
|
2337
|
+
var emulatorBusy = emulatorBusyState[0];
|
|
2338
|
+
var setEmulatorBusy = emulatorBusyState[1];
|
|
2339
|
+
|
|
2340
|
+
function applyRemoteState(data, prefill) {
|
|
2341
|
+
if (!isObject(data)) return;
|
|
2342
|
+
var sessions = Array.isArray(data.sessions) ? data.sessions : [];
|
|
2343
|
+
var firstSession = sessions.length ? sessions[0] : null;
|
|
2344
|
+
setRemoteSessions(sessions);
|
|
2345
|
+
setRemoteSsh(data.tunnel || (firstSession && firstSession.tunnel) || null);
|
|
2346
|
+
setRemoteLaunchInfo(data.launch || (firstSession && firstSession.launch) || null);
|
|
2347
|
+
setRemoteProfile(data.profile || null);
|
|
2348
|
+
if (Array.isArray(data.profiles)) setRemoteProfiles(data.profiles);
|
|
2349
|
+
if (prefill && isObject(data.profile)) {
|
|
2350
|
+
setRemoteHost(data.profile.host || '');
|
|
2351
|
+
setRemoteUser(data.profile.user || '');
|
|
2352
|
+
setRemoteKey(data.profile.keyPath || '');
|
|
2353
|
+
setRemotePort(String(data.profile.remotePort || 5558));
|
|
2354
|
+
setRemoteAvd(data.profile.avdName || '');
|
|
2355
|
+
setRemoteLaunchOn(data.profile.launch === true);
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
|
|
2359
|
+
// Prefill from the persisted profile and restore an existing tunnel after
|
|
2360
|
+
// a panel reload; the panel keeps polling while a tunnel is connected.
|
|
2361
|
+
React.useEffect(function () {
|
|
2362
|
+
var disposed = false;
|
|
2363
|
+
requestJson('/apk-vm/remote', { method: 'GET' }, T)
|
|
2364
|
+
.then(function (result) {
|
|
2365
|
+
if (disposed || !mountedRef.current || !result.ok) return;
|
|
2366
|
+
applyRemoteState(result.data, true);
|
|
2367
|
+
})
|
|
2368
|
+
.catch(function () {});
|
|
2369
|
+
return function () {
|
|
2370
|
+
disposed = true;
|
|
2371
|
+
};
|
|
2372
|
+
}, []);
|
|
2373
|
+
|
|
2374
|
+
React.useEffect(
|
|
2375
|
+
function () {
|
|
2376
|
+
if (!remoteSsh) return undefined;
|
|
2377
|
+
var disposed = false;
|
|
2378
|
+
var timer = setInterval(function () {
|
|
2379
|
+
requestJson('/apk-vm/remote', { method: 'GET' }, T)
|
|
2380
|
+
.then(function (result) {
|
|
2381
|
+
if (disposed || !mountedRef.current || !result.ok) return;
|
|
2382
|
+
applyRemoteState(result.data, false);
|
|
2383
|
+
})
|
|
2384
|
+
.catch(function () {});
|
|
2385
|
+
}, 2000);
|
|
2386
|
+
return function () {
|
|
2387
|
+
disposed = true;
|
|
2388
|
+
clearInterval(timer);
|
|
2389
|
+
};
|
|
2390
|
+
},
|
|
2391
|
+
[Boolean(remoteSsh)]
|
|
2392
|
+
);
|
|
2393
|
+
|
|
2394
|
+
function loadMediaSettings() {
|
|
2395
|
+
return requestJson('/apk-vm/camera', { method: 'GET' }, T)
|
|
2396
|
+
.then(function (result) {
|
|
2397
|
+
if (result.ok && isObject(result.data) && isObject(result.data.camera)) {
|
|
2398
|
+
setMediaSettings({
|
|
2399
|
+
camera: result.data.camera,
|
|
2400
|
+
mic: result.data.mic || { mode: 'off' },
|
|
2401
|
+
capabilities: result.data.capabilities || {},
|
|
2402
|
+
settingsPath: result.data.settingsPath || '',
|
|
2403
|
+
});
|
|
2404
|
+
}
|
|
2405
|
+
return result;
|
|
2406
|
+
})
|
|
2407
|
+
.catch(function () {
|
|
2408
|
+
return null;
|
|
2409
|
+
});
|
|
2410
|
+
}
|
|
2411
|
+
|
|
2412
|
+
function loadEmulatorInventory() {
|
|
2413
|
+
if (emulatorBusy) return Promise.resolve(null);
|
|
2414
|
+
setEmulatorBusy(true);
|
|
2415
|
+
return requestJson('/apk-vm/emulators', { method: 'GET' }, T)
|
|
2416
|
+
.then(function (result) {
|
|
2417
|
+
if (result.ok && isObject(result.data)) setEmulatorInventory(result.data);
|
|
2418
|
+
return result;
|
|
2419
|
+
})
|
|
2420
|
+
.catch(function () {
|
|
2421
|
+
return null;
|
|
2422
|
+
})
|
|
2423
|
+
.then(function (result) {
|
|
2424
|
+
setEmulatorBusy(false);
|
|
2425
|
+
return result;
|
|
2426
|
+
});
|
|
2427
|
+
}
|
|
2428
|
+
|
|
2429
|
+
React.useEffect(function () {
|
|
2430
|
+
loadMediaSettings();
|
|
2431
|
+
loadEmulatorInventory();
|
|
2432
|
+
}, []);
|
|
2433
|
+
|
|
2434
|
+
function updateMediaSettings(patch) {
|
|
2435
|
+
setMediaSettings(function (previous) {
|
|
2436
|
+
var base = isObject(previous) ? previous : {};
|
|
2437
|
+
var next = {
|
|
2438
|
+
camera: isObject(base.camera) ? Object.assign({}, base.camera) : { back: 'emulated', front: 'none', posters: [] },
|
|
2439
|
+
mic: isObject(base.mic) ? Object.assign({}, base.mic) : { mode: 'off' },
|
|
2440
|
+
capabilities: base.capabilities || {},
|
|
2441
|
+
settingsPath: base.settingsPath || '',
|
|
2442
|
+
};
|
|
2443
|
+
if (patch && isObject(patch.camera)) next.camera = Object.assign({}, next.camera, patch.camera);
|
|
2444
|
+
if (patch && isObject(patch.mic)) next.mic = Object.assign({}, next.mic, patch.mic);
|
|
2445
|
+
return next;
|
|
2446
|
+
});
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2449
|
+
function saveMediaSettings(restart) {
|
|
2450
|
+
if (!isObject(mediaSettings) || mediaBusy) return;
|
|
2451
|
+
setMediaBusy(true);
|
|
2452
|
+
var micSettings = Object.assign({}, mediaSettings.mic || { mode: 'off' });
|
|
2453
|
+
if (micSettings.mode === 'file' && !micSettings.filePath) micSettings.mode = 'off';
|
|
2454
|
+
var chain = requestJson(
|
|
2455
|
+
'/apk-vm/camera',
|
|
2456
|
+
{ method: 'POST', body: JSON.stringify({ camera: mediaSettings.camera, action: 'save' }) },
|
|
2457
|
+
T
|
|
2458
|
+
).then(function () {
|
|
2459
|
+
return requestJson('/apk-vm/mic', { method: 'POST', body: JSON.stringify({ mic: micSettings, action: 'save' }) }, T);
|
|
2460
|
+
});
|
|
2461
|
+
if (restart) {
|
|
2462
|
+
chain = chain
|
|
2463
|
+
.then(function () {
|
|
2464
|
+
return requestJson('/apk-vm/camera', { method: 'POST', body: JSON.stringify({ camera: mediaSettings.camera, action: 'apply' }) }, T);
|
|
2465
|
+
})
|
|
2466
|
+
.then(function () {
|
|
2467
|
+
return requestJson(
|
|
2468
|
+
'/apk-vm/mic',
|
|
2469
|
+
{ method: 'POST', body: JSON.stringify({ mic: micSettings, action: 'apply', restart: true }) },
|
|
2470
|
+
T
|
|
2471
|
+
);
|
|
2472
|
+
});
|
|
2473
|
+
}
|
|
2474
|
+
chain
|
|
2475
|
+
.then(function (result) {
|
|
2476
|
+
var warned = result && result.data && Array.isArray(result.data.warnings) ? result.data.warnings : [];
|
|
2477
|
+
if (result && result.ok) {
|
|
2478
|
+
setToast({ id: Date.now(), kind: 'success', text: warned.length ? warned.join('; ') : T('media.saved') });
|
|
2479
|
+
} else {
|
|
2480
|
+
setToast({ id: Date.now(), kind: 'error', text: (result && result.error) || T('action.failed') });
|
|
2481
|
+
}
|
|
2482
|
+
})
|
|
2483
|
+
.catch(function (error) {
|
|
2484
|
+
setToast({ id: Date.now(), kind: 'error', text: (error && error.message) || T('action.failed') });
|
|
2485
|
+
})
|
|
2486
|
+
.then(function () {
|
|
2487
|
+
setMediaBusy(false);
|
|
2488
|
+
loadMediaSettings();
|
|
2489
|
+
});
|
|
2490
|
+
}
|
|
2491
|
+
|
|
2492
|
+
function disconnectRemoteSession(sessionId, stopEmulator) {
|
|
2493
|
+
if (!sessionId) return Promise.resolve(null);
|
|
2494
|
+
return requestJson(
|
|
2495
|
+
'/apk-vm/remote',
|
|
2496
|
+
{
|
|
2497
|
+
method: 'POST',
|
|
2498
|
+
body: JSON.stringify({ action: 'disconnect', id: sessionId, stopEmulator: stopEmulator === true, detachDevice: true }),
|
|
2499
|
+
},
|
|
2500
|
+
T
|
|
2501
|
+
)
|
|
2502
|
+
.then(function (result) {
|
|
2503
|
+
if (result && result.ok) {
|
|
2504
|
+
setToast({ id: Date.now(), kind: 'success', text: T('remote.disconnected') });
|
|
2505
|
+
if (isObject(result.data)) applyRemoteState(result.data, false);
|
|
2506
|
+
} else {
|
|
2507
|
+
setToast({ id: Date.now(), kind: 'error', text: (result && result.error) || T('action.failed') });
|
|
2508
|
+
}
|
|
2509
|
+
return result;
|
|
2510
|
+
})
|
|
2511
|
+
.catch(function (error) {
|
|
2512
|
+
setToast({ id: Date.now(), kind: 'error', text: (error && error.message) || T('action.failed') });
|
|
2513
|
+
});
|
|
2514
|
+
}
|
|
2173
2515
|
var deviceBusyState = React.useState(false);
|
|
2174
2516
|
var deviceBusy = deviceBusyState[0];
|
|
2175
2517
|
var setDeviceBusy = deviceBusyState[1];
|
|
@@ -4165,6 +4507,8 @@ window.__ModuleLoader__.load({
|
|
|
4165
4507
|
user: remoteUser.trim(),
|
|
4166
4508
|
keyPath: remoteKey.trim() || undefined,
|
|
4167
4509
|
remotePort: Number(remotePort) || 5558,
|
|
4510
|
+
avdName: remoteAvd.trim() || undefined,
|
|
4511
|
+
launch: Boolean(remoteLaunchOn),
|
|
4168
4512
|
}),
|
|
4169
4513
|
}, T).then(function (result) {
|
|
4170
4514
|
if (!mountedRef.current) return;
|
|
@@ -4173,17 +4517,42 @@ window.__ModuleLoader__.load({
|
|
|
4173
4517
|
pushToast('error', (result.error || T('err.action')).slice(0, 500));
|
|
4174
4518
|
return;
|
|
4175
4519
|
}
|
|
4176
|
-
|
|
4177
|
-
|
|
4520
|
+
var data = isObject(result.data) ? result.data : {};
|
|
4521
|
+
setRemoteSsh(data.tunnel || null);
|
|
4522
|
+
setRemoteLaunchInfo(data.launch || null);
|
|
4523
|
+
setRemoteProfile(data.profile || null);
|
|
4524
|
+
pushToast('success', data.launch ? T('remote.launching') : T('remote.connected'));
|
|
4178
4525
|
loadState();
|
|
4179
4526
|
loadDevices();
|
|
4527
|
+
loadSetup(true);
|
|
4528
|
+
});
|
|
4529
|
+
}
|
|
4530
|
+
|
|
4531
|
+
function forgetRemoteProfile() {
|
|
4532
|
+
if (remoteSshBusy) return;
|
|
4533
|
+
setRemoteSshBusy(true);
|
|
4534
|
+
requestJson('/apk-vm/remote', { method: 'POST', body: JSON.stringify({ action: 'forget-profile' }) }, T).then(function (result) {
|
|
4535
|
+
if (!mountedRef.current) return;
|
|
4536
|
+
setRemoteSshBusy(false);
|
|
4537
|
+
if (!result.ok) {
|
|
4538
|
+
pushToast('error', (result.error || T('err.action')).slice(0, 500));
|
|
4539
|
+
return;
|
|
4540
|
+
}
|
|
4541
|
+
setRemoteProfile(null);
|
|
4542
|
+
pushToast('success', T('remote.disconnected'));
|
|
4180
4543
|
});
|
|
4181
4544
|
}
|
|
4182
4545
|
|
|
4183
4546
|
function disconnectRemoteSsh() {
|
|
4184
4547
|
if (remoteSshBusy) return;
|
|
4185
4548
|
setRemoteSshBusy(true);
|
|
4186
|
-
requestJson('/apk-vm/remote', {
|
|
4549
|
+
requestJson('/apk-vm/remote', {
|
|
4550
|
+
method: 'POST',
|
|
4551
|
+
body: JSON.stringify({
|
|
4552
|
+
action: 'disconnect',
|
|
4553
|
+
stopEmulator: Boolean(remoteLaunchInfo && remoteStopOnDisconnect),
|
|
4554
|
+
}),
|
|
4555
|
+
}, T).then(function (result) {
|
|
4187
4556
|
if (!mountedRef.current) return;
|
|
4188
4557
|
setRemoteSshBusy(false);
|
|
4189
4558
|
if (!result.ok) {
|
|
@@ -4191,6 +4560,7 @@ window.__ModuleLoader__.load({
|
|
|
4191
4560
|
return;
|
|
4192
4561
|
}
|
|
4193
4562
|
setRemoteSsh(null);
|
|
4563
|
+
setRemoteLaunchInfo(null);
|
|
4194
4564
|
pushToast('success', T('remote.disconnected'));
|
|
4195
4565
|
loadState();
|
|
4196
4566
|
loadDevices();
|
|
@@ -5650,6 +6020,7 @@ window.__ModuleLoader__.load({
|
|
|
5650
6020
|
instanceId: activeInstance,
|
|
5651
6021
|
instances: instancesList,
|
|
5652
6022
|
visible: tabVisible,
|
|
6023
|
+
defaultOpen: wideDashboard,
|
|
5653
6024
|
t: translate,
|
|
5654
6025
|
});
|
|
5655
6026
|
|
|
@@ -6724,6 +7095,45 @@ window.__ModuleLoader__.load({
|
|
|
6724
7095
|
setRemotePort(event && event.target ? String(event.target.value) : '');
|
|
6725
7096
|
},
|
|
6726
7097
|
}),
|
|
7098
|
+
h('input', {
|
|
7099
|
+
className: 'apkvm-input',
|
|
7100
|
+
type: 'text',
|
|
7101
|
+
value: remoteAvd,
|
|
7102
|
+
placeholder: T('remote.avd'),
|
|
7103
|
+
spellCheck: false,
|
|
7104
|
+
disabled: remoteSshBusy,
|
|
7105
|
+
onChange: function (event) {
|
|
7106
|
+
setRemoteAvd(event && event.target ? String(event.target.value) : '');
|
|
7107
|
+
},
|
|
7108
|
+
}),
|
|
7109
|
+
h(
|
|
7110
|
+
'label',
|
|
7111
|
+
{ style: { display: 'flex', alignItems: 'center', gap: '6px', fontSize: '12px' } },
|
|
7112
|
+
h('input', {
|
|
7113
|
+
type: 'checkbox',
|
|
7114
|
+
checked: remoteLaunchOn,
|
|
7115
|
+
disabled: remoteSshBusy,
|
|
7116
|
+
onChange: function (event) {
|
|
7117
|
+
setRemoteLaunchOn(Boolean(event && event.target && event.target.checked));
|
|
7118
|
+
},
|
|
7119
|
+
}),
|
|
7120
|
+
T('remote.launch')
|
|
7121
|
+
),
|
|
7122
|
+
h('div', { className: 'apkvm-dim' }, T('remote.launchHint')),
|
|
7123
|
+
remoteLaunchInfo
|
|
7124
|
+
? h(
|
|
7125
|
+
'label',
|
|
7126
|
+
{ style: { display: 'flex', alignItems: 'center', gap: '6px', fontSize: '12px' } },
|
|
7127
|
+
h('input', {
|
|
7128
|
+
type: 'checkbox',
|
|
7129
|
+
checked: remoteStopOnDisconnect,
|
|
7130
|
+
onChange: function (event) {
|
|
7131
|
+
setRemoteStopOnDisconnect(Boolean(event && event.target && event.target.checked));
|
|
7132
|
+
},
|
|
7133
|
+
}),
|
|
7134
|
+
T('remote.stopEmulator')
|
|
7135
|
+
)
|
|
7136
|
+
: null,
|
|
6727
7137
|
h(
|
|
6728
7138
|
'div',
|
|
6729
7139
|
{ style: { display: 'flex', alignItems: 'center', gap: '5px', flexWrap: 'wrap' } },
|
|
@@ -6741,10 +7151,319 @@ window.__ModuleLoader__.load({
|
|
|
6741
7151
|
disabled: remoteSshBusy,
|
|
6742
7152
|
onClick: disconnectRemoteSsh,
|
|
6743
7153
|
})
|
|
7154
|
+
: null,
|
|
7155
|
+
remoteProfile && remoteProfile.host
|
|
7156
|
+
? actionBtn(T('remote.forget'), {
|
|
7157
|
+
key: 'remote-forget',
|
|
7158
|
+
small: true,
|
|
7159
|
+
disabled: remoteSshBusy,
|
|
7160
|
+
onClick: forgetRemoteProfile,
|
|
7161
|
+
})
|
|
6744
7162
|
: null
|
|
6745
7163
|
),
|
|
7164
|
+
remoteSessions && remoteSessions.length
|
|
7165
|
+
? h(
|
|
7166
|
+
'div',
|
|
7167
|
+
{ className: 'apkvm-remotestack', style: { display: 'flex', flexDirection: 'column', gap: '4px' } },
|
|
7168
|
+
h('div', { className: 'apkvm-dim' }, T('remote.sessions') + ': ' + String(remoteSessions.length)),
|
|
7169
|
+
remoteSessions.map(function (session) {
|
|
7170
|
+
return h(
|
|
7171
|
+
'div',
|
|
7172
|
+
{
|
|
7173
|
+
key: 'remote-session-' + session.id,
|
|
7174
|
+
style: { display: 'flex', alignItems: 'center', gap: '6px', fontSize: '11px' },
|
|
7175
|
+
},
|
|
7176
|
+
h(
|
|
7177
|
+
'span',
|
|
7178
|
+
{ className: 'apkvm-dim', style: { minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis' } },
|
|
7179
|
+
String(session.avdName || '') + ' · ' + String(session.host || '') + ' · ' + String(session.state || '')
|
|
7180
|
+
),
|
|
7181
|
+
actionBtn(T(session.launch === true ? 'remote.sessionKill' : 'remote.sessionDisconnect'), {
|
|
7182
|
+
key: 'remote-session-stop-' + session.id,
|
|
7183
|
+
small: true,
|
|
7184
|
+
variant: 'danger',
|
|
7185
|
+
onClick: function () {
|
|
7186
|
+
disconnectRemoteSession(session.id, session.launch === true);
|
|
7187
|
+
},
|
|
7188
|
+
})
|
|
7189
|
+
);
|
|
7190
|
+
})
|
|
7191
|
+
)
|
|
7192
|
+
: null,
|
|
6746
7193
|
remoteSsh && remoteSsh.serial
|
|
6747
|
-
? h('div', { className: 'apkvm-dim' }, '
|
|
7194
|
+
? h('div', { className: 'apkvm-dim' }, T('remote.serial') + ': ' + remoteSsh.serial)
|
|
7195
|
+
: null,
|
|
7196
|
+
remoteLaunchInfo
|
|
7197
|
+
? h(
|
|
7198
|
+
'div',
|
|
7199
|
+
{ className: 'apkvm-dim' },
|
|
7200
|
+
T('remote.log') + ': ' + String(remoteLaunchInfo.logPath || '') + ' (console ' + String(remoteLaunchInfo.consolePort || '') + ')'
|
|
7201
|
+
)
|
|
7202
|
+
: null,
|
|
7203
|
+
remoteProfile && remoteProfile.host
|
|
7204
|
+
? h('div', { className: 'apkvm-dim' }, T('remote.profileSaved', { host: remoteProfile.host }))
|
|
7205
|
+
: null
|
|
7206
|
+
)
|
|
7207
|
+
);
|
|
7208
|
+
|
|
7209
|
+
var mediaCamera = mediaSettings && isObject(mediaSettings.camera) ? mediaSettings.camera : { back: 'emulated', front: 'none', posters: [] };
|
|
7210
|
+
var mediaMic = mediaSettings && isObject(mediaSettings.mic) ? mediaSettings.mic : { mode: 'off' };
|
|
7211
|
+
var mediaCaps = mediaSettings && isObject(mediaSettings.capabilities) ? mediaSettings.capabilities : {};
|
|
7212
|
+
var mediaCameraModes = mediaCaps.camera && Array.isArray(mediaCaps.camera.modes) ? mediaCaps.camera.modes : ['none', 'emulated', 'virtualscene'];
|
|
7213
|
+
var mediaMicBackends = mediaCaps.mic && Array.isArray(mediaCaps.mic.backendChoices) ? mediaCaps.mic.backendChoices : ['none', 'sdl', 'winmm', 'dsound'];
|
|
7214
|
+
var mediaPosterList = Array.isArray(mediaCamera.posters) ? mediaCamera.posters : [];
|
|
7215
|
+
|
|
7216
|
+
function addMediaPoster() {
|
|
7217
|
+
var name = String(mediaPosterName || '').trim();
|
|
7218
|
+
var posterPath = String(mediaPosterPath || '').trim();
|
|
7219
|
+
if (!name || !posterPath) return;
|
|
7220
|
+
updateMediaSettings({ camera: { posters: mediaPosterList.concat([{ name: name, path: posterPath }]) } });
|
|
7221
|
+
setMediaPosterName('');
|
|
7222
|
+
setMediaPosterPath('');
|
|
7223
|
+
}
|
|
7224
|
+
|
|
7225
|
+
function removeMediaPoster(name) {
|
|
7226
|
+
updateMediaSettings({
|
|
7227
|
+
camera: {
|
|
7228
|
+
posters: mediaPosterList.filter(function (poster) {
|
|
7229
|
+
return poster.name !== name;
|
|
7230
|
+
}),
|
|
7231
|
+
},
|
|
7232
|
+
});
|
|
7233
|
+
}
|
|
7234
|
+
|
|
7235
|
+
var mediaCard = h(
|
|
7236
|
+
'details',
|
|
7237
|
+
{ className: 'apkvm-card apkvm-debug' },
|
|
7238
|
+
h(
|
|
7239
|
+
'summary',
|
|
7240
|
+
{ className: 'apkvm-debug-summary' },
|
|
7241
|
+
h('span', { className: 'apkvm-card-title' }, T('media.title')),
|
|
7242
|
+
h(
|
|
7243
|
+
'span',
|
|
7244
|
+
{ className: 'apkvm-dim', style: { marginLeft: 'auto' } },
|
|
7245
|
+
String(mediaCamera.back || '') + ' · ' + String(mediaMic.mode || 'off')
|
|
7246
|
+
),
|
|
7247
|
+
h('span', { className: 'apkvm-chevron', 'aria-hidden': 'true' }, '▸')
|
|
7248
|
+
),
|
|
7249
|
+
h(
|
|
7250
|
+
'div',
|
|
7251
|
+
{ className: 'apkvm-debug-body' },
|
|
7252
|
+
h('div', { className: 'apkvm-dim' }, T('media.mic')),
|
|
7253
|
+
h(
|
|
7254
|
+
'div',
|
|
7255
|
+
{ style: { display: 'flex', gap: '5px', flexWrap: 'wrap' } },
|
|
7256
|
+
['off', 'host', 'file'].map(function (mode) {
|
|
7257
|
+
var label = mode === 'off' ? T('media.micOff') : mode === 'host' ? T('media.micHost') : T('media.micFile');
|
|
7258
|
+
return actionBtn(label, {
|
|
7259
|
+
key: 'mic-mode-' + mode,
|
|
7260
|
+
small: true,
|
|
7261
|
+
variant: mediaMic.mode === mode ? 'primary' : undefined,
|
|
7262
|
+
onClick: function () {
|
|
7263
|
+
updateMediaSettings({ mic: { mode: mode } });
|
|
7264
|
+
},
|
|
7265
|
+
});
|
|
7266
|
+
})
|
|
7267
|
+
),
|
|
7268
|
+
mediaMic.mode === 'file'
|
|
7269
|
+
? h('input', {
|
|
7270
|
+
className: 'apkvm-input',
|
|
7271
|
+
type: 'text',
|
|
7272
|
+
value: String(mediaMic.filePath || ''),
|
|
7273
|
+
placeholder: T('media.micPath'),
|
|
7274
|
+
spellCheck: false,
|
|
7275
|
+
onChange: function (event) {
|
|
7276
|
+
updateMediaSettings({ mic: { filePath: event && event.target ? String(event.target.value) : '' } });
|
|
7277
|
+
},
|
|
7278
|
+
})
|
|
7279
|
+
: null,
|
|
7280
|
+
mediaMic.mode !== 'off'
|
|
7281
|
+
? h(
|
|
7282
|
+
'div',
|
|
7283
|
+
{ style: { display: 'flex', gap: '5px', flexWrap: 'wrap', alignItems: 'center' } },
|
|
7284
|
+
h('span', { className: 'apkvm-dim' }, T('media.micBackend')),
|
|
7285
|
+
mediaMicBackends.map(function (backend) {
|
|
7286
|
+
return actionBtn(backend, {
|
|
7287
|
+
key: 'mic-backend-' + backend,
|
|
7288
|
+
small: true,
|
|
7289
|
+
variant: mediaMic.backend === backend ? 'primary' : undefined,
|
|
7290
|
+
onClick: function () {
|
|
7291
|
+
updateMediaSettings({ mic: { backend: backend } });
|
|
7292
|
+
},
|
|
7293
|
+
});
|
|
7294
|
+
})
|
|
7295
|
+
)
|
|
7296
|
+
: null,
|
|
7297
|
+
h('div', { className: 'apkvm-dim' }, T('media.back') + ': ' + String(mediaCamera.back || '') + ' · ' + T('media.front') + ': ' + String(mediaCamera.front || '')),
|
|
7298
|
+
h(
|
|
7299
|
+
'div',
|
|
7300
|
+
{ style: { display: 'flex', gap: '5px', flexWrap: 'wrap' } },
|
|
7301
|
+
mediaCameraModes.map(function (mode) {
|
|
7302
|
+
return actionBtn('▣ ' + mode, {
|
|
7303
|
+
key: 'camera-back-' + mode,
|
|
7304
|
+
small: true,
|
|
7305
|
+
variant: mediaCamera.back === mode ? 'primary' : undefined,
|
|
7306
|
+
onClick: function () {
|
|
7307
|
+
updateMediaSettings({ camera: { back: mode } });
|
|
7308
|
+
},
|
|
7309
|
+
});
|
|
7310
|
+
}),
|
|
7311
|
+
mediaCameraModes.map(function (mode) {
|
|
7312
|
+
return actionBtn('▢ ' + mode, {
|
|
7313
|
+
key: 'camera-front-' + mode,
|
|
7314
|
+
small: true,
|
|
7315
|
+
variant: mediaCamera.front === mode ? 'primary' : undefined,
|
|
7316
|
+
onClick: function () {
|
|
7317
|
+
updateMediaSettings({ camera: { front: mode } });
|
|
7318
|
+
},
|
|
7319
|
+
});
|
|
7320
|
+
})
|
|
7321
|
+
),
|
|
7322
|
+
mediaPosterList.length
|
|
7323
|
+
? h(
|
|
7324
|
+
'div',
|
|
7325
|
+
{ style: { display: 'flex', flexDirection: 'column', gap: '3px' } },
|
|
7326
|
+
mediaPosterList.map(function (poster) {
|
|
7327
|
+
return h(
|
|
7328
|
+
'div',
|
|
7329
|
+
{ key: 'poster-' + poster.name, style: { display: 'flex', gap: '6px', alignItems: 'center', fontSize: '11px' } },
|
|
7330
|
+
h('span', { className: 'apkvm-dim', style: { minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis' } }, poster.name + ' = ' + String(poster.path || '')),
|
|
7331
|
+
actionBtn('×', {
|
|
7332
|
+
key: 'poster-remove-' + poster.name,
|
|
7333
|
+
small: true,
|
|
7334
|
+
onClick: function () {
|
|
7335
|
+
removeMediaPoster(poster.name);
|
|
7336
|
+
},
|
|
7337
|
+
})
|
|
7338
|
+
);
|
|
7339
|
+
})
|
|
7340
|
+
)
|
|
7341
|
+
: null,
|
|
7342
|
+
h(
|
|
7343
|
+
'div',
|
|
7344
|
+
{ style: { display: 'flex', gap: '5px', flexWrap: 'wrap' } },
|
|
7345
|
+
h('input', {
|
|
7346
|
+
className: 'apkvm-input',
|
|
7347
|
+
type: 'text',
|
|
7348
|
+
value: mediaPosterName,
|
|
7349
|
+
placeholder: T('media.posterName'),
|
|
7350
|
+
spellCheck: false,
|
|
7351
|
+
onChange: function (event) {
|
|
7352
|
+
setMediaPosterName(event && event.target ? String(event.target.value) : '');
|
|
7353
|
+
},
|
|
7354
|
+
}),
|
|
7355
|
+
h('input', {
|
|
7356
|
+
className: 'apkvm-input',
|
|
7357
|
+
type: 'text',
|
|
7358
|
+
value: mediaPosterPath,
|
|
7359
|
+
placeholder: T('media.posterPath'),
|
|
7360
|
+
spellCheck: false,
|
|
7361
|
+
onChange: function (event) {
|
|
7362
|
+
setMediaPosterPath(event && event.target ? String(event.target.value) : '');
|
|
7363
|
+
},
|
|
7364
|
+
}),
|
|
7365
|
+
actionBtn(T('media.posterAdd'), {
|
|
7366
|
+
key: 'poster-add',
|
|
7367
|
+
small: true,
|
|
7368
|
+
disabled: !mediaPosterName.trim() || !mediaPosterPath.trim(),
|
|
7369
|
+
onClick: addMediaPoster,
|
|
7370
|
+
})
|
|
7371
|
+
),
|
|
7372
|
+
h(
|
|
7373
|
+
'div',
|
|
7374
|
+
{ style: { display: 'flex', gap: '5px', flexWrap: 'wrap' } },
|
|
7375
|
+
actionBtn(mediaBusy ? '…' : T('media.apply'), {
|
|
7376
|
+
key: 'media-save',
|
|
7377
|
+
small: true,
|
|
7378
|
+
disabled: mediaBusy,
|
|
7379
|
+
onClick: function () {
|
|
7380
|
+
saveMediaSettings(false);
|
|
7381
|
+
},
|
|
7382
|
+
}),
|
|
7383
|
+
actionBtn(T('media.applyRestart'), {
|
|
7384
|
+
key: 'media-save-restart',
|
|
7385
|
+
small: true,
|
|
7386
|
+
variant: 'primary',
|
|
7387
|
+
disabled: mediaBusy,
|
|
7388
|
+
onClick: function () {
|
|
7389
|
+
saveMediaSettings(true);
|
|
7390
|
+
},
|
|
7391
|
+
})
|
|
7392
|
+
),
|
|
7393
|
+
h('div', { className: 'apkvm-dim' }, T('media.hint')),
|
|
7394
|
+
mediaSettings && mediaSettings.settingsPath ? h('div', { className: 'apkvm-dim' }, String(mediaSettings.settingsPath)) : null
|
|
7395
|
+
)
|
|
7396
|
+
);
|
|
7397
|
+
|
|
7398
|
+
var emulatorCard = h(
|
|
7399
|
+
'details',
|
|
7400
|
+
{ className: 'apkvm-card apkvm-debug' },
|
|
7401
|
+
h(
|
|
7402
|
+
'summary',
|
|
7403
|
+
{ className: 'apkvm-debug-summary' },
|
|
7404
|
+
h('span', { className: 'apkvm-card-title' }, T('emulators.title')),
|
|
7405
|
+
h(
|
|
7406
|
+
'span',
|
|
7407
|
+
{ className: 'apkvm-dim', style: { marginLeft: 'auto' } },
|
|
7408
|
+
emulatorInventory
|
|
7409
|
+
? String(
|
|
7410
|
+
((emulatorInventory.local && Array.isArray(emulatorInventory.local.avds) ? emulatorInventory.local.avds.length : 0) +
|
|
7411
|
+
(Array.isArray(emulatorInventory.remotes) ? emulatorInventory.remotes.length : 0))
|
|
7412
|
+
)
|
|
7413
|
+
: emulatorBusy
|
|
7414
|
+
? '…'
|
|
7415
|
+
: ''
|
|
7416
|
+
),
|
|
7417
|
+
h('span', { className: 'apkvm-chevron', 'aria-hidden': 'true' }, '▸')
|
|
7418
|
+
),
|
|
7419
|
+
h(
|
|
7420
|
+
'div',
|
|
7421
|
+
{ className: 'apkvm-debug-body' },
|
|
7422
|
+
h(
|
|
7423
|
+
'div',
|
|
7424
|
+
{ style: { display: 'flex', gap: '5px' } },
|
|
7425
|
+
actionBtn(emulatorBusy ? '…' : T('emulators.refresh'), {
|
|
7426
|
+
key: 'emulators-refresh',
|
|
7427
|
+
small: true,
|
|
7428
|
+
disabled: emulatorBusy,
|
|
7429
|
+
onClick: loadEmulatorInventory,
|
|
7430
|
+
})
|
|
7431
|
+
),
|
|
7432
|
+
h('div', { className: 'apkvm-dim' }, T('emulators.local')),
|
|
7433
|
+
emulatorInventory && emulatorInventory.local && Array.isArray(emulatorInventory.local.avds) && emulatorInventory.local.avds.length
|
|
7434
|
+
? h(
|
|
7435
|
+
'div',
|
|
7436
|
+
null,
|
|
7437
|
+
emulatorInventory.local.avds.map(function (avd) {
|
|
7438
|
+
return h(
|
|
7439
|
+
'div',
|
|
7440
|
+
{ key: 'emu-local-' + avd.name, className: 'apkvm-dim', style: { fontSize: '11px' } },
|
|
7441
|
+
String(avd.name || '') + (avd.target ? ' · ' + avd.target : '') + (avd.abi ? ' · ' + avd.abi : '')
|
|
7442
|
+
);
|
|
7443
|
+
})
|
|
7444
|
+
)
|
|
7445
|
+
: h('div', { className: 'apkvm-dim', style: { fontSize: '11px' } }, T('emulators.empty')),
|
|
7446
|
+
Array.isArray(emulatorInventory && emulatorInventory.remotes) && emulatorInventory.remotes.length
|
|
7447
|
+
? h(
|
|
7448
|
+
'div',
|
|
7449
|
+
null,
|
|
7450
|
+
emulatorInventory.remotes.map(function (remote) {
|
|
7451
|
+
var host = remote && remote.profile ? remote.profile.host : '';
|
|
7452
|
+
return h(
|
|
7453
|
+
'div',
|
|
7454
|
+
{ key: 'emu-remote-' + host, className: 'apkvm-dim', style: { fontSize: '11px' } },
|
|
7455
|
+
String(host || '') +
|
|
7456
|
+
' · ' +
|
|
7457
|
+
(remote && remote.ok
|
|
7458
|
+
? (remote.avds || [])
|
|
7459
|
+
.map(function (avd) {
|
|
7460
|
+
return avd.name;
|
|
7461
|
+
})
|
|
7462
|
+
.join(', ')
|
|
7463
|
+
: T('emulators.hostDown'))
|
|
7464
|
+
);
|
|
7465
|
+
})
|
|
7466
|
+
)
|
|
6748
7467
|
: null
|
|
6749
7468
|
)
|
|
6750
7469
|
);
|
|
@@ -7174,7 +7893,7 @@ window.__ModuleLoader__.load({
|
|
|
7174
7893
|
toastBanner,
|
|
7175
7894
|
h(
|
|
7176
7895
|
'div',
|
|
7177
|
-
{ className: 'apkvm-body' },
|
|
7896
|
+
{ className: 'apkvm-body' + (wideDashboard ? ' apkvm-dashboard' : '') },
|
|
7178
7897
|
h(
|
|
7179
7898
|
'aside',
|
|
7180
7899
|
{ className: 'apkvm-aside apkvm-scroll' },
|
|
@@ -7182,20 +7901,25 @@ window.__ModuleLoader__.load({
|
|
|
7182
7901
|
apkCard,
|
|
7183
7902
|
instancesCard,
|
|
7184
7903
|
ownerCard,
|
|
7185
|
-
activityCard,
|
|
7186
|
-
debugCard,
|
|
7904
|
+
wideDashboard ? null : activityCard,
|
|
7905
|
+
wideDashboard ? null : debugCard,
|
|
7187
7906
|
flowCard,
|
|
7188
7907
|
skillCard,
|
|
7189
7908
|
networkCard,
|
|
7190
7909
|
storageCard,
|
|
7191
7910
|
snapshotCard,
|
|
7192
7911
|
remoteCard,
|
|
7912
|
+
mediaCard,
|
|
7913
|
+
emulatorCard,
|
|
7193
7914
|
appsCard,
|
|
7194
7915
|
diagCard,
|
|
7195
7916
|
h('div', { className: 'apkvm-footnote', title: T('hint.boot') }, T('hint.short')),
|
|
7196
7917
|
h('span', { className: 'apkvm-sr-only' }, T('hint.boot'))
|
|
7197
7918
|
),
|
|
7198
|
-
stageEl
|
|
7919
|
+
stageEl,
|
|
7920
|
+
wideDashboard
|
|
7921
|
+
? h('aside', { className: 'apkvm-side apkvm-scroll' }, activityCard, debugCard)
|
|
7922
|
+
: null
|
|
7199
7923
|
),
|
|
7200
7924
|
dragging
|
|
7201
7925
|
? h(
|