add google login flow

This commit is contained in:
2026-07-06 11:47:15 +09:00
parent 50b1cc7632
commit cdf67ee52b
6 changed files with 241 additions and 35 deletions
+11
View File
@@ -20,6 +20,14 @@ const launcherTailscale = {
const launcherSshKey = {
ensure: () => ipcRenderer.invoke('launcher-ssh-key-ensure'),
}
const launcherAuth = {
startGoogleLogin: (url: string) => ipcRenderer.invoke('start-google-login', url),
onGoogleOAuthCallback: (callback: (payload: { loginToken?: string; error?: string }) => void) => {
const listener = (_event: Electron.IpcRendererEvent, payload: { loginToken?: string; error?: string }) => callback(payload)
ipcRenderer.on('google-oauth-callback', listener)
return () => ipcRenderer.removeListener('google-oauth-callback', listener)
},
}
if (process.contextIsolated) {
try {
@@ -27,6 +35,7 @@ if (process.contextIsolated) {
contextBridge.exposeInMainWorld('appWindowMeta', appWindowMeta)
contextBridge.exposeInMainWorld('launcherTailscale', launcherTailscale)
contextBridge.exposeInMainWorld('launcherSshKey', launcherSshKey)
contextBridge.exposeInMainWorld('launcherAuth', launcherAuth)
} catch (error) {
console.error(error)
}
@@ -39,4 +48,6 @@ if (process.contextIsolated) {
window.launcherTailscale = launcherTailscale
// @ts-ignore
window.launcherSshKey = launcherSshKey
// @ts-ignore
window.launcherAuth = launcherAuth
}