mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 18:26:05 +08:00
fix(electron): add dedicated api for opening external links in the default browser (#6166)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { apis } from '@affine/electron-api';
|
||||
import {
|
||||
generateRandUTF16Chars,
|
||||
getBaseUrl,
|
||||
@@ -62,13 +63,12 @@ export const signInCloud = async (
|
||||
.catch(err => onRejectHandleTrace(err, traceParams));
|
||||
} else if (OAuthProviderType[provider]) {
|
||||
if (environment.isDesktop) {
|
||||
open(
|
||||
await apis?.ui.openExternal(
|
||||
`${
|
||||
runtimeConfig.serverUrlPrefix
|
||||
}/desktop-signin?provider=${provider}&redirect_uri=${buildRedirectUri(
|
||||
'/open-app/signin-redirect'
|
||||
)}`,
|
||||
'_target'
|
||||
)}`
|
||||
);
|
||||
} else {
|
||||
location.href = `${
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { app, nativeTheme } from 'electron';
|
||||
import { app, nativeTheme, shell } from 'electron';
|
||||
import { getLinkPreview } from 'link-preview-js';
|
||||
|
||||
import { isMacOS } from '../../shared/utils';
|
||||
@@ -122,4 +122,7 @@ export const uiHandlers = {
|
||||
};
|
||||
}
|
||||
},
|
||||
openExternal(_, url: string) {
|
||||
return shell.openExternal(url);
|
||||
},
|
||||
} satisfies NamespaceHandlers;
|
||||
|
||||
Reference in New Issue
Block a user