mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-27 12:51:03 +00:00
Merge branch 'rc/v2.0' into feature/refator-process-watcher-and-game-running
# Conflicts: # src/locales/en/translation.json # src/locales/pt/translation.json # src/renderer/src/app.tsx # src/renderer/src/pages/user/user-content.tsx
This commit is contained in:
@@ -23,8 +23,8 @@ export class HydraApi {
|
||||
return this.userAuth.authToken !== "";
|
||||
}
|
||||
|
||||
static async handleExternalAuth(auth: string) {
|
||||
const { payload } = url.parse(auth, true).query;
|
||||
static async handleExternalAuth(uri: string) {
|
||||
const { payload } = url.parse(uri, true).query;
|
||||
|
||||
const decodedBase64 = atob(payload as string);
|
||||
const jsonData = JSON.parse(decodedBase64);
|
||||
|
||||
@@ -15,6 +15,7 @@ import icon from "@resources/icon.png?asset";
|
||||
import trayIcon from "@resources/tray-icon.png?asset";
|
||||
import { gameRepository, userPreferencesRepository } from "@main/repository";
|
||||
import { IsNull, Not } from "typeorm";
|
||||
import { HydraApi } from "./hydra-api";
|
||||
|
||||
export class WindowManager {
|
||||
public static mainWindow: Electron.BrowserWindow | null = null;
|
||||
@@ -80,6 +81,41 @@ export class WindowManager {
|
||||
});
|
||||
}
|
||||
|
||||
public static openAuthWindow() {
|
||||
if (this.mainWindow) {
|
||||
const authWindow = new BrowserWindow({
|
||||
width: 600,
|
||||
height: 640,
|
||||
backgroundColor: "#1c1c1c",
|
||||
parent: this.mainWindow,
|
||||
modal: true,
|
||||
show: false,
|
||||
maximizable: false,
|
||||
resizable: false,
|
||||
minimizable: false,
|
||||
webPreferences: {
|
||||
sandbox: false,
|
||||
},
|
||||
});
|
||||
|
||||
authWindow.removeMenu();
|
||||
|
||||
authWindow.loadURL("https://auth.hydra.losbroxas.org/");
|
||||
|
||||
authWindow.once("ready-to-show", () => {
|
||||
authWindow.show();
|
||||
});
|
||||
|
||||
authWindow.webContents.on("will-navigate", (_event, url) => {
|
||||
if (url.startsWith("hydralauncher://auth")) {
|
||||
authWindow.close();
|
||||
|
||||
HydraApi.handleExternalAuth(url);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static redirect(hash: string) {
|
||||
if (!this.mainWindow) this.createMainWindow();
|
||||
this.loadURL(hash);
|
||||
|
||||
Reference in New Issue
Block a user