|
26 | 26 | adbauditor: '/ui/adbauditor/?mode=adb', |
27 | 27 | }; |
28 | 28 | const frame = document.getElementById(`${view}-frame`); |
29 | | - if (frame && !frame.getAttribute('data-loaded')) { |
| 29 | + if (view === 'securitylab') { |
| 30 | + // Deep-link a specific tool when chosen from the sidebar submenu. |
| 31 | + const slTab = state._securityLabTab; |
| 32 | + state._securityLabTab = null; |
| 33 | + if (frame && !frame.getAttribute('data-loaded')) { |
| 34 | + frame.setAttribute('data-loaded', '1'); |
| 35 | + setTimeout(() => { |
| 36 | + try { frame.src = '/ui/securitylab/' + (slTab ? '#' + slTab : ''); } |
| 37 | + catch (e) { console.warn('[router] securitylab iframe init failed', e); } |
| 38 | + }, 30); |
| 39 | + } else if (frame && slTab) { |
| 40 | + // Already loaded — switch tab in place, no reload. |
| 41 | + try { frame.contentWindow.postMessage({ type: 'securitylab-tab', tab: slTab }, '*'); } |
| 42 | + catch (e) { /* ignore cross-frame edge cases */ } |
| 43 | + } |
| 44 | + } else if (frame && !frame.getAttribute('data-loaded')) { |
30 | 45 | frame.setAttribute('data-loaded', '1'); |
31 | 46 | setTimeout(() => { |
32 | | - try { |
33 | | - if (view === 'securitylab') frame.src = '/ui/securitylab/'; |
34 | | - else frame.src = auditorPathMap[view] || `/ui/apkauditor/?mode=${modeMap[view]}`; |
35 | | - } catch (e) { |
| 47 | + try { frame.src = auditorPathMap[view] || `/ui/apkauditor/?mode=${modeMap[view]}`; } |
| 48 | + catch (e) { |
36 | 49 | // Keep SPA navigation alive even if iframe init fails in a browser/extension edge case. |
37 | 50 | console.warn('[router] auditor iframe init failed', e); |
38 | 51 | } |
|
0 commit comments