feat(ext/popup): session expiry listener, open-vault links, Shift+F shortcut

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
adlee-was-taken
2026-04-27 15:46:32 -04:00
parent 101f0093a4
commit 7e0950e364
3 changed files with 39 additions and 8 deletions

View File

@@ -34,13 +34,20 @@ export function isInTab(): boolean {
return window.location.search.length > 0;
}
export function openVaultTab(hash?: string): void {
const url = chrome.runtime.getURL('vault.html') + (hash ? `#${hash}` : '');
chrome.tabs.create({ url });
}
export function popOutToTab(): void {
const state = getState();
const params = new URLSearchParams();
params.set('view', state.view);
if (state.newType) params.set('type', state.newType);
if (state.selectedId) params.set('id', state.selectedId);
chrome.tabs.create({ url: `popup.html?${params.toString()}` });
if (state.newType) {
openVaultTab(`add/${state.newType}`);
} else if (state.selectedId) {
openVaultTab(`${state.view}/${state.selectedId}`);
} else {
openVaultTab();
}
window.close();
}
@@ -272,4 +279,16 @@ async function init(): Promise<void> {
navigate('locked');
}
document.addEventListener('DOMContentLoaded', init);
document.addEventListener('DOMContentLoaded', () => {
init();
chrome.runtime.onMessage.addListener((msg) => {
if (msg.type === 'session_expired') {
currentState.view = 'locked';
currentState.error = null;
currentState.selectedItem = null;
currentState.selectedId = null;
render();
}
});
});