Merge and migrate locally-trusted preload scripts to contextBridge
API (#2553)
* Migrate intl_provider to contextBridge * Migrate modalPreload to contextBridge * Migrate loadingScreenPreload to contextBridge * Migrate downloadDropdown preloads to contextBridge * Migrate server dropdown preload to contextBridge * Migrate urlView preload to contextBridge * Merge all desktop API scripts into one * Remove unused communication channel constants
This commit is contained in:
@@ -151,13 +151,13 @@ export function handleNewServerModal() {
|
||||
|
||||
const html = getLocalURLString('newServer.html');
|
||||
|
||||
const modalPreload = getLocalPreload('modalPreload.js');
|
||||
const preload = getLocalPreload('desktopAPI.js');
|
||||
|
||||
const mainWindow = WindowManager.getMainWindow();
|
||||
if (!mainWindow) {
|
||||
return;
|
||||
}
|
||||
const modalPromise = ModalManager.addModal<TeamWithIndex[], Team>('newServer', html, modalPreload, Config.teams.map((team, index) => ({...team, index})), mainWindow, Config.teams.length === 0);
|
||||
const modalPromise = ModalManager.addModal<TeamWithIndex[], Team>('newServer', html, preload, Config.teams.map((team, index) => ({...team, index})), mainWindow, Config.teams.length === 0);
|
||||
if (modalPromise) {
|
||||
modalPromise.then((data) => {
|
||||
const teams = Config.teams;
|
||||
@@ -183,7 +183,7 @@ export function handleEditServerModal(e: IpcMainEvent, name: string) {
|
||||
|
||||
const html = getLocalURLString('editServer.html');
|
||||
|
||||
const modalPreload = getLocalPreload('modalPreload.js');
|
||||
const preload = getLocalPreload('desktopAPI.js');
|
||||
|
||||
const mainWindow = WindowManager.getMainWindow();
|
||||
if (!mainWindow) {
|
||||
@@ -196,7 +196,7 @@ export function handleEditServerModal(e: IpcMainEvent, name: string) {
|
||||
const modalPromise = ModalManager.addModal<{currentTeams: TeamWithIndex[]; team: TeamWithIndex}, Team>(
|
||||
'editServer',
|
||||
html,
|
||||
modalPreload,
|
||||
preload,
|
||||
{
|
||||
currentTeams: Config.teams.map((team, index) => ({...team, index})),
|
||||
team: {...Config.teams[serverIndex], index: serverIndex},
|
||||
@@ -225,13 +225,13 @@ export function handleRemoveServerModal(e: IpcMainEvent, name: string) {
|
||||
|
||||
const html = getLocalURLString('removeServer.html');
|
||||
|
||||
const modalPreload = getLocalPreload('modalPreload.js');
|
||||
const preload = getLocalPreload('desktopAPI.js');
|
||||
|
||||
const mainWindow = WindowManager.getMainWindow();
|
||||
if (!mainWindow) {
|
||||
return;
|
||||
}
|
||||
const modalPromise = ModalManager.addModal<string, boolean>('removeServer', html, modalPreload, name, mainWindow);
|
||||
const modalPromise = ModalManager.addModal<string, boolean>('removeServer', html, preload, name, mainWindow);
|
||||
if (modalPromise) {
|
||||
modalPromise.then((remove) => {
|
||||
if (remove) {
|
||||
@@ -265,13 +265,13 @@ export function handleWelcomeScreenModal() {
|
||||
|
||||
const html = getLocalURLString('welcomeScreen.html');
|
||||
|
||||
const modalPreload = getLocalPreload('modalPreload.js');
|
||||
const preload = getLocalPreload('desktopAPI.js');
|
||||
|
||||
const mainWindow = WindowManager.getMainWindow();
|
||||
if (!mainWindow) {
|
||||
return;
|
||||
}
|
||||
const modalPromise = ModalManager.addModal<TeamWithIndex[], Team>('welcomeScreen', html, modalPreload, Config.teams.map((team, index) => ({...team, index})), mainWindow, Config.teams.length === 0);
|
||||
const modalPromise = ModalManager.addModal<TeamWithIndex[], Team>('welcomeScreen', html, preload, Config.teams.map((team, index) => ({...team, index})), mainWindow, Config.teams.length === 0);
|
||||
if (modalPromise) {
|
||||
modalPromise.then((data) => {
|
||||
const teams = Config.teams;
|
||||
|
Reference in New Issue
Block a user