add google login flow
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user