There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
chore: remove unused file (#6894)
pengx17bd1733b2a9ea
diff --git a/packages/frontend/electron/src/main/ui/google-auth.ts b/packages/frontend/electron/src/main/ui/google-auth.tsdeleted file mode 100644index 4846e55e0f..0000000000--- a/packages/frontend/electron/src/main/ui/google-auth.ts+++ /dev/null@@ -1,61 +0,0 @@-import { parse } from 'node:url';--import { app, BrowserWindow, shell } from 'electron';--import { logger } from '../logger';--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&customParameters={"prompt":"select_account"}`;--const tokenEndpoint = 'https://oauth2.googleapis.com/token';--export const getExchangeTokenParams = (code: string) => {- const postData = {- code,- client_id: process.env.AFFINE_GOOGLE_CLIENT_ID || '',- client_secret: process.env.AFFINE_GOOGLE_CLIENT_SECRET || '',- redirect_uri: redirectUri,- grant_type: 'authorization_code',- };- const requestInit: RequestInit = {- method: 'POST',- headers: {- 'Content-Type': 'application/x-www-form-urlencoded',- },- body: new URLSearchParams(postData).toString(),- };- return { requestInit, url: tokenEndpoint };-};--export function getGoogleOauthCode() {- return new Promise<ReturnType<typeof getExchangeTokenParams>>(- (resolve, reject) => {- shell.openExternal(oauthEndpoint).catch(e => {- logger.error('Failed to open external url', e);- reject(e);- });- const handleOpenUrl = (_: any, url: string) => {- const mainWindow = BrowserWindow.getAllWindows().find(- w => !w.isDestroyed()- );- const urlObj = parse(url.replace('??', '?'), true);- if (!mainWindow || !url.startsWith('affine://auth-callback')) return;- const code = urlObj.query['code'] as string;- if (!code) return;-- logger.info('google sign in code received from callback', code);-- app.removeListener('open-url', handleOpenUrl);- resolve(getExchangeTokenParams(code));- };-- app.on('open-url', handleOpenUrl);-- setTimeout(() => {- reject(new Error('Timed out'));- app.removeListener('open-url', handleOpenUrl);- }, 30000);- }- );-}diff --git a/packages/frontend/electron/src/main/ui/handlers.ts b/packages/frontend/electron/src/main/ui/handlers.tsindex 77027f182e..65679d2ac2 100644--- a/packages/frontend/electron/src/main/ui/handlers.ts+++ b/packages/frontend/electron/src/main/ui/handlers.ts@@ -13,7 +13,6 @@ import { getOnboardingWindow } from '../onboarding';import type { NamespaceHandlers } from '../type';import { launchStage } from '../windows-manager/stage';import { getChallengeResponse } from './challenge';-import { getGoogleOauthCode } from './google-auth';export let isOnline = true;@@ -63,9 +62,6 @@ export const uiHandlers = {handleNetworkChange: async (_, _isOnline: boolean) => {isOnline = _isOnline;},- getGoogleOauthCode: async () => {- return getGoogleOauthCode();- },getChallengeResponse: async (_, challenge: string) => {return getChallengeResponse(challenge);},