update electron android adb over browser
This commit is contained in:
parent
21109e4bf9
commit
f6295a9c2f
26 changed files with 1551 additions and 172 deletions
34
client-electron/electron/deeplink.ts
Normal file
34
client-electron/electron/deeplink.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import { type BrowserWindow } from 'electron'
|
||||
|
||||
export default function (
|
||||
app: Electron.App,
|
||||
win: BrowserWindow | null,
|
||||
ipcMain: Electron.IpcMain,
|
||||
shell: Electron.Shell
|
||||
) {
|
||||
ipcMain.on('deeplink', (_event, url) => {
|
||||
// open browser
|
||||
shell.openExternal(url)
|
||||
})
|
||||
|
||||
app.on('open-url', (_event, url) => {
|
||||
const paramsString = url.split('://')[1]
|
||||
|
||||
const kind = paramsString.split('?')[0]
|
||||
|
||||
const params = new URLSearchParams(paramsString)
|
||||
|
||||
if (kind === '/login') {
|
||||
win?.webContents.send('loginSuccess', {
|
||||
id: params.get('id'),
|
||||
name: params.get('name'),
|
||||
email: params.get('email'),
|
||||
picture: params.get('picture'),
|
||||
permissions: params.get('permissions'),
|
||||
access_token: params.get('access_token'),
|
||||
max_age: params.get('max_age'),
|
||||
refresh_token: params.get('refresh_token')
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue