feat(core): desktop multiple server support (#8979)

This commit is contained in:
EYHN
2024-12-03 05:51:09 +00:00
parent af81c95b85
commit 8963826463
137 changed files with 2052 additions and 1694 deletions

View File

@@ -1,4 +1,5 @@
export interface AuthenticationRequest {
method: 'magic-link' | 'oauth';
payload: Record<string, any>;
server?: string;
}

View File

@@ -5,7 +5,6 @@ import {
BrowserWindow,
Menu,
MenuItem,
session,
type View,
type WebContents,
WebContentsView,
@@ -26,7 +25,7 @@ import {
import { isMacOS } from '../../shared/utils';
import { beforeAppQuit } from '../cleanup';
import { CLOUD_BASE_URL, isDev } from '../config';
import { isDev } from '../config';
import { mainWindowOrigin, shellViewUrl } from '../constants';
import { ensureHelperProcess } from '../helper-process';
import { logger } from '../logger';
@@ -722,23 +721,6 @@ export class WebContentViewsManager {
// add shell view
this.createAndAddView('shell').catch(err => logger.error(err));
(async () => {
const updateCookies = () => {
session.defaultSession.cookies
.get({
url: CLOUD_BASE_URL,
})
.then(cookies => {
this.cookies = cookies;
})
.catch(err => {
logger.error('failed to get cookies', err);
});
};
updateCookies();
session.defaultSession.cookies.on('changed', () => {
updateCookies();
});
if (this.tabViewsMeta.workbenches.length === 0) {
// create a default view (e.g., on first launch)
await this.addTab();
@@ -921,10 +903,6 @@ export class WebContentViewsManager {
};
}
export function getCookies() {
return WebContentViewsManager.instance.cookies;
}
// there is no proper way to listen to webContents resize event
// we will rely on window.resize event in renderer instead
export async function handleWebContentsResize(webContents?: WebContents) {