diff --git a/src/background/main.js b/src/background/main.js index be247b5..c30e4c0 100644 --- a/src/background/main.js +++ b/src/background/main.js @@ -899,6 +899,8 @@ async function processMessage(request, sender) { return getBrowser(); } else if (request.id === 'optionChange') { await onOptionChange(); + } else if (request.id === 'clientAppInstall') { + await onClientAppInstall(); } } @@ -908,6 +910,14 @@ function onMessage(request, sender, sendResponse) { return processMessageResponse(response, sendResponse); } +async function onClientAppInstall() { + await storage.set({simulateUserInput: true}); + + await browser.runtime + .sendMessage({id: 'reloadOptionsPage'}) + .catch(() => null); +} + async function onOptionChange() { await setChallengeLocale(); } diff --git a/src/options/App.vue b/src/options/App.vue index 644dcf5..5b68e1d 100644 --- a/src/options/App.vue +++ b/src/options/App.vue @@ -360,6 +360,8 @@ export default { getText, setup: async function () { + browser.runtime.onMessage.addListener(this.onMessage); + const options = await storage.get(optionKeys); for (const option of Object.keys(this.options)) { @@ -388,6 +390,12 @@ export default { this.dataLoaded = true; }, + onMessage: function (request, sender) { + if (request.id === 'reloadOptionsPage') { + self.location.reload(); + } + }, + verifyClientApp: async function () { try { await pingClientApp(); diff --git a/src/setup/App.vue b/src/setup/App.vue index ceaa780..a7ff128 100644 --- a/src/setup/App.vue +++ b/src/setup/App.vue @@ -65,7 +65,6 @@