Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,13 @@ async function getTotp(text: string) {
if (period) {
entryData[hash].period = period;
}
if (
(await EntryStorage.hasEncryptedEntry()) !==
encryption.getEncryptionStatus()
) {
chrome.tabs.sendMessage(id, { action: "errorenc" });
return;
}
await EntryStorage.import(encryption, entryData);
chrome.tabs.sendMessage(id, { action: "added", account });
}
Expand Down Expand Up @@ -410,6 +417,10 @@ function setAutolock() {
document.cookie = `passphrase="${getCachedPassphrase()}${getCookieExpiry()}"`;
autolockTimeout = setTimeout(() => {
cachedPassphrase = "";
const id = contentTab.id;
if (id) {
chrome.tabs.sendMessage(id, { action: "stopCapture" });
}
}, Number(localStorage.autolock) * 60000);
}
}
Expand Down
14 changes: 14 additions & 0 deletions src/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ if (!document.getElementById("__ga_grayLayout__")) {
case "errorqr":
alert(chrome.i18n.getMessage("errorqr"));
break;
case "errorenc":
alert(chrome.i18n.getMessage("phrase_incorrect"));
break;
case "added":
alert(message.account + chrome.i18n.getMessage("added"));
break;
Expand All @@ -23,6 +26,17 @@ if (!document.getElementById("__ga_grayLayout__")) {
case "pastecode":
pasteCode(message.code);
break;
case "stopCapture":
const captureBox = document.getElementById("__ga_captureBox__");
if (captureBox) {
captureBox.style.display = "none";
}

const grayLayout = document.getElementById("__ga_grayLayout__");
if (grayLayout) {
grayLayout.style.display = "none";
}
break;
default:
// invalid command, ignore it
break;
Expand Down