mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
chore: bump electron version (#7922)
This commit is contained in:
4
packages/common/env/src/constant.ts
vendored
4
packages/common/env/src/constant.ts
vendored
@@ -3,7 +3,7 @@ import type { DocCollection } from '@blocksuite/store';
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
appInfo: {
|
||||
__appInfo: {
|
||||
electron: boolean;
|
||||
schema: string;
|
||||
windowName: string;
|
||||
@@ -14,7 +14,7 @@ declare global {
|
||||
//#region runtime variables
|
||||
export const isBrowser = typeof window !== 'undefined';
|
||||
export const isServer = !isBrowser && typeof navigator === 'undefined';
|
||||
export const isDesktop = isBrowser && !!window.appInfo?.electron;
|
||||
export const isDesktop = isBrowser && !!window.__appInfo?.electron;
|
||||
//#endregion
|
||||
export const DEFAULT_WORKSPACE_NAME = 'Demo Workspace';
|
||||
export const UNTITLED_WORKSPACE_NAME = 'Untitled';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AIProvider } from '@affine/core/blocksuite/presets/ai';
|
||||
import { apis } from '@affine/electron-api';
|
||||
import { apis, appInfo } from '@affine/electron-api';
|
||||
import type { OAuthProviderType } from '@affine/graphql';
|
||||
import {
|
||||
ApplicationFocused,
|
||||
@@ -160,8 +160,8 @@ export class AuthService extends Service {
|
||||
|
||||
private buildRedirectUri(callbackUrl: string) {
|
||||
const params: string[][] = [];
|
||||
if (environment.isDesktop && window.appInfo.schema) {
|
||||
params.push(['schema', window.appInfo.schema]);
|
||||
if (environment.isDesktop && appInfo?.schema) {
|
||||
params.push(['schema', appInfo.schema]);
|
||||
}
|
||||
const query =
|
||||
params.length > 0
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { appInfo } from '@affine/electron-api';
|
||||
import type {
|
||||
CreateCheckoutSessionInput,
|
||||
SubscriptionRecurring,
|
||||
@@ -27,8 +28,8 @@ const getDefaultSubscriptionSuccessCallbackLink = (
|
||||
plan === SubscriptionPlan.AI ? '/ai-upgrade-success' : '/upgrade-success';
|
||||
const urlString = getAffineCloudBaseUrl() + path;
|
||||
const url = new URL(urlString);
|
||||
if (environment.isDesktop) {
|
||||
url.searchParams.set('schema', window.appInfo.schema);
|
||||
if (environment.isDesktop && appInfo) {
|
||||
url.searchParams.set('schema', appInfo.schema);
|
||||
}
|
||||
return url.toString();
|
||||
};
|
||||
|
||||
@@ -9,6 +9,6 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@toeverything/infra": "workspace:*",
|
||||
"electron": "~30.2.0"
|
||||
"electron": "^31.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,13 +29,13 @@ type ClientHandler = {
|
||||
} & HelperHandlers;
|
||||
type ClientEvents = MainEvents & HelperEvents;
|
||||
|
||||
export const appInfo = (globalThis as any).appInfo as
|
||||
export const appInfo = (globalThis as any).__appInfo as
|
||||
| typeof exposedAppInfo
|
||||
| null;
|
||||
export const apis = (globalThis as any).apis as ClientHandler | null;
|
||||
export const events = (globalThis as any).events as ClientEvents | null;
|
||||
export const apis = (globalThis as any).__apis as ClientHandler | null;
|
||||
export const events = (globalThis as any).__events as ClientEvents | null;
|
||||
|
||||
export const sharedStorage = (globalThis as any).sharedStorage as
|
||||
export const sharedStorage = (globalThis as any).__sharedStorage as
|
||||
| typeof exposedSharedStorage
|
||||
| null;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
"builder-util-runtime": "^9.2.5-alpha.2",
|
||||
"core-js": "^3.36.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"electron": "~30.2.0",
|
||||
"electron": "^31.0.0",
|
||||
"electron-log": "^5.1.2",
|
||||
"electron-squirrel-startup": "1.0.1",
|
||||
"electron-window-state": "^5.0.3",
|
||||
|
||||
@@ -34,8 +34,8 @@ function main() {
|
||||
|
||||
// skip bootstrap setup for desktop onboarding
|
||||
if (
|
||||
window.appInfo?.windowName === 'onboarding' ||
|
||||
window.appInfo?.windowName === 'theme-editor'
|
||||
appInfo?.windowName === 'onboarding' ||
|
||||
appInfo?.windowName === 'theme-editor'
|
||||
) {
|
||||
performanceMainLogger.info('skip setup');
|
||||
} else {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import log from 'electron-log';
|
||||
import log from 'electron-log/main';
|
||||
|
||||
export const logger = log.scope('helper');
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { app, shell } from 'electron';
|
||||
import log from 'electron-log';
|
||||
import log from 'electron-log/main';
|
||||
|
||||
export const logger = log.scope('main');
|
||||
log.initialize();
|
||||
log.initialize({
|
||||
preload: false,
|
||||
});
|
||||
|
||||
log.transports.file.level = 'info';
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { sharedStorage } from './shared-storage';
|
||||
|
||||
const { apis, events } = getElectronAPIs();
|
||||
|
||||
contextBridge.exposeInMainWorld('appInfo', appInfo);
|
||||
contextBridge.exposeInMainWorld('apis', apis);
|
||||
contextBridge.exposeInMainWorld('events', events);
|
||||
contextBridge.exposeInMainWorld('sharedStorage', sharedStorage);
|
||||
contextBridge.exposeInMainWorld('__appInfo', appInfo);
|
||||
contextBridge.exposeInMainWorld('__apis', apis);
|
||||
contextBridge.exposeInMainWorld('__events', events);
|
||||
contextBridge.exposeInMainWorld('__sharedStorage', sharedStorage);
|
||||
|
||||
@@ -5,6 +5,7 @@ import './polyfill/request-idle-callback';
|
||||
import '@affine/core/bootstrap/preload';
|
||||
|
||||
import { performanceLogger } from '@affine/core/shared';
|
||||
import { appInfo } from '@affine/electron-api';
|
||||
import { isDesktop } from '@affine/env/constant';
|
||||
import {
|
||||
init,
|
||||
@@ -27,7 +28,7 @@ function main() {
|
||||
performanceMainLogger.info('start');
|
||||
|
||||
// skip bootstrap setup for desktop onboarding
|
||||
if (isDesktop && window.appInfo?.windowName === 'onboarding') {
|
||||
if (isDesktop && appInfo?.windowName === 'onboarding') {
|
||||
performanceMainLogger.info('skip setup');
|
||||
} else {
|
||||
performanceMainLogger.info('setup start');
|
||||
|
||||
Reference in New Issue
Block a user