mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-23 02:10:12 +01:00
Rename phishing warning page environment variable
The phishing warning page URL environment variable has been renamed from `PHISHING_PAGE_URL` to `PHISHING_WARNING_PAGE_URL`. We call this page the "phishing warning page" everywhere else, and this name seemed better suited (it's not a phishing page itself). The variable has been listed and documented in `.metamaskrc.dist` as well.
This commit is contained in:
parent
5a5e541b5e
commit
d1ac1a8389
@ -6,3 +6,6 @@ ONBOARDING_V2=
|
|||||||
SWAPS_USE_DEV_APIS=
|
SWAPS_USE_DEV_APIS=
|
||||||
COLLECTIBLES_V1=
|
COLLECTIBLES_V1=
|
||||||
TOKEN_DETECTION_V2=
|
TOKEN_DETECTION_V2=
|
||||||
|
|
||||||
|
; Set this to test changes to the phishing warning page.
|
||||||
|
PHISHING_WARNING_PAGE_URL=
|
||||||
|
@ -67,7 +67,7 @@ if (inTest || process.env.METAMASK_DEBUG) {
|
|||||||
global.metamaskGetState = localStore.get.bind(localStore);
|
global.metamaskGetState = localStore.get.bind(localStore);
|
||||||
}
|
}
|
||||||
|
|
||||||
const phishingPageUrl = new URL(process.env.PHISHING_PAGE_URL);
|
const phishingPageUrl = new URL(process.env.PHISHING_WARNING_PAGE_URL);
|
||||||
|
|
||||||
const ONE_SECOND_IN_MILLISECONDS = 1_000;
|
const ONE_SECOND_IN_MILLISECONDS = 1_000;
|
||||||
// Timeout for initializing phishing warning page.
|
// Timeout for initializing phishing warning page.
|
||||||
@ -161,7 +161,7 @@ async function loadPhishingWarningPage() {
|
|||||||
let iframe;
|
let iframe;
|
||||||
try {
|
try {
|
||||||
const extensionStartupPhishingPageUrl = new URL(
|
const extensionStartupPhishingPageUrl = new URL(
|
||||||
process.env.PHISHING_PAGE_URL,
|
process.env.PHISHING_WARNING_PAGE_URL,
|
||||||
);
|
);
|
||||||
// The `extensionStartup` hash signals to the phishing warning page that it should not bother
|
// The `extensionStartup` hash signals to the phishing warning page that it should not bother
|
||||||
// setting up streams for user interaction. Otherwise this page load would cause a console
|
// setting up streams for user interaction. Otherwise this page load would cause a console
|
||||||
|
@ -32,7 +32,7 @@ const LEGACY_INPAGE = 'inpage';
|
|||||||
const LEGACY_PROVIDER = 'provider';
|
const LEGACY_PROVIDER = 'provider';
|
||||||
const LEGACY_PUBLIC_CONFIG = 'publicConfig';
|
const LEGACY_PUBLIC_CONFIG = 'publicConfig';
|
||||||
|
|
||||||
const phishingPageUrl = new URL(process.env.PHISHING_PAGE_URL);
|
const phishingPageUrl = new URL(process.env.PHISHING_WARNING_PAGE_URL);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
window.location.origin === phishingPageUrl.origin &&
|
window.location.origin === phishingPageUrl.origin &&
|
||||||
@ -354,7 +354,7 @@ function blockedDomainCheck() {
|
|||||||
*/
|
*/
|
||||||
function redirectToPhishingWarning() {
|
function redirectToPhishingWarning() {
|
||||||
console.debug('MetaMask: Routing to Phishing Warning page.');
|
console.debug('MetaMask: Routing to Phishing Warning page.');
|
||||||
const baseUrl = process.env.PHISHING_PAGE_URL;
|
const baseUrl = process.env.PHISHING_WARNING_PAGE_URL;
|
||||||
window.location.href = `${baseUrl}#${querystring.stringify({
|
window.location.href = `${baseUrl}#${querystring.stringify({
|
||||||
hostname: window.location.hostname,
|
hostname: window.location.hostname,
|
||||||
href: window.location.href,
|
href: window.location.href,
|
||||||
|
@ -34,7 +34,7 @@ const metamaskrc = require('rc')('metamask', {
|
|||||||
INFURA_PROD_PROJECT_ID: process.env.INFURA_PROD_PROJECT_ID,
|
INFURA_PROD_PROJECT_ID: process.env.INFURA_PROD_PROJECT_ID,
|
||||||
ONBOARDING_V2: process.env.ONBOARDING_V2,
|
ONBOARDING_V2: process.env.ONBOARDING_V2,
|
||||||
COLLECTIBLES_V1: process.env.COLLECTIBLES_V1,
|
COLLECTIBLES_V1: process.env.COLLECTIBLES_V1,
|
||||||
PHISHING_PAGE_URL: process.env.PHISHING_PAGE_URL,
|
PHISHING_WARNING_PAGE_URL: process.env.PHISHING_WARNING_PAGE_URL,
|
||||||
TOKEN_DETECTION_V2: process.env.TOKEN_DETECTION_V2,
|
TOKEN_DETECTION_V2: process.env.TOKEN_DETECTION_V2,
|
||||||
SEGMENT_HOST: process.env.SEGMENT_HOST,
|
SEGMENT_HOST: process.env.SEGMENT_HOST,
|
||||||
SEGMENT_WRITE_KEY: process.env.SEGMENT_WRITE_KEY,
|
SEGMENT_WRITE_KEY: process.env.SEGMENT_WRITE_KEY,
|
||||||
@ -142,7 +142,7 @@ function getSegmentWriteKey({ buildType, environment }) {
|
|||||||
* @returns {string} The URL for the phishing warning page, or `undefined` if no URL is set.
|
* @returns {string} The URL for the phishing warning page, or `undefined` if no URL is set.
|
||||||
*/
|
*/
|
||||||
function getPhishingWarningPageUrl({ testing }) {
|
function getPhishingWarningPageUrl({ testing }) {
|
||||||
let phishingWarningPageUrl = metamaskrc.PHISHING_PAGE_URL;
|
let phishingWarningPageUrl = metamaskrc.PHISHING_WARNING_PAGE_URL;
|
||||||
|
|
||||||
if (!phishingWarningPageUrl) {
|
if (!phishingWarningPageUrl) {
|
||||||
phishingWarningPageUrl = testing
|
phishingWarningPageUrl = testing
|
||||||
@ -838,7 +838,7 @@ function getEnvironmentVariables({ buildType, devMode, testing, version }) {
|
|||||||
METAMASK_BUILD_TYPE: buildType,
|
METAMASK_BUILD_TYPE: buildType,
|
||||||
NODE_ENV: devMode ? ENVIRONMENT.DEVELOPMENT : ENVIRONMENT.PRODUCTION,
|
NODE_ENV: devMode ? ENVIRONMENT.DEVELOPMENT : ENVIRONMENT.PRODUCTION,
|
||||||
IN_TEST: testing,
|
IN_TEST: testing,
|
||||||
PHISHING_PAGE_URL: getPhishingWarningPageUrl({ testing }),
|
PHISHING_WARNING_PAGE_URL: getPhishingWarningPageUrl({ testing }),
|
||||||
PUBNUB_SUB_KEY: process.env.PUBNUB_SUB_KEY || '',
|
PUBNUB_SUB_KEY: process.env.PUBNUB_SUB_KEY || '',
|
||||||
PUBNUB_PUB_KEY: process.env.PUBNUB_PUB_KEY || '',
|
PUBNUB_PUB_KEY: process.env.PUBNUB_PUB_KEY || '',
|
||||||
CONF: devMode ? metamaskrc : {},
|
CONF: devMode ? metamaskrc : {},
|
||||||
|
Loading…
Reference in New Issue
Block a user