-
Notifications
You must be signed in to change notification settings - Fork 99
/
constants.ts
87 lines (75 loc) · 2.99 KB
/
constants.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import {LogLevel} from "electron-log";
import {AccountType} from "src/shared/model/account";
import {EntryUrlItem} from "./types";
// tslint:disable-next-line:no-var-requires no-import-zones
const {name: APP_NAME, version: APP_VERSION} = require("package.json");
export {
APP_NAME,
APP_VERSION,
};
// user data dir, defaults to app.getPath("userData")
export const RUNTIME_ENV_USER_DATA_DIR = `EMAIL_SECURELY_APP_USER_DATA_DIR`;
// boolean
export const RUNTIME_ENV_E2E = `EMAIL_SECURELY_APP_E2E`;
export const ONE_SECOND_MS = 1000;
export const DEFAULT_API_CALL_TIMEOUT = ONE_SECOND_MS * 25;
export const PROVIDER_REPO: Record<AccountType, { repo: string, version: string; commit: string; }> = {
protonmail: {
repo: "https:/ProtonMail/WebClient.git",
commit: "dd472c7eeaa94b8b16895371012234b25771d812",
version: "3.15.7",
},
tutanota: {
repo: "https:/tutao/tutanota.git",
commit: "0f6f05db6063265944ea353c3e6d5cf45ee635df",
version: "3.44.9",
},
};
export const LOCAL_WEBCLIENT_PROTOCOL_PREFIX = "webclient";
export const LOCAL_WEBCLIENT_PROTOCOL_RE_PATTERN = `${LOCAL_WEBCLIENT_PROTOCOL_PREFIX}[\\d]+`;
export const ACCOUNTS_CONFIG_ENTRY_URL_LOCAL_PREFIX = "local:::";
export const ACCOUNTS_CONFIG: Record<AccountType, Record<"entryUrl", EntryUrlItem[]>> = {
protonmail: {
entryUrl: [
{
value: `${ACCOUNTS_CONFIG_ENTRY_URL_LOCAL_PREFIX}https://mail.protonmail.com`,
title: `https://mail.protonmail.com (${getBuiltInWebClientTitle("protonmail")})`,
},
{
value: `${ACCOUNTS_CONFIG_ENTRY_URL_LOCAL_PREFIX}https://app.protonmail.ch`,
title: `https://app.protonmail.ch (${getBuiltInWebClientTitle("protonmail")})`,
},
{
value: `${ACCOUNTS_CONFIG_ENTRY_URL_LOCAL_PREFIX}https://protonirockerxow.onion`,
title: `https://protonirockerxow.onion (${getBuiltInWebClientTitle("protonmail")})`,
},
{
value: "https://protonirockerxow.onion",
title: "https://protonirockerxow.onion (deprecated)",
},
{
value: "https://beta.protonmail.com",
title: "https://beta.protonmail.com (deprecated)",
},
],
},
tutanota: {
entryUrl: [
{
value: `${ACCOUNTS_CONFIG_ENTRY_URL_LOCAL_PREFIX}https://mail.tutanota.com`,
title: `https://mail.tutanota.com (${getBuiltInWebClientTitle("tutanota")})`,
},
],
},
};
function getBuiltInWebClientTitle(accountType: AccountType): string {
return `v${PROVIDER_REPO[accountType].version}-${PROVIDER_REPO[accountType].commit.substr(0, 7)}`;
}
export const LOG_LEVELS: LogLevel[] = Object.keys(((stub: Record<LogLevel, null>) => stub)({
error: null,
warn: null,
info: null,
verbose: null,
debug: null,
silly: null,
})) as LogLevel[];