feat: add auth provider boundary

This commit is contained in:
QiuSW
2026-07-08 23:37:19 +08:00
parent 811a9c889f
commit 5aaac0b166
19 changed files with 788 additions and 40 deletions
@@ -6,6 +6,132 @@
// @ts-ignore: Unused imports
import {Create as $Create} from "@wailsio/runtime";
export class AuthProviderOption {
/**
* Creates a new AuthProviderOption instance.
* @param {Partial<AuthProviderOption>} [$$source = {}] - The source object to create the AuthProviderOption.
*/
constructor($$source = {}) {
if (!("value" in $$source)) {
/**
* @member
* @type {string}
*/
this["value"] = "";
}
if (!("label" in $$source)) {
/**
* @member
* @type {string}
*/
this["label"] = "";
}
if (!("description" in $$source)) {
/**
* @member
* @type {string}
*/
this["description"] = "";
}
if (!("enabled" in $$source)) {
/**
* @member
* @type {boolean}
*/
this["enabled"] = false;
}
Object.assign(this, $$source);
}
/**
* Creates a new AuthProviderOption instance from a string or object.
* @param {any} [$$source = {}]
* @returns {AuthProviderOption}
*/
static createFrom($$source = {}) {
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
return new AuthProviderOption(/** @type {Partial<AuthProviderOption>} */($$parsedSource));
}
}
export class AuthSession {
/**
* Creates a new AuthSession instance.
* @param {Partial<AuthSession>} [$$source = {}] - The source object to create the AuthSession.
*/
constructor($$source = {}) {
if (!("id" in $$source)) {
/**
* @member
* @type {number}
*/
this["id"] = 0;
}
if (!("userId" in $$source)) {
/**
* @member
* @type {string}
*/
this["userId"] = "";
}
if (!("username" in $$source)) {
/**
* @member
* @type {string}
*/
this["username"] = "";
}
if (!("provider" in $$source)) {
/**
* @member
* @type {string}
*/
this["provider"] = "";
}
if (!("token" in $$source)) {
/**
* @member
* @type {string}
*/
this["token"] = "";
}
if (!("createdAt" in $$source)) {
/**
* @member
* @type {string}
*/
this["createdAt"] = "";
}
if (!("expiresAt" in $$source)) {
/**
* @member
* @type {string}
*/
this["expiresAt"] = "";
}
if (!("active" in $$source)) {
/**
* @member
* @type {boolean}
*/
this["active"] = false;
}
Object.assign(this, $$source);
}
/**
* Creates a new AuthSession instance from a string or object.
* @param {any} [$$source = {}]
* @returns {AuthSession}
*/
static createFrom($$source = {}) {
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
return new AuthSession(/** @type {Partial<AuthSession>} */($$parsedSource));
}
}
export class Hotkey {
/**
* Creates a new Hotkey instance.
@@ -0,0 +1,80 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import {Call as $Call, Create as $Create} from "@wailsio/runtime";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import * as models$0 from "../models/models.js";
/**
* @returns {Promise<string> & { cancel(): void }}
*/
export function GetAuthMode() {
let $resultPromise = /** @type {any} */($Call.ByID(1527507258));
return $resultPromise;
}
/**
* @returns {Promise<models$0.AuthProviderOption[]> & { cancel(): void }}
*/
export function GetAuthProviders() {
let $resultPromise = /** @type {any} */($Call.ByID(2710846997));
let $typingPromise = /** @type {any} */($resultPromise.then(($result) => {
return $$createType1($result);
}));
$typingPromise.cancel = $resultPromise.cancel.bind($resultPromise);
return $typingPromise;
}
/**
* @returns {Promise<models$0.AuthSession> & { cancel(): void }}
*/
export function GetCurrentSession() {
let $resultPromise = /** @type {any} */($Call.ByID(2579662840));
let $typingPromise = /** @type {any} */($resultPromise.then(($result) => {
return $$createType2($result);
}));
$typingPromise.cancel = $resultPromise.cancel.bind($resultPromise);
return $typingPromise;
}
/**
* @param {string} provider
* @param {string} username
* @param {string} password
* @returns {Promise<models$0.AuthSession> & { cancel(): void }}
*/
export function Login(provider, username, password) {
let $resultPromise = /** @type {any} */($Call.ByID(4113748438, provider, username, password));
let $typingPromise = /** @type {any} */($resultPromise.then(($result) => {
return $$createType2($result);
}));
$typingPromise.cancel = $resultPromise.cancel.bind($resultPromise);
return $typingPromise;
}
/**
* @returns {Promise<void> & { cancel(): void }}
*/
export function Logout() {
let $resultPromise = /** @type {any} */($Call.ByID(3585850903));
return $resultPromise;
}
/**
* @param {string} mode
* @returns {Promise<void> & { cancel(): void }}
*/
export function SetAuthMode(mode) {
let $resultPromise = /** @type {any} */($Call.ByID(3911115982, mode));
return $resultPromise;
}
// Private type creation functions
const $$createType0 = models$0.AuthProviderOption.createFrom;
const $$createType1 = $Create.Array($$createType0);
const $$createType2 = models$0.AuthSession.createFrom;
@@ -4,12 +4,14 @@
import * as AppConfigService from "./appconfigservice.js";
import * as AppService from "./appservice.js";
import * as AuthService from "./authservice.js";
import * as HotkeyService from "./hotkeyservice.js";
import * as OCRService from "./ocrservice.js";
import * as SystemInfo from "./systeminfo.js";
export {
AppConfigService,
AppService,
AuthService,
HotkeyService,
OCRService,
SystemInfo