fix(ext/settings): pass sessionHandle to security section (sentinel 1 = unlocked)

This commit is contained in:
adlee-was-taken
2026-05-03 21:16:39 -04:00
parent 6bb7dedc3e
commit 4e9859d461

View File

@@ -31,6 +31,7 @@ const NAV_ITEMS: Array<{ id: SettingsSection; icon: string; label: string; group
let activeSection: SettingsSection = 'autofill';
let activeKeyHandler: ((e: KeyboardEvent) => void) | null = null;
let pendingVaultSettings: VaultSettings | null = null;
let sessionHandle: number | null = null;
export async function renderSettings(container: HTMLElement): Promise<void> {
container.innerHTML = `
@@ -45,6 +46,9 @@ export async function renderSettings(container: HTMLElement): Promise<void> {
</div>
`;
const unlockedResp = await sendMessage({ type: 'is_unlocked' });
sessionHandle = (unlockedResp.ok && unlockedResp.data && (unlockedResp.data as { unlocked: boolean }).unlocked) ? 1 : null;
wireNav();
await renderSection(activeSection);
}
@@ -57,6 +61,7 @@ export function teardownSettings(): void {
activeKeyHandler = null;
}
pendingVaultSettings = null;
sessionHandle = null;
}
function navItemHtml(item: (typeof NAV_ITEMS)[0]): string {
@@ -90,7 +95,7 @@ async function renderSection(section: SettingsSection): Promise<void> {
switch (section) {
case 'autofill': return renderAutofillSection(content);
case 'display': return renderDisplaySection(content);
case 'security': return renderSecuritySection(content, null);
case 'security': return renderSecuritySection(content, sessionHandle);
case 'generator': return renderGeneratorSection(content);
case 'retention': return renderRetentionSection(content);
case 'backup': return renderBackupSection(content);