mirror of
https://github.com/twofas/2fas-browser-extension.git
synced 2024-11-26 04:00:09 +01:00
#1501 getInputs - FIX for URL change (hey.com)
This commit is contained in:
parent
ce0c2e1846
commit
1aab30e921
@ -24,6 +24,7 @@ const { getTabData, getInputs, addInputListener, portSetup, isInFrame, addFormEl
|
|||||||
const contentOnMessage = require('./events/contentOnMessage');
|
const contentOnMessage = require('./events/contentOnMessage');
|
||||||
const { loadFromLocalStorage, saveToLocalStorage } = require('../localStorage');
|
const { loadFromLocalStorage, saveToLocalStorage } = require('../localStorage');
|
||||||
const storeLog = require('../partials/storeLog');
|
const storeLog = require('../partials/storeLog');
|
||||||
|
const delay = require('../partials/delay');
|
||||||
|
|
||||||
let tabData;
|
let tabData;
|
||||||
let storage;
|
let storage;
|
||||||
@ -36,7 +37,19 @@ const contentScriptRun = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
let tabAttempt = 0;
|
||||||
|
|
||||||
|
do {
|
||||||
tabData = await getTabData();
|
tabData = await getTabData();
|
||||||
|
|
||||||
|
if (tabData?.status === 'complete') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
tabAttempt++;
|
||||||
|
await delay(() => {}, 200);
|
||||||
|
}
|
||||||
|
while (tabAttempt < 10)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error(e);
|
throw new Error(e);
|
||||||
}
|
}
|
||||||
|
@ -17,33 +17,14 @@
|
|||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>
|
// along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
//
|
//
|
||||||
|
|
||||||
const { loadFromLocalStorage, saveToLocalStorage } = require('../../localStorage');
|
const addInputListener = require('../functions/addInputListener');
|
||||||
const storeLog = require('../../partials/storeLog');
|
const getInputs = require('../functions/getInputs');
|
||||||
|
const addFormElementsNumber = require('../functions/addFormElementsNumber');
|
||||||
|
const getFormElements = require('../functions/getFormElements');
|
||||||
|
|
||||||
const pageLoadComplete = async tabID => {
|
const pageLoadComplete = async tabID => {
|
||||||
let storage;
|
addInputListener(getInputs(), tabID);
|
||||||
const activeElement = document?.activeElement;
|
addFormElementsNumber(getFormElements());
|
||||||
|
|
||||||
if (!activeElement) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const twofasInput = activeElement.getAttribute('data-twofas-input');
|
|
||||||
|
|
||||||
if (!twofasInput) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
storage = await loadFromLocalStorage([`tabData-${tabID}`, 'extensionID']);
|
|
||||||
} catch (err) {
|
|
||||||
await storeLog('error', 43, err, storage[`tabData-${tabID}`]?.url);
|
|
||||||
}
|
|
||||||
|
|
||||||
storage[`tabData-${tabID}`].lastFocusedInput = twofasInput;
|
|
||||||
|
|
||||||
return saveToLocalStorage({ [`tabData-${tabID}`]: storage[`tabData-${tabID}`] })
|
|
||||||
.catch(err => storeLog('error', 44, err, storage[`tabData-${tabID}`]?.url));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = pageLoadComplete;
|
module.exports = pageLoadComplete;
|
||||||
|
@ -23,6 +23,7 @@ const notObservedAttributes = [
|
|||||||
'data-twofas-input-listener',
|
'data-twofas-input-listener',
|
||||||
// CUSTOM
|
// CUSTOM
|
||||||
'data-ng-animate',
|
'data-ng-animate',
|
||||||
|
'data-submitting',
|
||||||
// GLOBAL ATTRIBUTES
|
// GLOBAL ATTRIBUTES
|
||||||
'href',
|
'href',
|
||||||
'acceskey',
|
'acceskey',
|
||||||
|
Loading…
Reference in New Issue
Block a user