mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-11 20:08:37 +00:00
fix: ws prefix url in electron (#1896)
This commit is contained in:
@@ -3,7 +3,7 @@ import { fetch, ProxyAgent } from 'undici';
|
||||
|
||||
const redirectUri = 'https://affine.pro/client/auth-callback';
|
||||
|
||||
export const oauthEndpoint = `https://accounts.google.com/o/oauth2/v2/auth?client_id=${process.env.AFFINE_GOOGLE_CLIENT_ID}&redirect_uri=${redirectUri}&response_type=code&scope=openid https://www.googleapis.com/auth/userinfo.email profile&access_type=offline`;
|
||||
export const oauthEndpoint = `https://accounts.google.com/o/oauth2/v2/auth?client_id=${process.env.AFFINE_GOOGLE_CLIENT_ID}&redirect_uri=${redirectUri}&response_type=code&scope=openid https://www.googleapis.com/auth/userinfo.email profile&access_type=offline&customParameters={"prompt":"select_account"}`;
|
||||
|
||||
const tokenEndpoint = 'https://oauth2.googleapis.com/token';
|
||||
|
||||
|
||||
@@ -88,5 +88,6 @@ export async function restoreOrCreateWindow() {
|
||||
}
|
||||
|
||||
browserWindow.focus();
|
||||
|
||||
return browserWindow;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { protocol } from 'electron';
|
||||
import { protocol, session } from 'electron';
|
||||
import { join } from 'path';
|
||||
|
||||
export function registerProtocol() {
|
||||
@@ -20,4 +20,15 @@ export function registerProtocol() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
session.defaultSession.webRequest.onHeadersReceived(
|
||||
(responseDetails, callback) => {
|
||||
const { responseHeaders, url } = responseDetails;
|
||||
if (responseHeaders) {
|
||||
responseHeaders['Access-Control-Allow-Origin'] = ['*'];
|
||||
}
|
||||
|
||||
callback({ responseHeaders });
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user