mirror of
https://github.com/twofas/2fas-browser-extension.git
synced 2024-11-24 11:09:58 +01:00
#1515 Clipboard WIP
This commit is contained in:
parent
9bcb9baf1c
commit
794ffcfc77
@ -111,7 +111,6 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.24.0",
|
||||
"@extend-chrome/clipboard": "^2.0.0",
|
||||
"qrcode": "^1.5.3",
|
||||
"uuid": "^9.0.0"
|
||||
}
|
||||
|
@ -17,12 +17,10 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||
//
|
||||
|
||||
const browser = require('webextension-polyfill');
|
||||
const config = require('../../config');
|
||||
const loadFromLocalStorage = require('../../localStorage/loadFromLocalStorage');
|
||||
const { notification, inputToken, getTokenInput, showNotificationInfo, loadFonts, isInFrame, pageLoadComplete } = require('../functions');
|
||||
const storeLog = require('../../partials/storeLog');
|
||||
const { clipboard } = require('@extend-chrome/clipboard');
|
||||
|
||||
const contentOnMessage = async (request, tabData) => {
|
||||
if (!request || !request.action) {
|
||||
@ -56,27 +54,14 @@ const contentOnMessage = async (request, tabData) => {
|
||||
|
||||
if (lastFocusedInput) {
|
||||
tokenInput = getTokenInput(lastFocusedInput);
|
||||
}
|
||||
|
||||
if (!lastFocusedInput || !tokenInput) {
|
||||
// Show token in notification
|
||||
return; // @TODO: remove
|
||||
} else {
|
||||
return clipboard.writeText(request.token)
|
||||
.then(() => browser.runtime.sendMessage({
|
||||
action: 'notificationOnBackground',
|
||||
data: config.Texts.Info.CopiedToClipboard,
|
||||
tabID: tabData?.id
|
||||
}))
|
||||
.then(() => {
|
||||
return { status: 'clipboard' };
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
// @TODO: catch err
|
||||
});
|
||||
return inputToken(request, tokenInput, tabData?.url);
|
||||
}
|
||||
|
||||
if (!tokenInput) {
|
||||
return { status: 'elementNotFound' };
|
||||
}
|
||||
|
||||
return inputToken(request, tokenInput, tabData?.url);
|
||||
}
|
||||
|
||||
case 'pageLoadComplete': {
|
||||
|
@ -33,6 +33,7 @@
|
||||
top: 25px !important;
|
||||
user-select: none !important;
|
||||
z-index: 999999 !important;
|
||||
z-index: infinite !important;
|
||||
|
||||
@media all and (max-width: 400px) {
|
||||
padding: 10px !important;
|
||||
|
@ -71,8 +71,7 @@
|
||||
"tabs",
|
||||
"storage",
|
||||
"notifications",
|
||||
"contextMenus",
|
||||
"clipboardWrite"
|
||||
"contextMenus"
|
||||
],
|
||||
"host_permissions": [
|
||||
"*://*.2fas.com/*"
|
||||
|
@ -71,8 +71,7 @@
|
||||
"tabs",
|
||||
"storage",
|
||||
"notifications",
|
||||
"contextMenus",
|
||||
"clipboardWrite"
|
||||
"contextMenus"
|
||||
],
|
||||
"host_permissions": [
|
||||
"*://*.2fas.com/*"
|
||||
|
@ -77,7 +77,6 @@
|
||||
"storage",
|
||||
"notifications",
|
||||
"contextMenus",
|
||||
"clipboardWrite",
|
||||
"https://*.2fas.com/*",
|
||||
"wss://*.2fas.com/*"
|
||||
],
|
||||
|
@ -70,8 +70,7 @@
|
||||
"tabs",
|
||||
"storage",
|
||||
"notifications",
|
||||
"contextMenus",
|
||||
"clipboardWrite"
|
||||
"contextMenus"
|
||||
],
|
||||
"host_permissions": [
|
||||
"*://*.2fas.com/*"
|
||||
|
@ -77,7 +77,6 @@
|
||||
"storage",
|
||||
"notifications",
|
||||
"contextMenus",
|
||||
"clipboardWrite",
|
||||
"https://*.2fas.com/*",
|
||||
"wss://*.2fas.com/*"
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user