Enables ContextIsolation

This commit is contained in:
Josh Perez
2023-01-12 19:24:59 -05:00
committed by GitHub
parent 4bbf5eb5d4
commit 9374832ea4
83 changed files with 1009 additions and 1073 deletions

View File

@@ -3,32 +3,34 @@
import { trigger } from '../../shims/events';
import type { NoopActionType } from './noop';
import type { LocalizerType } from '../../types/Util';
import type { LocaleMessagesType } from '../../types/I18N';
import { ThemeType } from '../../types/Util';
import type { UUIDStringType } from '../../types/UUID';
import type { LocalizerType } from '../../types/Util';
import type { MenuOptionsType } from '../../types/menu';
import type { NoopActionType } from './noop';
import type { UUIDStringType } from '../../types/UUID';
import * as OS from '../../OS';
import { ThemeType } from '../../types/Util';
// State
export type UserStateType = {
attachmentsPath: string;
stickersPath: string;
tempPath: string;
i18n: LocalizerType;
interactionMode: 'mouse' | 'keyboard';
isMainWindowFullScreen: boolean;
isMainWindowMaximized: boolean;
localeMessages: LocaleMessagesType;
menuOptions: MenuOptionsType;
osName: 'linux' | 'macos' | 'windows' | undefined;
ourACI: UUIDStringType | undefined;
ourConversationId: string | undefined;
ourDeviceId: number | undefined;
ourACI: UUIDStringType | undefined;
ourPNI: UUIDStringType | undefined;
ourNumber: string | undefined;
ourPNI: UUIDStringType | undefined;
platform: string;
regionCode: string | undefined;
i18n: LocalizerType;
localeMessages: LocaleMessagesType;
interactionMode: 'mouse' | 'keyboard';
isMainWindowMaximized: boolean;
isMainWindowFullScreen: boolean;
menuOptions: MenuOptionsType;
stickersPath: string;
tempPath: string;
theme: ThemeType;
version: string;
};
@@ -96,20 +98,27 @@ const intlNotSetup = () => {
// Reducer
export function getEmptyState(): UserStateType {
let osName: 'windows' | 'macos' | 'linux' | undefined;
if (OS.isWindows()) {
osName = 'windows';
} else if (OS.isMacOS()) {
osName = 'macos';
} else if (OS.isLinux()) {
osName = 'linux';
}
return {
attachmentsPath: 'missing',
stickersPath: 'missing',
tempPath: 'missing',
ourConversationId: 'missing',
ourDeviceId: 0,
ourACI: undefined,
ourPNI: undefined,
ourNumber: 'missing',
regionCode: 'missing',
platform: 'missing',
i18n: Object.assign(intlNotSetup, {
getLocale: intlNotSetup,
getIntl: intlNotSetup,
isLegacyFormat: intlNotSetup,
}),
interactionMode: 'mouse',
isMainWindowMaximized: false,
isMainWindowFullScreen: false,
localeMessages: {},
menuOptions: {
development: false,
devTools: false,
@@ -117,13 +126,17 @@ export function getEmptyState(): UserStateType {
isProduction: true,
platform: 'unknown',
},
osName,
ourACI: undefined,
ourConversationId: 'missing',
ourDeviceId: 0,
ourNumber: 'missing',
ourPNI: undefined,
platform: 'missing',
regionCode: 'missing',
stickersPath: 'missing',
tempPath: 'missing',
theme: ThemeType.light,
i18n: Object.assign(intlNotSetup, {
getLocale: intlNotSetup,
getIntl: intlNotSetup,
isLegacyFormat: intlNotSetup,
}),
localeMessages: {},
version: '0.0.0',
};
}