mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: handle login from deeplink
This commit is contained in:
parent
55c214eae6
commit
32566e5dfc
17 changed files with 243 additions and 62 deletions
|
@ -7,6 +7,7 @@ import { DownloadManager, logger, WindowManager } from "@main/services";
|
|||
import { dataSource } from "@main/data-source";
|
||||
import * as resources from "@locales";
|
||||
import { userPreferencesRepository } from "@main/repository";
|
||||
import { HydraApi } from "./services/hydra-api";
|
||||
|
||||
const { autoUpdater } = updater;
|
||||
|
||||
|
@ -71,7 +72,7 @@ app.on("browser-window-created", (_, window) => {
|
|||
optimizer.watchWindowShortcuts(window);
|
||||
});
|
||||
|
||||
app.on("second-instance", (_event, commandLine) => {
|
||||
app.on("second-instance", async (_event, commandLine) => {
|
||||
// Someone tried to run a second instance, we should focus our window.
|
||||
if (WindowManager.mainWindow) {
|
||||
if (WindowManager.mainWindow.isMinimized())
|
||||
|
@ -83,7 +84,14 @@ app.on("second-instance", (_event, commandLine) => {
|
|||
}
|
||||
|
||||
const [, path] = commandLine.pop()?.split("://") ?? [];
|
||||
if (path) WindowManager.redirect(path);
|
||||
if (path) {
|
||||
if (path.startsWith("auth")) {
|
||||
//hydralauncher://auth?payload=responsedaapiembase64
|
||||
await HydraApi.handleExternalAuth(path.split("=")[1]);
|
||||
} else {
|
||||
WindowManager.redirect(path);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
app.on("open-url", (_event, url) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue