-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
145 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
diff --git a/packages/shared/lib/constants.ts b/packages/shared/lib/constants.ts | ||
index e98525020..9e27f7f97 100644 | ||
--- a/packages/shared/lib/constants.ts | ||
+++ b/packages/shared/lib/constants.ts | ||
@@ -52,7 +52,7 @@ export const APPS = { | ||
} as const; | ||
export const APPS_CONFIGURATION = { | ||
[APPS.PROTONACCOUNT]: { | ||
- publicPath: '', | ||
+ publicPath: '/account', | ||
subdomain: 'account', | ||
name: ACCOUNT_APP_NAME, | ||
bareName: 'Account', | ||
@@ -115,8 +115,8 @@ export const APPS_CONFIGURATION = { | ||
settingsSlug: '', | ||
}, | ||
[APPS.PROTONVPN_SETTINGS]: { | ||
- publicPath: '', | ||
- subdomain: '', | ||
+ publicPath: 'account/vpn', | ||
+ subdomain: 'account', | ||
name: VPN_APP_NAME, | ||
bareName: 'VPN', | ||
clientID: 'web-vpn-settings', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
diff --git a/packages/shared/lib/helpers/url.ts b/packages/shared/lib/helpers/url.ts | ||
index 11cd310f6..8019c07f5 100644 | ||
--- a/packages/shared/lib/helpers/url.ts | ||
+++ b/packages/shared/lib/helpers/url.ts | ||
@@ -175,48 +175,16 @@ export const getSecondLevelDomain = (hostname: string) => { | ||
return hostname.slice(hostname.indexOf('.') + 1); | ||
}; | ||
|
||
-export const getRelativeApiHostname = (hostname: string) => { | ||
- const idx = hostname.indexOf('.'); | ||
- const first = hostname.slice(0, idx); | ||
- const second = hostname.slice(idx + 1); | ||
- return `${first}-api.${second}`; | ||
-}; | ||
- | ||
export const getIsDohDomain = (origin: string) => { | ||
return DOH_DOMAINS.some((dohDomain) => origin.endsWith(dohDomain)); | ||
}; | ||
|
||
export const getApiSubdomainUrl = (pathname: string) => { | ||
- const url = new URL('/', window.location.origin); | ||
- if (url.hostname === 'localhost' || getIsDohDomain(url.origin)) { | ||
- url.pathname = `/api${pathname}`; | ||
- return url; | ||
- } | ||
- url.hostname = getRelativeApiHostname(url.hostname); | ||
+ const url = new URL('/', '___ELECTRON_MAIL_PROTON_API_ENTRY_URL_PLACEHOLDER___'); | ||
url.pathname = pathname; | ||
return url; | ||
}; | ||
|
||
-export const getAppUrlFromApiUrl = (apiUrl: string, appName: APP_NAMES) => { | ||
- const { subdomain } = APPS_CONFIGURATION[appName]; | ||
- const url = new URL(apiUrl); | ||
- const { hostname } = url; | ||
- const index = hostname.indexOf('.'); | ||
- const tail = hostname.slice(index + 1); | ||
- url.pathname = ''; | ||
- url.hostname = `${subdomain}.${tail}`; | ||
- return url; | ||
-}; | ||
- | ||
-export const getAppUrlRelativeToOrigin = (origin: string, appName: APP_NAMES) => { | ||
- const { subdomain } = APPS_CONFIGURATION[appName]; | ||
- const url = new URL(origin); | ||
- const segments = url.host.split('.'); | ||
- segments[0] = subdomain; | ||
- url.hostname = segments.join('.'); | ||
- return url; | ||
-}; | ||
- | ||
let cache = ''; | ||
export const getStaticURL = (path: string) => { | ||
if (window.location.hostname === 'localhost' || getIsDohDomain(window.location.origin)) { | ||
|
||
diff --git a/packages/shared/lib/fetch/helpers.ts b/packages/shared/lib/fetch/helpers.ts | ||
index f0b3e2e31..90995e1fc 100644 | ||
--- a/packages/shared/lib/fetch/helpers.ts | ||
+++ b/packages/shared/lib/fetch/helpers.ts | ||
@@ -10,6 +10,7 @@ const appendQueryParams = (url: URL, params: { [key: string]: any }) => { | ||
}); | ||
}; | ||
|
||
+/* <electron-mail-mark> */ | ||
export const createUrl = (urlString: string, params: { [key: string]: any } = {}) => { | ||
let url: URL; | ||
if (typeof window !== 'undefined') { | ||
@@ -20,6 +21,7 @@ export const createUrl = (urlString: string, params: { [key: string]: any } = {} | ||
appendQueryParams(url, params); | ||
return url; | ||
}; | ||
+/* </electron-mail-mark> */ | ||
|
||
export const checkStatus = (response: Response, config: any) => { | ||
const { status } = response; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ export const PROVIDER_REPO_MAP = { | |
basePath: "", | ||
apiSubdomain: "mail-api", | ||
repoRelativeDistDir: "./dist", | ||
tag: "[email protected].6.9", | ||
tag: "[email protected].7.9", | ||
protonPack: { | ||
webpackIndexEntryItems: [ | ||
// immediate | ||
|
@@ -49,14 +49,14 @@ export const PROVIDER_REPO_MAP = { | |
basePath: "account", | ||
apiSubdomain: "account-api", | ||
repoRelativeDistDir: "./dist", | ||
tag: "[email protected].6.0", | ||
tag: "[email protected].7.3", | ||
protonPack: {} | ||
}, | ||
[PROVIDER_APP_NAMES[2]]: { | ||
basePath: "calendar", | ||
apiSubdomain: "calendar-api", | ||
repoRelativeDistDir: "./dist", | ||
tag: "[email protected].1", | ||
tag: "[email protected].4", | ||
protonPack: { | ||
webpackIndexEntryItems: [ | ||
// immediate | ||
|