From 37426c1dcb3a538c165890aabbc9d4db23249daa Mon Sep 17 00:00:00 2001 From: GrzegorzZajac000 Date: Mon, 18 Mar 2024 18:43:19 +0100 Subject: [PATCH] #1515 Token in notification --- src/content/events/contentOnMessage.js | 10 +++++--- src/content/functions/index.js | 1 - src/content/functions/pageLoadComplete.js | 30 ----------------------- 3 files changed, 6 insertions(+), 35 deletions(-) delete mode 100644 src/content/functions/pageLoadComplete.js diff --git a/src/content/events/contentOnMessage.js b/src/content/events/contentOnMessage.js index d183fe2..2d16277 100644 --- a/src/content/events/contentOnMessage.js +++ b/src/content/events/contentOnMessage.js @@ -57,15 +57,17 @@ const contentOnMessage = async (request, tabData) => { } if (!lastFocusedInput || !tokenInput) { - // Show token in notification - return; // @TODO: remove + return notification({ + title: 'Your token', + message: request.token + }); // @TODO: change to proper notification later } else { return inputToken(request, tokenInput, tabData?.url); } } case 'pageLoadComplete': { - return pageLoadComplete(tabData?.id); + return { status: 'ok' } // Possibly for future use } case 'notification': @@ -75,7 +77,7 @@ const contentOnMessage = async (request, tabData) => { if (request.action === 'notification') { return notification(request); } else if (request.action === 'notificationInfo') { - return showNotificationInfo(request); + return showNotificationInfo(); } break; diff --git a/src/content/functions/index.js b/src/content/functions/index.js index 9280f77..f899369 100644 --- a/src/content/functions/index.js +++ b/src/content/functions/index.js @@ -35,7 +35,6 @@ exports.loadFonts = require('./loadFonts'); exports.neverShowNotificationInfo = require('./neverShowNotificationInfo'); exports.notification = require('./notification'); exports.openOptionsPage = require('./openOptionsPage'); -exports.pageLoadComplete = require('./pageLoadComplete'); exports.portSetup = require('./portSetup'); exports.showNotificationInfo = require('./showNotificationInfo'); exports.updateEventListener = require('./updateEventListener'); diff --git a/src/content/functions/pageLoadComplete.js b/src/content/functions/pageLoadComplete.js deleted file mode 100644 index bc0fe18..0000000 --- a/src/content/functions/pageLoadComplete.js +++ /dev/null @@ -1,30 +0,0 @@ -// -// This file is part of the 2FAS Browser Extension (https://github.com/twofas/2fas-browser-extension) -// Copyright © 2023 Two Factor Authentication Service, Inc. -// Contributed by Grzegorz Zając. All rights reserved. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see -// - -const addInputListener = require('../functions/addInputListener'); -const getInputs = require('../functions/getInputs'); -const addFormElementsNumber = require('../functions/addFormElementsNumber'); -const getFormElements = require('../functions/getFormElements'); - -const pageLoadComplete = async tabID => { - addInputListener(getInputs(), tabID); - addFormElementsNumber(getFormElements()); -}; - -module.exports = pageLoadComplete;