refactor(embed): iframe title + captured frame ref, allow-absent test, router comment

This commit is contained in:
root
2026-06-08 15:13:05 +10:00
parent 29a9185788
commit ae2ea09f0c
3 changed files with 12 additions and 4 deletions

View File

@@ -10,6 +10,8 @@
// #/sacred-valley dashboard placeholder
// #/sentinel Yerin security view
// #/little-blue Little Blue caretaker view
// #/timelapse Timelapse iframe embed
// #/ai-usage AI Usage iframe embed
// Anything unrecognized falls through to the home handler.
const ROUTES = [

View File

@@ -6,16 +6,15 @@ import { el, mount } from '../dom.js';
export function embedView({ title, sub, src, allow }) {
return async function render(main) {
const frame = el('iframe', { src, class: 'term-frame', title, ...(allow ? { allow } : {}) });
mount(main,
el('div', { class: 'term-bar' },
el('span', { class: 'term-title' }, '◆ ' + title),
sub ? el('span', { class: 'muted', style: { fontSize: '11px' } }, sub) : null,
el('a', { class: 'ghost', style: { marginLeft: 'auto' }, href: src, target: '_blank', rel: 'noopener' }, '↗ Open'),
el('button', { class: 'ghost', onclick: () => {
const f = document.getElementById('embed-frame'); if (f) f.src = f.src;
} }, '⟳ Reload')
el('button', { class: 'ghost', onclick: () => { frame.src = frame.src; } }, '⟳ Reload')
),
el('iframe', { id: 'embed-frame', src, class: 'term-frame', ...(allow ? { allow } : {}) })
frame
);
};
}