From be63032b04dfb79624997a1db379460c35ab76b3 Mon Sep 17 00:00:00 2001 From: Leonardo Mendoza Date: Tue, 24 Oct 2023 15:18:32 -0600 Subject: [PATCH] calculate all domains and subdomains on runtime: --- src/app/app.module.ts | 17 ++++++++++++++--- src/app/cdk/platform-info/browserlist.regexp.ts | 3 ++- src/environments/environment.int.ts | 2 +- .../environment.local-with-proxy.ts | 6 +++--- src/environments/environment.local.ts | 6 +++--- src/environments/environment.production.ts | 8 +++----- src/environments/environment.qa.ts | 6 +++--- src/environments/environment.sandbox.ts | 6 +++--- 8 files changed, 32 insertions(+), 22 deletions(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index fb45f6b2fe..47c6467d23 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -43,16 +43,27 @@ export class AppModule { } private initializeApp() { - environment.BASE_URL = this.getCurrentDomain() environment.API_WEB = environment.API_WEB.replace( '', this.getSubDomain() ) + environment.BASE_URL = environment.BASE_URL.replace( + '', + this.getSubDomain() + ) + environment.API_WEB = environment.API_WEB.replace( + '', + this.getCurrentLeanDomain() + ) + environment.BASE_URL = environment.BASE_URL.replace( + '', + this.getCurrentLeanDomain() + ) } - getCurrentDomain() { + getCurrentLeanDomain() { const port = window.location.port ? ':' + window.location.port : '' - return '//' + window.location.hostname + port + '/' + return window.location.hostname.split('.').slice(-2).join('.') + port } getSubDomain() { diff --git a/src/app/cdk/platform-info/browserlist.regexp.ts b/src/app/cdk/platform-info/browserlist.regexp.ts index 954be17405..dd011b22dc 100644 --- a/src/app/cdk/platform-info/browserlist.regexp.ts +++ b/src/app/cdk/platform-info/browserlist.regexp.ts @@ -1,2 +1,3 @@ // tslint:disable-next-line: max-line-length -export const BROWSERLIST_REGEXP = /((CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone|CPU IPhone OS)[ +]+(13[_.]4|13[_.]([5-9]|\d{2,})|13[_.]7|13[_.]([8-9]|\d{2,})|(1[4-9]|[2-9]\d|\d{3,})[_.]\d+|14[_.]0|14[_.]([1-9]|\d{2,})|14[_.]4|14[_.]([5-9]|\d{2,})|14[_.]8|14[_.](9|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})[_.]\d+|15[_.]0|15[_.]([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})[_.]\d+|16[_.]0|16[_.]([1-9]|\d{2,})|(1[7-9]|[2-9]\d|\d{3,})[_.]\d+)(?:[_.]\d+)?)|((?:Chrome).*OPR\/(74|(7[5-9]|[8-9]\d|\d{3,}))\.\d+\.\d+)|(Edge\/(80|(8[1-9]|9\d|\d{3,})|83|(8[4-9]|9\d|\d{3,}))(?:\.\d+)?)|((Chromium|Chrome)\/(80|(8[1-9]|9\d|\d{3,})|83|(8[4-9]|9\d|\d{3,}))\.\d+(?:\.\d+)?)|(Version\/(13\.1|13\.([2-9]|\d{2,})|(1[4-9]|[2-9]\d|\d{3,})\.\d+|14\.0|14\.([1-9]|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})\.\d+|15\.0|15\.([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})\.\d+|16\.0|16\.([1-9]|\d{2,})|(1[7-9]|[2-9]\d|\d{3,})\.\d+)(?:\.\d+)? Safari\/)|(Firefox\/(78|(79|[8-9]\d|\d{3,}))\.\d+\.\d+)|(Firefox\/(78|(79|[8-9]\d|\d{3,}))\.\d+(pre|[ab]\d+[a-z]*)?)/ +export const BROWSERLIST_REGEXP = + /((CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone|CPU IPhone OS)[ +]+(13[_.]4|13[_.]([5-9]|\d{2,})|13[_.]7|13[_.]([8-9]|\d{2,})|(1[4-9]|[2-9]\d|\d{3,})[_.]\d+|14[_.]0|14[_.]([1-9]|\d{2,})|14[_.]4|14[_.]([5-9]|\d{2,})|14[_.]8|14[_.](9|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})[_.]\d+|15[_.]0|15[_.]([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})[_.]\d+|16[_.]0|16[_.]([1-9]|\d{2,})|(1[7-9]|[2-9]\d|\d{3,})[_.]\d+)(?:[_.]\d+)?)|((?:Chrome).*OPR\/(74|(7[5-9]|[8-9]\d|\d{3,}))\.\d+\.\d+)|(Edge\/(80|(8[1-9]|9\d|\d{3,})|83|(8[4-9]|9\d|\d{3,}))(?:\.\d+)?)|((Chromium|Chrome)\/(80|(8[1-9]|9\d|\d{3,})|83|(8[4-9]|9\d|\d{3,}))\.\d+(?:\.\d+)?)|(Version\/(13\.1|13\.([2-9]|\d{2,})|(1[4-9]|[2-9]\d|\d{3,})\.\d+|14\.0|14\.([1-9]|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})\.\d+|15\.0|15\.([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})\.\d+|16\.0|16\.([1-9]|\d{2,})|(1[7-9]|[2-9]\d|\d{3,})\.\d+)(?:\.\d+)? Safari\/)|(Firefox\/(78|(79|[8-9]\d|\d{3,}))\.\d+\.\d+)|(Firefox\/(78|(79|[8-9]\d|\d{3,}))\.\d+(pre|[ab]\d+[a-z]*)?)/ diff --git a/src/environments/environment.int.ts b/src/environments/environment.int.ts index 0da1a008e7..0116e1659e 100644 --- a/src/environments/environment.int.ts +++ b/src/environments/environment.int.ts @@ -1,4 +1,4 @@ -import { getSubDomain } from "./subdomain.adapter"; +import { getSubDomain } from './subdomain.adapter' export const environment = { production: true, diff --git a/src/environments/environment.local-with-proxy.ts b/src/environments/environment.local-with-proxy.ts index 1475d7062b..ffa66255b3 100644 --- a/src/environments/environment.local-with-proxy.ts +++ b/src/environments/environment.local-with-proxy.ts @@ -3,9 +3,9 @@ export const environment = { debugger: true, ROBOTS: 'all', API_NEWS: 'https://www.mocky.io/v2/5dced45b3000007300931ce8', - API_PUB: `//localhost:4200/v3.0`, - API_WEB: `//localhost:4200/`, - BASE_URL: '', + API_PUB: `///v3.0`, + API_WEB: `///`, + BASE_URL: '///', INFO_SITE: 'https://info.orcid.org/', GOOGLE_ANALYTICS_TESTING_MODE: true, GOOGLE_TAG_MANAGER: 'GTM-0000000', diff --git a/src/environments/environment.local.ts b/src/environments/environment.local.ts index 238734638a..5941c79dcd 100644 --- a/src/environments/environment.local.ts +++ b/src/environments/environment.local.ts @@ -3,9 +3,9 @@ export const environment = { debugger: true, ROBOTS: 'all', API_NEWS: 'https://www.mocky.io/v2/5dced45b3000007300931ce8', - API_PUB: `//pub.orcid.org/v3.0`, - API_WEB: `//orcid.org/`, - BASE_URL: '', + API_PUB: `//pub./v3.0`, + API_WEB: `///`, + BASE_URL: '///', INFO_SITE: 'https://info.orcid.org/', GOOGLE_ANALYTICS_TESTING_MODE: true, GOOGLE_TAG_MANAGER: 'GTM-0000000', diff --git a/src/environments/environment.production.ts b/src/environments/environment.production.ts index aabd4682cb..09eae28d28 100644 --- a/src/environments/environment.production.ts +++ b/src/environments/environment.production.ts @@ -3,9 +3,9 @@ export const environment = { debugger: false, ROBOTS: 'all', API_NEWS: 'https://info.orcid.org/feed/', - API_PUB: `//pub.orcid.org/v3.0`, - API_WEB: `//orcid.org/`, - BASE_URL: '', + API_PUB: `//pub./v3.0`, + API_WEB: `///`, + BASE_URL: '///', INFO_SITE: 'https://info.orcid.org/', SHOW_TEST_WARNING_BANNER: false, GOOGLE_ANALYTICS_TESTING_MODE: false, @@ -34,5 +34,3 @@ export const environment = { }, proxyMode: false, } - - diff --git a/src/environments/environment.qa.ts b/src/environments/environment.qa.ts index 3cfb8762b8..e3e754aaca 100644 --- a/src/environments/environment.qa.ts +++ b/src/environments/environment.qa.ts @@ -3,9 +3,9 @@ export const environment = { debugger: true, ROBOTS: 'noindex, nofollow', API_NEWS: 'https://info.qa.orcid.org/feed/', - API_PUB: `//pub.orcid.org/v3.0`, - API_WEB: `//orcid.org/`, - BASE_URL: '', + API_PUB: `//pub./v3.0`, + API_WEB: `///`, + BASE_URL: '///', INFO_SITE: 'https://info.qa.orcid.org/', GOOGLE_ANALYTICS_TESTING_MODE: true, GOOGLE_TAG_MANAGER: 'GTM-TRLHLRZ', diff --git a/src/environments/environment.sandbox.ts b/src/environments/environment.sandbox.ts index c82224ebda..40106352b1 100644 --- a/src/environments/environment.sandbox.ts +++ b/src/environments/environment.sandbox.ts @@ -3,9 +3,9 @@ export const environment = { debugger: false, ROBOTS: 'noindex, nofollow', API_NEWS: 'https://info.qa.orcid.org/feed/', - API_PUB: `//pub.orcid.org/v3.0`, - API_WEB: `//orcid.org/`, - BASE_URL: '', + API_PUB: `//pub./v3.0`, + API_WEB: `///`, + BASE_URL: '///', INFO_SITE: 'https://info.qa.orcid.org/', GOOGLE_ANALYTICS_TESTING_MODE: false, GOOGLE_TAG_MANAGER: 'GTM-M9Z7DHS',