#1515 Token in notification

This commit is contained in:
GrzegorzZajac000 2024-03-18 18:43:19 +01:00
parent 794ffcfc77
commit 37426c1dcb
3 changed files with 6 additions and 35 deletions

View File

@ -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;

View File

@ -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');

View File

@ -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 <https://www.gnu.org/licenses/>
//
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;