mirror of
https://github.com/twofas/2fas-browser-extension.git
synced 2024-11-22 02:00:08 +01:00
commit
0c52f37103
4
.babelrc
4
.babelrc
@ -5,7 +5,9 @@
|
||||
},
|
||||
"modules": "commonjs"
|
||||
}], ["minify", {
|
||||
"builtIns": false
|
||||
"builtIns": false,
|
||||
"keepFnName": true,
|
||||
"removeDebugger": true
|
||||
}]],
|
||||
"env": {
|
||||
"production": {
|
||||
|
@ -1,3 +1,6 @@
|
||||
API_URL=
|
||||
WS_URL=
|
||||
# API URL for REST requests (default: https://api2.2fas.com)
|
||||
API_URL=https://api2.2fas.com
|
||||
# Websocket URL (default: wss://ws.2fas.com)
|
||||
WS_URL=wss://ws.2fas.com
|
||||
# [ONLY FOR 2FAS TEAM] Key for localise.biz
|
||||
LOCO_KEY=
|
||||
|
@ -431,7 +431,7 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 52;
|
||||
CURRENT_PROJECT_VERSION = 54;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEVELOPMENT_TEAM = ZY8UR5ADFW;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
@ -445,7 +445,7 @@
|
||||
"@executable_path/../../../../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 11.0;
|
||||
MARKETING_VERSION = 1.6.3;
|
||||
MARKETING_VERSION = 1.6.4;
|
||||
OTHER_LDFLAGS = (
|
||||
"-framework",
|
||||
SafariServices,
|
||||
@ -467,7 +467,7 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 52;
|
||||
CURRENT_PROJECT_VERSION = 54;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEVELOPMENT_TEAM = ZY8UR5ADFW;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
@ -481,7 +481,7 @@
|
||||
"@executable_path/../../../../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 11.0;
|
||||
MARKETING_VERSION = 1.6.3;
|
||||
MARKETING_VERSION = 1.6.4;
|
||||
OTHER_LDFLAGS = (
|
||||
"-framework",
|
||||
SafariServices,
|
||||
@ -505,7 +505,7 @@
|
||||
CODE_SIGN_ENTITLEMENTS = "macOS (App)/2FAS - Two factor authentication.entitlements";
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 52;
|
||||
CURRENT_PROJECT_VERSION = 54;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEVELOPMENT_TEAM = ZY8UR5ADFW;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
@ -520,7 +520,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 11.0;
|
||||
MARKETING_VERSION = 1.6.3;
|
||||
MARKETING_VERSION = 1.6.4;
|
||||
OTHER_LDFLAGS = (
|
||||
"-framework",
|
||||
SafariServices,
|
||||
@ -546,7 +546,7 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Distribution";
|
||||
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 52;
|
||||
CURRENT_PROJECT_VERSION = 54;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEVELOPMENT_TEAM = ZY8UR5ADFW;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
@ -561,7 +561,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 11.0;
|
||||
MARKETING_VERSION = 1.6.3;
|
||||
MARKETING_VERSION = 1.6.4;
|
||||
OTHER_LDFLAGS = (
|
||||
"-framework",
|
||||
SafariServices,
|
||||
|
@ -34,4 +34,28 @@ Please make sure your pull request includes the following:
|
||||
|
||||
We will review your pull request and provide feedback as soon as possible. Thank you for your contribution!
|
||||
|
||||
By sharing ideas and code with the 2FAS community, either through GitHub or Discord, you agree that these contributions become the property of the 2FAS community and may be implemented into the 2FAS open source code.
|
||||
By sharing ideas and code with the 2FAS community, either through GitHub or Discord, you agree that these contributions become the property of the 2FAS community and may be implemented into the 2FAS open source code.
|
||||
|
||||
## Project setup
|
||||
### Requirements
|
||||
Before you start, you should have installed:
|
||||
- NodeJS (currently used version is always available in `.nvmrc` and `package.json` files). If you have installed `nvm`, you can use `nvm use` command in project directory.
|
||||
- latest `npm` or `yarn`
|
||||
|
||||
### First build
|
||||
1. Copy `.env.example` file and save it as `.env`
|
||||
2. Run `npm install` or `yarn install`
|
||||
3. Run command for chosen browser (f.e. `npm run chrome-dev` or `yarn chrome-dev` for Chrome browser)
|
||||
|
||||
### Useful scripts
|
||||
`chrome-dev`, `opera-dev`, `firefox-dev`, `edge-dev`, `safari-dev` - These scripts build extension code for development for chosen browser (without production mode, browserlist-update etc.)
|
||||
|
||||
`chrome-prod`, `opera-prod`, `firefox-prod`, `edge-prod`, `safari-prod` - These scripts build production extension code.
|
||||
|
||||
`chrome-build`, `opera-build`, `firefox-build`, `edge-build` - These scripts build production extension code and creates zip files for it. There is no script for Safari, because Safari version is created by xCode.
|
||||
|
||||
`all-build` - Script that performs build for all browsers (except Safari).
|
||||
|
||||
`firefox-run` - Additional script for `web-ext` tool for Firefox. You can read more about `web-ext` [`here`](https://github.com/mozilla/web-ext).
|
||||
|
||||
Other scripts are only aliases for longer commands. You don't need to know them and you shouldn't run them separately.
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
71
package.json
71
package.json
@ -1,35 +1,37 @@
|
||||
{
|
||||
"name": "2fas-browser-extension",
|
||||
"version": "1.6.3",
|
||||
"version": "1.6.4",
|
||||
"description": "This is the official Browser Extension for the Open Source 2FAS project.",
|
||||
"engines": {
|
||||
"node": "20.9.0"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf --glob ./public/*",
|
||||
"chrome-dev": "yarn clean && yarn generate-locales && cross-env EXT_PLATFORM=Chrome node_modules/.bin/webpack --mode development --progress --config webpack/development.config.js",
|
||||
"chrome-prod": "yarn clean && yarn generate-locales && npx update-browserslist-db@latest && cross-env EXT_PLATFORM=Chrome NODE_ENV=production node_modules/.bin/webpack --mode production --progress --config webpack/production.config.js",
|
||||
"chrome-build": "yarn chrome-prod && rimraf ./public/.gitkeep && powershell Compress-Archive ./public/* ./build/chrome_ext_%npm_package_version%.zip",
|
||||
"opera-dev": "yarn clean && yarn generate-locales && cross-env EXT_PLATFORM=Opera node_modules/.bin/webpack --mode development --progress --config webpack/development.config.js",
|
||||
"opera-prod": "yarn clean && yarn generate-locales && npx update-browserslist-db@latest && cross-env EXT_PLATFORM=Opera NODE_ENV=production node_modules/.bin/webpack --mode production --progress --config webpack/production.config.js",
|
||||
"opera-build": "yarn opera-prod && rimraf ./public/.gitkeep && powershell Compress-Archive ./public/* ./build/opera_ext_%npm_package_version%.zip",
|
||||
"firefox-dev": "yarn clean && yarn generate-locales && cross-env EXT_PLATFORM=Firefox node_modules/.bin/webpack --mode development --progress --config webpack/development.config.js",
|
||||
"firefox-prod": "yarn clean && yarn generate-locales && npx update-browserslist-db@latest && cross-env EXT_PLATFORM=Firefox NODE_ENV=production node_modules/.bin/webpack --mode production --progress --config webpack/production.config.js",
|
||||
"firefox-build": "yarn firefox-prod && rimraf ./public/.gitkeep && powershell Compress-Archive ./public/* ./build/firefox_ext_%npm_package_version%.zip",
|
||||
"firefox-run": "web-ext run --source-dir ./public/",
|
||||
"edge-dev": "yarn clean && yarn generate-locales && cross-env EXT_PLATFORM=Edge node_modules/.bin/webpack --mode development --progress --config webpack/development.config.js",
|
||||
"edge-prod": "yarn clean && yarn generate-locales && npx update-browserslist-db@latest && cross-env EXT_PLATFORM=Edge NODE_ENV=production node_modules/.bin/webpack --mode production --progress --config webpack/production.config.js",
|
||||
"edge-build": "yarn edge-prod && rimraf ./public/.gitkeep && powershell Compress-Archive ./public/* ./build/edge_ext_%npm_package_version%.zip",
|
||||
"safari-dev": "yarn clean && yarn generate-locales && cross-env EXT_PLATFORM=Safari node_modules/.bin/webpack --mode development --progress --config webpack/development.config.js",
|
||||
"safari-prod": "yarn clean && yarn generate-locales && npx update-browserslist-db@latest && cross-env EXT_PLATFORM=Safari NODE_ENV=production node_modules/.bin/webpack --mode production --progress --config webpack/production.config.js",
|
||||
"all-build": "rimraf --glob ./build/* && yarn generate-license-info && yarn chrome-build && yarn opera-build && yarn firefox-build && yarn edge-build",
|
||||
"browserlist-update": "npx update-browserslist-db@latest",
|
||||
"clean": "npx -y rimraf --glob ./public/*",
|
||||
"chrome-dev": "yon clean && yon generate-locales && npx -y cross-env EXT_PLATFORM=Chrome node_modules/.bin/webpack --mode development --progress --config webpack/development.config.js",
|
||||
"chrome-prod": "yon clean && yon generate-locales && yon browserlist-update && npx -y cross-env EXT_PLATFORM=Chrome NODE_ENV=production node_modules/.bin/webpack --mode production --progress --config webpack/production.config.js",
|
||||
"chrome-build": "yon chrome-prod && npx -y rimraf ./public/.gitkeep && yon check-build-directory && npx -y cross-env PLATFORM=Chrome yon zip-build",
|
||||
"opera-dev": "yon clean && yon generate-locales && npx -y cross-env EXT_PLATFORM=Opera node_modules/.bin/webpack --mode development --progress --config webpack/development.config.js",
|
||||
"opera-prod": "yon clean && yon generate-locales && yon browserlist-update && npx -y cross-env EXT_PLATFORM=Opera NODE_ENV=production node_modules/.bin/webpack --mode production --progress --config webpack/production.config.js",
|
||||
"opera-build": "yon opera-prod && npx -y rimraf ./public/.gitkeep && yon check-build-directory && npx -y cross-env PLATFORM=Opera yon zip-build",
|
||||
"firefox-dev": "yon clean && yon generate-locales && npx -y cross-env EXT_PLATFORM=Firefox node_modules/.bin/webpack --mode development --progress --config webpack/development.config.js",
|
||||
"firefox-prod": "yon clean && yon generate-locales && yon browserlist-update && npx -y cross-env EXT_PLATFORM=Firefox NODE_ENV=production node_modules/.bin/webpack --mode production --progress --config webpack/production.config.js",
|
||||
"firefox-build": "yon firefox-prod && npx -y rimraf ./public/.gitkeep && yon check-build-directory && npx -y cross-env PLATFORM=Firefox yon zip-build",
|
||||
"firefox-run": "npx -y web-ext run --source-dir ./public/",
|
||||
"edge-dev": "yon clean && yon generate-locales && npx -y cross-env EXT_PLATFORM=Edge node_modules/.bin/webpack --mode development --progress --config webpack/development.config.js",
|
||||
"edge-prod": "yon clean && yon generate-locales && yon browserlist-update && npx -y cross-env EXT_PLATFORM=Edge NODE_ENV=production node_modules/.bin/webpack --mode production --progress --config webpack/production.config.js",
|
||||
"edge-build": "yon edge-prod && npx -y rimraf ./public/.gitkeep && yon check-build-directory && npx -y cross-env PLATFORM=Edge yon zip-build",
|
||||
"safari-dev": "yon clean && yon generate-locales && npx -y cross-env EXT_PLATFORM=Safari node_modules/.bin/webpack --mode development --progress --config webpack/development.config.js",
|
||||
"safari-prod": "yon clean && yon generate-locales && yon browserlist-update && npx -y cross-env EXT_PLATFORM=Safari NODE_ENV=production node_modules/.bin/webpack --mode production --progress --config webpack/production.config.js",
|
||||
"all-build": "npx -y rimraf --glob ./build/* && yon generate-license-info && yon chrome-build && yon opera-build && yon firefox-build && yon edge-build",
|
||||
"browserlist-update": "npx -y update-browserslist-db@latest",
|
||||
"loco-export": "node webpack/utils/locoExport.js",
|
||||
"loco-import": "node webpack/utils/locoImport.js",
|
||||
"check-build-directory": "node webpack/utils/checkBuildDirectoryExists.js",
|
||||
"generate-locales": "node webpack/utils/generateLocales.js",
|
||||
"generate-license-info-html": "license-report --output=html >> open-source-licenses.html",
|
||||
"generate-license-info-json": "license-report --output=json >> open-source-licenses.json",
|
||||
"generate-license-info": "yarn generate-license-info-html && yarn generate-license-info-json"
|
||||
"generate-license-info-html": "npx -y license-report --output=html >> open-source-licenses.html",
|
||||
"generate-license-info-json": "npx -y license-report --output=json >> open-source-licenses.json",
|
||||
"generate-license-info": "yon generate-license-info-html && yon generate-license-info-json",
|
||||
"zip-build": "cd ./public/ && npx -y cross-var npx -y bestzip ../build/$PLATFORM_ext_$npm_package_version.zip * & cd .."
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -49,17 +51,14 @@
|
||||
"url": "https://2fas.com/donate/"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.23.9",
|
||||
"@babel/core": "^7.24.0",
|
||||
"@babel/eslint-parser": "^7.23.10",
|
||||
"@babel/plugin-transform-runtime": "^7.23.9",
|
||||
"@babel/preset-env": "^7.23.9",
|
||||
"@babel/plugin-transform-runtime": "^7.24.0",
|
||||
"@babel/preset-env": "^7.24.0",
|
||||
"@babel/register": "^7.22.15",
|
||||
"@babel/runtime": "^7.23.9",
|
||||
"autoprefixer": "^10.4.17",
|
||||
"autoprefixer": "^10.4.18",
|
||||
"babel-loader": "^9.1.3",
|
||||
"babel-plugin-dynamic-import-node": "^2.3.3",
|
||||
"babel-plugin-transform-minify-booleans": "^6.9.4",
|
||||
"babel-plugin-transform-remove-console": "^6.9.4",
|
||||
"babel-plugin-transform-remove-debugger": "^6.9.4",
|
||||
"babel-preset-minify": "^0.5.2",
|
||||
"browserslist": "^4.23.0",
|
||||
@ -82,11 +81,11 @@
|
||||
"file-loader": "^6.0.0",
|
||||
"html-loader": "^5.0.0",
|
||||
"html-webpack-plugin": "^5.5.3",
|
||||
"mini-css-extract-plugin": "^2.8.0",
|
||||
"mini-css-extract-plugin": "^2.8.1",
|
||||
"noop-loader": "^1.0.0",
|
||||
"path": "^0.12.7",
|
||||
"postcss": "^8.4.35",
|
||||
"postcss-loader": "^8.1.0",
|
||||
"postcss-loader": "^8.1.1",
|
||||
"postcss-sass": "^0.5.0",
|
||||
"precss": "^4.0.0",
|
||||
"require-dir": "^1.2.0",
|
||||
@ -97,9 +96,9 @@
|
||||
"stream-browserify": "^3.0.0",
|
||||
"streamify": "^1.0.0",
|
||||
"style-loader": "^3.3.4",
|
||||
"stylelint": "^15.10.3",
|
||||
"stylelint-config-recommended-scss": "^13.1.0",
|
||||
"stylelint-webpack-plugin": "^4.1.1",
|
||||
"stylelint": "^16.2.1",
|
||||
"stylelint-config-recommended-scss": "^14.0.0",
|
||||
"stylelint-webpack-plugin": "^5.0.0",
|
||||
"svg-inline-loader": "^0.8.2",
|
||||
"terser-webpack-plugin": "^5.3.9",
|
||||
"url-loader": "^4.1.0",
|
||||
@ -107,9 +106,11 @@
|
||||
"webpack": "^5.90.3",
|
||||
"webpack-cli": "^5.1.4",
|
||||
"webpack-node-externals": "^3.0.0",
|
||||
"ws": "^8.14.1"
|
||||
"ws": "^8.14.1",
|
||||
"yarn-or-npm": "^3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.24.0",
|
||||
"qrcode": "^1.5.3",
|
||||
"uuid": "^9.0.0"
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ const t = require('./_locales/en/notifications.json');
|
||||
const config = {
|
||||
WebSocketTimeout: 3, // in minutes
|
||||
ResendPushTimeout: 10, // in seconds
|
||||
ExtensionVersion: '1.6.3',
|
||||
ExtensionVersion: '1.6.4',
|
||||
|
||||
Texts: {
|
||||
Error: {
|
||||
|
@ -62,7 +62,7 @@ const inputToken = (request, inputElement, siteURL) => {
|
||||
document.activeElement.dispatchEvent(inputEvent);
|
||||
|
||||
// NORTON FIX
|
||||
if (siteURL.includes('login.norton')) {
|
||||
if (siteURL.includes('login.norton') || siteURL.includes('indodax.com')) {
|
||||
document.activeElement.dispatchEvent(new KeyboardEvent('keyup', { key: request.token[i] }));
|
||||
}
|
||||
// END NORTON FIX
|
||||
|
@ -46,17 +46,17 @@ const createObserver = tabData => {
|
||||
if (
|
||||
(mutation?.addedNodes && Array.from(mutation?.addedNodes).length > 0) ||
|
||||
(mutation?.attributeName === 'disabled' && !mutation?.target?.disabled) ||
|
||||
(mutation?.attirbuteName === 'style' && mutation?.target)
|
||||
(mutation?.attributeName === 'style' && mutation?.target)
|
||||
) {
|
||||
addedNodes(mutation, tabData);
|
||||
}
|
||||
|
||||
if (mutation?.type === 'attributes' && mutation?.target) {
|
||||
await hiddenNodes(mutation, tabData);
|
||||
hiddenNodes(mutation, tabData);
|
||||
}
|
||||
|
||||
if (mutation?.removedNodes && Array.from(mutation?.removedNodes).length > 0) {
|
||||
await removedNodes(mutation, tabData);
|
||||
removedNodes(mutation, tabData);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -18,13 +18,16 @@
|
||||
//
|
||||
|
||||
const notObservedNodes = [
|
||||
'a',
|
||||
'g',
|
||||
'path',
|
||||
'html',
|
||||
'body',
|
||||
'head',
|
||||
'link',
|
||||
'style',
|
||||
'script',
|
||||
'noscript',
|
||||
'title',
|
||||
'#cdata-section',
|
||||
'#comment',
|
||||
@ -34,29 +37,51 @@ const notObservedNodes = [
|
||||
'area',
|
||||
'audio',
|
||||
'b',
|
||||
'base',
|
||||
'bdi',
|
||||
'bdo',
|
||||
'blockquote',
|
||||
'br',
|
||||
'button',
|
||||
'canvas',
|
||||
'caption',
|
||||
'cite',
|
||||
'code',
|
||||
'data',
|
||||
'dd',
|
||||
'del',
|
||||
'details',
|
||||
'dfn',
|
||||
'dialog',
|
||||
'dl',
|
||||
'dt',
|
||||
'em',
|
||||
'embed',
|
||||
'figure',
|
||||
'hr',
|
||||
'i',
|
||||
'img',
|
||||
'ins',
|
||||
'label',
|
||||
'legend',
|
||||
'map',
|
||||
'mark',
|
||||
'meta',
|
||||
'meter',
|
||||
'object',
|
||||
'optgroup',
|
||||
'option',
|
||||
'output',
|
||||
'param',
|
||||
'picture',
|
||||
'pre',
|
||||
'progress',
|
||||
'q',
|
||||
'rp',
|
||||
'rt',
|
||||
'ruby',
|
||||
's',
|
||||
'samp',
|
||||
'search',
|
||||
'select',
|
||||
'small',
|
||||
@ -64,11 +89,15 @@ const notObservedNodes = [
|
||||
'strong',
|
||||
'sub',
|
||||
'sup',
|
||||
'svg',
|
||||
'summary',
|
||||
'template',
|
||||
'time',
|
||||
'track',
|
||||
'u',
|
||||
'var',
|
||||
'video',
|
||||
'wbr',
|
||||
// custom
|
||||
'tool-tip'
|
||||
];
|
||||
|
@ -17,23 +17,34 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||
//
|
||||
|
||||
/* global requestAnimationFrame */
|
||||
const browser = require('webextension-polyfill');
|
||||
const findSignificantChanges = require('./findSignificantChanges');
|
||||
const { getInputs, addInputListener, clearFormElementsNumber, addFormElementsNumber, getFormElements } = require('../../functions');
|
||||
const getChildNodes = require('./getChildNodes');
|
||||
const storeLog = require('../../../partials/storeLog');
|
||||
const notObservedNodes = require('../observerConstants/notObservedNodes');
|
||||
const uniqueOnly = require('../../../partials/uniqueOnly');
|
||||
|
||||
let queue = [];
|
||||
let tabData = null;
|
||||
let timeout;
|
||||
|
||||
const process = nodes => {
|
||||
if (document.readyState !== 'complete') {
|
||||
timeout = window.requestAnimationFrame(() => process(nodes));
|
||||
}
|
||||
|
||||
if (!nodes || nodes.length <= 0 || !tabData) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const addedNodes = nodes.filter((value, index, array) => array.indexOf(value) === index);
|
||||
const addedNodes =
|
||||
nodes
|
||||
.filter(uniqueOnly)
|
||||
.filter(node => !notObservedNodes.includes(node.nodeName.toLowerCase()))
|
||||
.flatMap(getChildNodes)
|
||||
.filter(uniqueOnly)
|
||||
.filter(node => !notObservedNodes.includes(node.nodeName.toLowerCase()));
|
||||
|
||||
let newInputs = false;
|
||||
let inputs = [];
|
||||
@ -73,24 +84,18 @@ const addedNodes = (mutation, tabInfo) => {
|
||||
return false;
|
||||
}
|
||||
|
||||
const newNodes =
|
||||
Array.from(mutation?.addedNodes)
|
||||
.concat(...(Array.from(mutation?.addedNodes).map(node => getChildNodes(node))))
|
||||
.concat(mutation?.target)
|
||||
.concat(...getChildNodes(mutation.target))
|
||||
.filter(node => !notObservedNodes.includes(node.nodeName.toLowerCase()));
|
||||
|
||||
if (!newNodes || newNodes.length <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
queue.push(...newNodes);
|
||||
queue.push(mutation.target);
|
||||
queue.push(...Array.from(mutation.addedNodes));
|
||||
|
||||
if (!tabData) {
|
||||
tabData = tabInfo;
|
||||
}
|
||||
|
||||
return requestAnimationFrame(() => process(queue));
|
||||
if (timeout) {
|
||||
window.cancelAnimationFrame(timeout);
|
||||
}
|
||||
|
||||
timeout = window.requestAnimationFrame(() => process(queue));
|
||||
};
|
||||
|
||||
module.exports = addedNodes;
|
||||
|
@ -17,7 +17,6 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||
//
|
||||
|
||||
/* global requestAnimationFrame */
|
||||
const browser = require('webextension-polyfill');
|
||||
const isVisible = require('../../functions/isVisible');
|
||||
const findSignificantChanges = require('./findSignificantChanges');
|
||||
@ -25,16 +24,28 @@ const getChildNodes = require('./getChildNodes');
|
||||
const { loadFromLocalStorage, saveToLocalStorage } = require('../../../localStorage');
|
||||
const storeLog = require('../../../partials/storeLog');
|
||||
const { clearFormElementsNumber, addFormElementsNumber, getFormElements } = require('../../functions');
|
||||
const uniqueOnly = require('../../../partials/uniqueOnly');
|
||||
|
||||
let queue = [];
|
||||
let tabData = null;
|
||||
let timeout;
|
||||
|
||||
const process = async nodes => {
|
||||
if (document.readyState !== 'complete') {
|
||||
timeout = window.requestAnimationFrame(() => process(nodes));
|
||||
}
|
||||
|
||||
if (!nodes || nodes.length <= 0 || !tabData) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const hiddenNodes = nodes.filter((value, index, array) => array.indexOf(value) === index);
|
||||
const hiddenNodes =
|
||||
nodes
|
||||
.filter(uniqueOnly)
|
||||
.filter(node => findSignificantChanges(node) && node.getAttribute('data-twofas-input'))
|
||||
.flatMap(getChildNodes)
|
||||
.filter(uniqueOnly)
|
||||
.filter(node => findSignificantChanges(node) && node.getAttribute('data-twofas-input'));
|
||||
|
||||
let storage;
|
||||
|
||||
@ -69,27 +80,22 @@ const process = async nodes => {
|
||||
});
|
||||
};
|
||||
|
||||
const hiddenNodes = async (mutation, tabInfo) => {
|
||||
const hiddenNodes = (mutation, tabInfo) => {
|
||||
if (!mutation?.target || !browser?.runtime?.id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const hiddenInputs =
|
||||
Array.from([...getChildNodes(mutation.target)])
|
||||
.concat(mutation.target)
|
||||
.filter(node => findSignificantChanges(node) && node.getAttribute('data-twofas-input'));
|
||||
|
||||
if (!hiddenInputs || hiddenInputs.length <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
queue.push(...hiddenInputs);
|
||||
queue.push(mutation.target);
|
||||
|
||||
if (!tabData) {
|
||||
tabData = tabInfo;
|
||||
}
|
||||
|
||||
return requestAnimationFrame(() => process(queue));
|
||||
if (timeout) {
|
||||
window.cancelAnimationFrame(timeout);
|
||||
}
|
||||
|
||||
timeout = window.requestAnimationFrame(() => process(queue));
|
||||
};
|
||||
|
||||
module.exports = hiddenNodes;
|
||||
|
@ -17,7 +17,6 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||
//
|
||||
|
||||
/* global requestAnimationFrame */
|
||||
const browser = require('webextension-polyfill');
|
||||
const significantInputs = require('../observerConstants/significantInputs');
|
||||
const { loadFromLocalStorage, saveToLocalStorage } = require('../../../localStorage');
|
||||
@ -25,11 +24,17 @@ const getChildNodes = require('./getChildNodes');
|
||||
const storeLog = require('../../../partials/storeLog');
|
||||
const { clearFormElementsNumber, addFormElementsNumber, getFormElements } = require('../../functions');
|
||||
const notObservedNodes = require('../observerConstants/notObservedNodes');
|
||||
const uniqueOnly = require('../../../partials/uniqueOnly');
|
||||
|
||||
let queue = [];
|
||||
let tabData = null;
|
||||
let timeout;
|
||||
|
||||
const process = async nodes => {
|
||||
if (document.readyState !== 'complete') {
|
||||
timeout = window.requestAnimationFrame(() => process(nodes));
|
||||
}
|
||||
|
||||
if (!nodes || nodes.length <= 0 || !tabData) {
|
||||
return false;
|
||||
}
|
||||
@ -37,7 +42,13 @@ const process = async nodes => {
|
||||
const ids = [];
|
||||
let storage;
|
||||
|
||||
const removedNodes = nodes.filter((value, index, array) => array.indexOf(value) === index);
|
||||
const removedNodes =
|
||||
nodes
|
||||
.filter(uniqueOnly)
|
||||
.filter(node => !notObservedNodes.includes(node.nodeName.toLowerCase()))
|
||||
.flatMap(getChildNodes)
|
||||
.filter(uniqueOnly)
|
||||
.filter(node => !notObservedNodes.includes(node.nodeName.toLowerCase()));
|
||||
|
||||
removedNodes.forEach(node => {
|
||||
const nodeName = node.nodeName.toLowerCase();
|
||||
@ -80,29 +91,23 @@ const process = async nodes => {
|
||||
.catch(err => storeLog('error', 40, err, tabData?.url));
|
||||
};
|
||||
|
||||
const removedNodes = async (mutation, tabInfo) => {
|
||||
const removedNodes = (mutation, tabInfo) => {
|
||||
if (!mutation?.target || !browser?.runtime?.id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const nodes =
|
||||
Array.from(mutation?.removedNodes)
|
||||
.concat(...(Array.from(mutation?.removedNodes).map(node => getChildNodes(node))))
|
||||
.concat(mutation?.target)
|
||||
.concat(...getChildNodes(mutation.target))
|
||||
.filter(node => !notObservedNodes.includes(node.nodeName.toLowerCase()));
|
||||
|
||||
if (!nodes || nodes.length <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
queue.push(...nodes);
|
||||
queue.push(mutation.target);
|
||||
queue.push(...Array.from(mutation.removedNodes));
|
||||
|
||||
if (!tabData) {
|
||||
tabData = tabInfo;
|
||||
}
|
||||
|
||||
return requestAnimationFrame(() => process(queue));
|
||||
if (timeout) {
|
||||
window.cancelAnimationFrame(timeout);
|
||||
}
|
||||
|
||||
timeout = window.requestAnimationFrame(() => process(queue));
|
||||
};
|
||||
|
||||
module.exports = removedNodes;
|
||||
|
@ -3,7 +3,7 @@
|
||||
"name": "2FAS - Two Factor Authentication",
|
||||
"short_name": "2FAS",
|
||||
"author": "Two Factor Authentication Service, Inc.",
|
||||
"version": "1.6.3",
|
||||
"version": "1.6.4",
|
||||
"description": "__MSG_appDesc__",
|
||||
"default_locale": "en",
|
||||
"icons": {
|
||||
|
@ -3,7 +3,7 @@
|
||||
"name": "2FAS - Two Factor Authentication",
|
||||
"short_name": "2FAS",
|
||||
"author": "Two Factor Authentication Service, Inc.",
|
||||
"version": "1.6.3",
|
||||
"version": "1.6.4",
|
||||
"description": "__MSG_appDesc__",
|
||||
"default_locale": "en",
|
||||
"icons": {
|
||||
|
@ -3,7 +3,7 @@
|
||||
"name": "2FAS - Two Factor Authentication",
|
||||
"short_name": "2FAS",
|
||||
"author": "Two Factor Authentication Service, Inc.",
|
||||
"version": "1.6.3",
|
||||
"version": "1.6.4",
|
||||
"applications": {
|
||||
"gecko": {
|
||||
"id": "admin@2fas.com",
|
||||
|
@ -3,7 +3,7 @@
|
||||
"name": "2FAS - Two Factor Authentication",
|
||||
"short_name": "2FAS",
|
||||
"author": "Two Factor Authentication Service, Inc.",
|
||||
"version": "1.6.3",
|
||||
"version": "1.6.4",
|
||||
"description": "__MSG_appDesc__",
|
||||
"default_locale": "en",
|
||||
"icons": {
|
||||
|
@ -3,7 +3,7 @@
|
||||
"name": "2FAS - Two Factor Authentication",
|
||||
"short_name": "2FAS",
|
||||
"author": "Two Factor Authentication Service, Inc.",
|
||||
"version": "1.6.3",
|
||||
"version": "1.6.4",
|
||||
"description": "__MSG_appDesc__",
|
||||
"default_locale": "en",
|
||||
"icons": {
|
||||
|
@ -25,7 +25,6 @@ const webpack = require('webpack');
|
||||
const path = require('path');
|
||||
const ESLintPlugin = require('eslint-webpack-plugin');
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
||||
|
||||
const backgroundProdConfig = {
|
||||
name: 'background',
|
||||
@ -64,14 +63,20 @@ const backgroundProdConfig = {
|
||||
constants: 'constants'
|
||||
},
|
||||
optimization: {
|
||||
moduleIds: 'named',
|
||||
chunkIds: 'size',
|
||||
moduleIds: 'size',
|
||||
concatenateModules: true,
|
||||
mangleExports: 'size',
|
||||
removeAvailableModules: true,
|
||||
removeEmptyChunks: true,
|
||||
mergeDuplicateChunks: true,
|
||||
minimize: true,
|
||||
minimizer: [
|
||||
new TerserPlugin(),
|
||||
new CssMinimizerPlugin()
|
||||
]
|
||||
new TerserPlugin({
|
||||
parallel: true
|
||||
})
|
||||
],
|
||||
nodeEnv: 'production'
|
||||
},
|
||||
resolve: {
|
||||
modules: ['node_modules']
|
||||
|
@ -72,14 +72,21 @@ const contentScriptProdConfig = {
|
||||
]
|
||||
},
|
||||
optimization: {
|
||||
moduleIds: 'named',
|
||||
chunkIds: 'size',
|
||||
moduleIds: 'size',
|
||||
concatenateModules: true,
|
||||
mangleExports: 'size',
|
||||
removeAvailableModules: true,
|
||||
removeEmptyChunks: true,
|
||||
mergeDuplicateChunks: true,
|
||||
minimize: true,
|
||||
minimizer: [
|
||||
new TerserPlugin(),
|
||||
new TerserPlugin({
|
||||
parallel: true
|
||||
}),
|
||||
new CssMinimizerPlugin()
|
||||
]
|
||||
],
|
||||
nodeEnv: 'production'
|
||||
},
|
||||
plugins: [
|
||||
new ESLintPlugin({
|
||||
|
@ -97,14 +97,21 @@ const installPageProdConfig = {
|
||||
constants: 'constants'
|
||||
},
|
||||
optimization: {
|
||||
moduleIds: 'named',
|
||||
chunkIds: 'size',
|
||||
moduleIds: 'size',
|
||||
concatenateModules: true,
|
||||
mangleExports: 'size',
|
||||
removeAvailableModules: true,
|
||||
removeEmptyChunks: true,
|
||||
mergeDuplicateChunks: true,
|
||||
minimize: true,
|
||||
minimizer: [
|
||||
new TerserPlugin(),
|
||||
new TerserPlugin({
|
||||
parallel: true
|
||||
}),
|
||||
new CssMinimizerPlugin()
|
||||
]
|
||||
],
|
||||
nodeEnv: 'production'
|
||||
},
|
||||
resolve: {
|
||||
modules: ['node_modules']
|
||||
|
@ -108,14 +108,21 @@ const optionsPageProdConfig = {
|
||||
constants: 'constants'
|
||||
},
|
||||
optimization: {
|
||||
moduleIds: 'named',
|
||||
chunkIds: 'size',
|
||||
moduleIds: 'size',
|
||||
concatenateModules: true,
|
||||
mangleExports: 'size',
|
||||
removeAvailableModules: true,
|
||||
removeEmptyChunks: true,
|
||||
mergeDuplicateChunks: true,
|
||||
minimize: true,
|
||||
minimizer: [
|
||||
new TerserPlugin(),
|
||||
new TerserPlugin({
|
||||
parallel: true
|
||||
}),
|
||||
new CssMinimizerPlugin()
|
||||
]
|
||||
],
|
||||
nodeEnv: 'production'
|
||||
},
|
||||
resolve: {
|
||||
modules: ['node_modules']
|
||||
|
24
webpack/utils/checkBuildDirectoryExists.js
Normal file
24
webpack/utils/checkBuildDirectoryExists.js
Normal file
@ -0,0 +1,24 @@
|
||||
//
|
||||
// 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 fs = require('node:fs');
|
||||
|
||||
if (!fs.existsSync('./build/')) {
|
||||
fs.mkdirSync('./build');
|
||||
}
|
@ -61,6 +61,10 @@ getDirectories('./src/_locales')
|
||||
})
|
||||
})
|
||||
.then(res => {
|
||||
if (!fs.existsSync('./public/')) {
|
||||
fs.mkdirSync('./public');
|
||||
}
|
||||
|
||||
if (!fs.existsSync('./public/_locales')) {
|
||||
fs.mkdirSync('./public/_locales');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user