mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
18 lines
483 B
TypeScript
18 lines
483 B
TypeScript
import { AllDebridClient } from "@main/services/download/all-debrid";
|
|
import { registerEvent } from "../register-event";
|
|
|
|
const authenticateAllDebrid = async (
|
|
_event: Electron.IpcMainInvokeEvent,
|
|
apiKey: string
|
|
) => {
|
|
AllDebridClient.authorize(apiKey);
|
|
const result = await AllDebridClient.getUser();
|
|
|
|
if ("error_code" in result) {
|
|
return { error_code: result.error_code };
|
|
}
|
|
|
|
return result.user;
|
|
};
|
|
|
|
registerEvent("authenticateAllDebrid", authenticateAllDebrid);
|