Skip to content

Commit

Permalink
better handling cookie validation message
Browse files Browse the repository at this point in the history
  • Loading branch information
bbilly1 committed Jan 28, 2025
1 parent 0218d78 commit 53c5e7f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions extension/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function toggleAutostart() {
}

// send ping message to TA backend
function pingBackend() {
async function pingBackend() {
clearError();
clearTempLocalStorage();
function handleResponse() {
Expand Down Expand Up @@ -179,7 +179,10 @@ function setCookieState() {
if (!message.cookie_enabled) {
document.getElementById('sendCookiesStatus').innerText = 'disabled';
} else {
let validattionMessage = `enabled, last verified ${message.validated_str}`;
let validattionMessage = 'enabled';
if (message.validated_str) {
validattionMessage += `, last verified ${message.validated_str}`;
}
document.getElementById('sendCookiesStatus').innerText = validattionMessage;
}
}
Expand Down Expand Up @@ -209,7 +212,7 @@ function setStatusIcon(connected) {

// fill in form
document.addEventListener('DOMContentLoaded', async () => {
function onGot(item) {
async function onGot(item) {
if (!item.access) {
console.log('no access details found');
if (item.popupFullUrl != null && fullUrlInput.value === '') {
Expand All @@ -233,7 +236,7 @@ document.addEventListener('DOMContentLoaded', async () => {
setCookieState();
}

function setContinuousCookiesOptions(result) {
async function setContinuousCookiesOptions(result) {
if (!result.continuousSync || result.continuousSync.checked === false) {
console.log('continuous cookie sync not set');
return;
Expand All @@ -242,7 +245,7 @@ document.addEventListener('DOMContentLoaded', async () => {
document.getElementById('continuous-sync').checked = true;
}

function setAutostartOption(result) {
async function setAutostartOption(result) {
console.log(result);
if (!result.autostart || result.autostart.checked === false) {
console.log('autostart not set');
Expand All @@ -263,5 +266,4 @@ document.addEventListener('DOMContentLoaded', async () => {
browserType.storage.local.get('autostart', function (result) {
setAutostartOption(result);
});

});

0 comments on commit 53c5e7f

Please sign in to comment.