Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
247 changes: 206 additions & 41 deletions opennow-stable/src/main/gfn/auth.ts

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion opennow-stable/src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,19 @@ function registerIpcHandlers(): void {
});

ipcMain.handle(IPC_CHANNELS.AUTH_LOGOUT, async () => {
await authService.logout();
await authService.logoutAll();
});

ipcMain.handle(IPC_CHANNELS.AUTH_GET_SAVED_ACCOUNTS, async () => {
return authService.getSavedAccounts();
});

ipcMain.handle(IPC_CHANNELS.AUTH_SWITCH_ACCOUNT, async (_event, userId: string) => {
return authService.switchAccount(userId);
});

ipcMain.handle(IPC_CHANNELS.AUTH_REMOVE_ACCOUNT, async (_event, userId: string) => {
await authService.removeAccount(userId);
});

ipcMain.handle(IPC_CHANNELS.SUBSCRIPTION_FETCH, async (_event, payload: SubscriptionFetchRequest) => {
Expand Down
6 changes: 6 additions & 0 deletions opennow-stable/src/preload/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import electron from "electron";
import { IPC_CHANNELS } from "@shared/ipc";
import type {
AuthLoginRequest,
AuthSession,
AuthSessionRequest,
GamesFetchRequest,
CatalogBrowseRequest,
ResolveLaunchIdRequest,
RegionsFetchRequest,
MainToRendererSignalingEvent,
OpenNowApi,
SavedAccount,
SessionAdReportRequest,
SessionCreateRequest,
SessionPollRequest,
Expand Down Expand Up @@ -63,6 +65,10 @@ const api: OpenNowApi = {
getRegions: (input: RegionsFetchRequest = {}) => ipcRenderer.invoke(IPC_CHANNELS.AUTH_GET_REGIONS, input),
login: (input: AuthLoginRequest) => ipcRenderer.invoke(IPC_CHANNELS.AUTH_LOGIN, input),
logout: () => ipcRenderer.invoke(IPC_CHANNELS.AUTH_LOGOUT),
getSavedAccounts: (): Promise<SavedAccount[]> => ipcRenderer.invoke(IPC_CHANNELS.AUTH_GET_SAVED_ACCOUNTS),
switchAccount: (userId: string): Promise<AuthSession> =>
ipcRenderer.invoke(IPC_CHANNELS.AUTH_SWITCH_ACCOUNT, userId),
removeAccount: (userId: string): Promise<void> => ipcRenderer.invoke(IPC_CHANNELS.AUTH_REMOVE_ACCOUNT, userId),
fetchSubscription: (input: SubscriptionFetchRequest) =>
ipcRenderer.invoke(IPC_CHANNELS.SUBSCRIPTION_FETCH, input),
fetchMainGames: (input: GamesFetchRequest) => ipcRenderer.invoke(IPC_CHANNELS.GAMES_FETCH_MAIN, input),
Expand Down
Loading
Loading