⬆️ Upgrade wails v3 from Alpha 9 to Alpha 10
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
// 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 {Create as $Create} from "@wailsio/runtime";
|
||||
|
||||
/**
|
||||
* DB is a database handle representing a pool of zero or more
|
||||
* underlying connections. It's safe for concurrent use by multiple
|
||||
* goroutines.
|
||||
*
|
||||
* The sql package creates and frees connections automatically; it
|
||||
* also maintains a free pool of idle connections. If the database has
|
||||
* a concept of per-connection state, such state can be reliably observed
|
||||
* within a transaction ([Tx]) or connection ([Conn]). Once [DB.Begin] is called, the
|
||||
* returned [Tx] is bound to a single connection. Once [Tx.Commit] or
|
||||
* [Tx.Rollback] is called on the transaction, that transaction's
|
||||
* connection is returned to [DB]'s idle connection pool. The pool size
|
||||
* can be controlled with [DB.SetMaxIdleConns].
|
||||
*/
|
||||
export class DB {
|
||||
|
||||
/** Creates a new DB instance. */
|
||||
constructor($$source: Partial<DB> = {}) {
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new DB instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): DB {
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
return new DB($$parsedSource as Partial<DB>);
|
||||
}
|
||||
}
|
@@ -11,15 +11,55 @@ import * as slog$0 from "../../../../../../log/slog/models.js";
|
||||
|
||||
export class App {
|
||||
/**
|
||||
* The main application menu
|
||||
* Manager pattern for organized API
|
||||
*/
|
||||
"ApplicationMenu": Menu | null;
|
||||
"Window": WindowManager | null;
|
||||
"ContextMenu": ContextMenuManager | null;
|
||||
"KeyBinding": KeyBindingManager | null;
|
||||
"Browser": BrowserManager | null;
|
||||
"Env": EnvironmentManager | null;
|
||||
"Dialog": DialogManager | null;
|
||||
"Event": EventManager | null;
|
||||
"Menu": MenuManager | null;
|
||||
"Screen": ScreenManager | null;
|
||||
"Clipboard": ClipboardManager | null;
|
||||
"SystemTray": SystemTrayManager | null;
|
||||
"Logger": slog$0.Logger | null;
|
||||
|
||||
/** Creates a new App instance. */
|
||||
constructor($$source: Partial<App> = {}) {
|
||||
if (!("ApplicationMenu" in $$source)) {
|
||||
this["ApplicationMenu"] = null;
|
||||
if (!("Window" in $$source)) {
|
||||
this["Window"] = null;
|
||||
}
|
||||
if (!("ContextMenu" in $$source)) {
|
||||
this["ContextMenu"] = null;
|
||||
}
|
||||
if (!("KeyBinding" in $$source)) {
|
||||
this["KeyBinding"] = null;
|
||||
}
|
||||
if (!("Browser" in $$source)) {
|
||||
this["Browser"] = null;
|
||||
}
|
||||
if (!("Env" in $$source)) {
|
||||
this["Env"] = null;
|
||||
}
|
||||
if (!("Dialog" in $$source)) {
|
||||
this["Dialog"] = null;
|
||||
}
|
||||
if (!("Event" in $$source)) {
|
||||
this["Event"] = null;
|
||||
}
|
||||
if (!("Menu" in $$source)) {
|
||||
this["Menu"] = null;
|
||||
}
|
||||
if (!("Screen" in $$source)) {
|
||||
this["Screen"] = null;
|
||||
}
|
||||
if (!("Clipboard" in $$source)) {
|
||||
this["Clipboard"] = null;
|
||||
}
|
||||
if (!("SystemTray" in $$source)) {
|
||||
this["SystemTray"] = null;
|
||||
}
|
||||
if (!("Logger" in $$source)) {
|
||||
this["Logger"] = null;
|
||||
@@ -34,31 +74,308 @@ export class App {
|
||||
static createFrom($$source: any = {}): App {
|
||||
const $$createField0_0 = $$createType1;
|
||||
const $$createField1_0 = $$createType3;
|
||||
const $$createField2_0 = $$createType5;
|
||||
const $$createField3_0 = $$createType7;
|
||||
const $$createField4_0 = $$createType9;
|
||||
const $$createField5_0 = $$createType11;
|
||||
const $$createField6_0 = $$createType13;
|
||||
const $$createField7_0 = $$createType15;
|
||||
const $$createField8_0 = $$createType17;
|
||||
const $$createField9_0 = $$createType19;
|
||||
const $$createField10_0 = $$createType21;
|
||||
const $$createField11_0 = $$createType23;
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
if ("ApplicationMenu" in $$parsedSource) {
|
||||
$$parsedSource["ApplicationMenu"] = $$createField0_0($$parsedSource["ApplicationMenu"]);
|
||||
if ("Window" in $$parsedSource) {
|
||||
$$parsedSource["Window"] = $$createField0_0($$parsedSource["Window"]);
|
||||
}
|
||||
if ("ContextMenu" in $$parsedSource) {
|
||||
$$parsedSource["ContextMenu"] = $$createField1_0($$parsedSource["ContextMenu"]);
|
||||
}
|
||||
if ("KeyBinding" in $$parsedSource) {
|
||||
$$parsedSource["KeyBinding"] = $$createField2_0($$parsedSource["KeyBinding"]);
|
||||
}
|
||||
if ("Browser" in $$parsedSource) {
|
||||
$$parsedSource["Browser"] = $$createField3_0($$parsedSource["Browser"]);
|
||||
}
|
||||
if ("Env" in $$parsedSource) {
|
||||
$$parsedSource["Env"] = $$createField4_0($$parsedSource["Env"]);
|
||||
}
|
||||
if ("Dialog" in $$parsedSource) {
|
||||
$$parsedSource["Dialog"] = $$createField5_0($$parsedSource["Dialog"]);
|
||||
}
|
||||
if ("Event" in $$parsedSource) {
|
||||
$$parsedSource["Event"] = $$createField6_0($$parsedSource["Event"]);
|
||||
}
|
||||
if ("Menu" in $$parsedSource) {
|
||||
$$parsedSource["Menu"] = $$createField7_0($$parsedSource["Menu"]);
|
||||
}
|
||||
if ("Screen" in $$parsedSource) {
|
||||
$$parsedSource["Screen"] = $$createField8_0($$parsedSource["Screen"]);
|
||||
}
|
||||
if ("Clipboard" in $$parsedSource) {
|
||||
$$parsedSource["Clipboard"] = $$createField9_0($$parsedSource["Clipboard"]);
|
||||
}
|
||||
if ("SystemTray" in $$parsedSource) {
|
||||
$$parsedSource["SystemTray"] = $$createField10_0($$parsedSource["SystemTray"]);
|
||||
}
|
||||
if ("Logger" in $$parsedSource) {
|
||||
$$parsedSource["Logger"] = $$createField1_0($$parsedSource["Logger"]);
|
||||
$$parsedSource["Logger"] = $$createField11_0($$parsedSource["Logger"]);
|
||||
}
|
||||
return new App($$parsedSource as Partial<App>);
|
||||
}
|
||||
}
|
||||
|
||||
export class Menu {
|
||||
/**
|
||||
* BrowserManager manages browser-related operations
|
||||
*/
|
||||
export class BrowserManager {
|
||||
|
||||
/** Creates a new Menu instance. */
|
||||
constructor($$source: Partial<Menu> = {}) {
|
||||
/** Creates a new BrowserManager instance. */
|
||||
constructor($$source: Partial<BrowserManager> = {}) {
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Menu instance from a string or object.
|
||||
* Creates a new BrowserManager instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): Menu {
|
||||
static createFrom($$source: any = {}): BrowserManager {
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
return new Menu($$parsedSource as Partial<Menu>);
|
||||
return new BrowserManager($$parsedSource as Partial<BrowserManager>);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ClipboardManager manages clipboard operations
|
||||
*/
|
||||
export class ClipboardManager {
|
||||
|
||||
/** Creates a new ClipboardManager instance. */
|
||||
constructor($$source: Partial<ClipboardManager> = {}) {
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new ClipboardManager instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): ClipboardManager {
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
return new ClipboardManager($$parsedSource as Partial<ClipboardManager>);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ContextMenuManager manages all context menu operations
|
||||
*/
|
||||
export class ContextMenuManager {
|
||||
|
||||
/** Creates a new ContextMenuManager instance. */
|
||||
constructor($$source: Partial<ContextMenuManager> = {}) {
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new ContextMenuManager instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): ContextMenuManager {
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
return new ContextMenuManager($$parsedSource as Partial<ContextMenuManager>);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DialogManager manages dialog-related operations
|
||||
*/
|
||||
export class DialogManager {
|
||||
|
||||
/** Creates a new DialogManager instance. */
|
||||
constructor($$source: Partial<DialogManager> = {}) {
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new DialogManager instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): DialogManager {
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
return new DialogManager($$parsedSource as Partial<DialogManager>);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* EnvironmentManager manages environment-related operations
|
||||
*/
|
||||
export class EnvironmentManager {
|
||||
|
||||
/** Creates a new EnvironmentManager instance. */
|
||||
constructor($$source: Partial<EnvironmentManager> = {}) {
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new EnvironmentManager instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): EnvironmentManager {
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
return new EnvironmentManager($$parsedSource as Partial<EnvironmentManager>);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* EventManager manages event-related operations
|
||||
*/
|
||||
export class EventManager {
|
||||
|
||||
/** Creates a new EventManager instance. */
|
||||
constructor($$source: Partial<EventManager> = {}) {
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new EventManager instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): EventManager {
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
return new EventManager($$parsedSource as Partial<EventManager>);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* KeyBindingManager manages all key binding operations
|
||||
*/
|
||||
export class KeyBindingManager {
|
||||
|
||||
/** Creates a new KeyBindingManager instance. */
|
||||
constructor($$source: Partial<KeyBindingManager> = {}) {
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new KeyBindingManager instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): KeyBindingManager {
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
return new KeyBindingManager($$parsedSource as Partial<KeyBindingManager>);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* MenuManager manages menu-related operations
|
||||
*/
|
||||
export class MenuManager {
|
||||
|
||||
/** Creates a new MenuManager instance. */
|
||||
constructor($$source: Partial<MenuManager> = {}) {
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new MenuManager instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): MenuManager {
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
return new MenuManager($$parsedSource as Partial<MenuManager>);
|
||||
}
|
||||
}
|
||||
|
||||
export class ScreenManager {
|
||||
|
||||
/** Creates a new ScreenManager instance. */
|
||||
constructor($$source: Partial<ScreenManager> = {}) {
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new ScreenManager instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): ScreenManager {
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
return new ScreenManager($$parsedSource as Partial<ScreenManager>);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ServiceOptions provides optional parameters for calls to [NewService].
|
||||
*/
|
||||
export class ServiceOptions {
|
||||
/**
|
||||
* Name can be set to override the name of the service
|
||||
* for logging and debugging purposes.
|
||||
*
|
||||
* If empty, it will default
|
||||
* either to the value obtained through the [ServiceName] interface,
|
||||
* or to the type name.
|
||||
*/
|
||||
"Name": string;
|
||||
|
||||
/**
|
||||
* If the service instance implements [http.Handler],
|
||||
* it will be mounted on the internal asset server
|
||||
* at the prefix specified by Route.
|
||||
*/
|
||||
"Route": string;
|
||||
|
||||
/**
|
||||
* MarshalError will be called if non-nil
|
||||
* to marshal to JSON the error values returned by this service's methods.
|
||||
*
|
||||
* MarshalError is not allowed to fail,
|
||||
* but it may return a nil slice to fall back
|
||||
* to the globally configured error handler.
|
||||
*
|
||||
* If the returned slice is not nil, it must contain valid JSON.
|
||||
*/
|
||||
"MarshalError": any;
|
||||
|
||||
/** Creates a new ServiceOptions instance. */
|
||||
constructor($$source: Partial<ServiceOptions> = {}) {
|
||||
if (!("Name" in $$source)) {
|
||||
this["Name"] = "";
|
||||
}
|
||||
if (!("Route" in $$source)) {
|
||||
this["Route"] = "";
|
||||
}
|
||||
if (!("MarshalError" in $$source)) {
|
||||
this["MarshalError"] = null;
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new ServiceOptions instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): ServiceOptions {
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
return new ServiceOptions($$parsedSource as Partial<ServiceOptions>);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* SystemTrayManager manages system tray-related operations
|
||||
*/
|
||||
export class SystemTrayManager {
|
||||
|
||||
/** Creates a new SystemTrayManager instance. */
|
||||
constructor($$source: Partial<SystemTrayManager> = {}) {
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new SystemTrayManager instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): SystemTrayManager {
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
return new SystemTrayManager($$parsedSource as Partial<SystemTrayManager>);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,8 +396,48 @@ export class WebviewWindow {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* WindowManager manages all window-related operations
|
||||
*/
|
||||
export class WindowManager {
|
||||
|
||||
/** Creates a new WindowManager instance. */
|
||||
constructor($$source: Partial<WindowManager> = {}) {
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new WindowManager instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): WindowManager {
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
return new WindowManager($$parsedSource as Partial<WindowManager>);
|
||||
}
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = Menu.createFrom;
|
||||
const $$createType0 = WindowManager.createFrom;
|
||||
const $$createType1 = $Create.Nullable($$createType0);
|
||||
const $$createType2 = slog$0.Logger.createFrom;
|
||||
const $$createType2 = ContextMenuManager.createFrom;
|
||||
const $$createType3 = $Create.Nullable($$createType2);
|
||||
const $$createType4 = KeyBindingManager.createFrom;
|
||||
const $$createType5 = $Create.Nullable($$createType4);
|
||||
const $$createType6 = BrowserManager.createFrom;
|
||||
const $$createType7 = $Create.Nullable($$createType6);
|
||||
const $$createType8 = EnvironmentManager.createFrom;
|
||||
const $$createType9 = $Create.Nullable($$createType8);
|
||||
const $$createType10 = DialogManager.createFrom;
|
||||
const $$createType11 = $Create.Nullable($$createType10);
|
||||
const $$createType12 = EventManager.createFrom;
|
||||
const $$createType13 = $Create.Nullable($$createType12);
|
||||
const $$createType14 = MenuManager.createFrom;
|
||||
const $$createType15 = $Create.Nullable($$createType14);
|
||||
const $$createType16 = ScreenManager.createFrom;
|
||||
const $$createType17 = $Create.Nullable($$createType16);
|
||||
const $$createType18 = ClipboardManager.createFrom;
|
||||
const $$createType19 = $Create.Nullable($$createType18);
|
||||
const $$createType20 = SystemTrayManager.createFrom;
|
||||
const $$createType21 = $Create.Nullable($$createType20);
|
||||
const $$createType22 = slog$0.Logger.createFrom;
|
||||
const $$createType23 = $Create.Nullable($$createType22);
|
||||
|
@@ -1,4 +1,9 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import * as Service from "./service.js";
|
||||
export {
|
||||
Service
|
||||
};
|
||||
|
||||
export * from "./models.js";
|
@@ -0,0 +1,51 @@
|
||||
// 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 {Create as $Create} from "@wailsio/runtime";
|
||||
|
||||
export class Config {
|
||||
/**
|
||||
* DBSource is the database URI to use.
|
||||
* The string ":memory:" can be used to create an in-memory database.
|
||||
* The sqlite driver can be configured through query parameters.
|
||||
* For more details see https://pkg.go.dev/modernc.org/sqlite#Driver.Open
|
||||
*/
|
||||
"DBSource": string;
|
||||
|
||||
/** Creates a new Config instance. */
|
||||
constructor($$source: Partial<Config> = {}) {
|
||||
if (!("DBSource" in $$source)) {
|
||||
this["DBSource"] = "";
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Config instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): Config {
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
return new Config($$parsedSource as Partial<Config>);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Row holds a single row in the result of a query.
|
||||
* It is a key-value map where keys are column names.
|
||||
*/
|
||||
export type Row = { [_: string]: any };
|
||||
|
||||
/**
|
||||
* Rows holds the result of a query
|
||||
* as an array of key-value maps where keys are column names.
|
||||
*/
|
||||
export type Rows = Row[];
|
||||
|
||||
/**
|
||||
* Stmt wraps a prepared sql statement pointer.
|
||||
* It provides the same methods as the [sql.Stmt] type.
|
||||
*/
|
||||
export type Stmt = string;
|
@@ -0,0 +1,223 @@
|
||||
// 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 application$0 from "../../application/models.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./models.js";
|
||||
|
||||
export {
|
||||
ExecContext as Execute,
|
||||
QueryContext as Query
|
||||
};
|
||||
|
||||
import { Stmt } from "./stmt.js";
|
||||
|
||||
/**
|
||||
* Prepare creates a prepared statement for later queries or executions.
|
||||
* Multiple queries or executions may be run concurrently from the returned statement.
|
||||
*
|
||||
* The caller must call the statement's Close method when it is no longer needed.
|
||||
* Statements are closed automatically
|
||||
* when the connection they are associated with is closed.
|
||||
*
|
||||
* Prepare supports early cancellation.
|
||||
*/
|
||||
export function Prepare(query: string): Promise<Stmt | null> & { cancel(): void } {
|
||||
const promise = PrepareContext(query);
|
||||
const wrapper: any = (promise.then(function (id) {
|
||||
return id == null ? null : new Stmt(
|
||||
ClosePrepared.bind(null, id),
|
||||
ExecPrepared.bind(null, id),
|
||||
QueryPrepared.bind(null, id));
|
||||
}));
|
||||
wrapper.cancel = promise.cancel;
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close closes the current database connection if one is open, otherwise has no effect.
|
||||
* Additionally, Close closes all open prepared statements associated to the connection.
|
||||
*
|
||||
* Even when a non-nil error is returned,
|
||||
* the database service is left in a consistent state,
|
||||
* ready for a call to [Service.Open].
|
||||
*/
|
||||
export function Close(): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(1888105376) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* ClosePrepared closes a prepared statement
|
||||
* obtained with [Service.Prepare] or [Service.PrepareContext].
|
||||
* ClosePrepared is idempotent:
|
||||
* it has no effect on prepared statements that are already closed.
|
||||
*/
|
||||
function ClosePrepared(stmt: $models.Stmt | null): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(2526200629, stmt) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure changes the database service configuration.
|
||||
* The connection state at call time is preserved.
|
||||
* Consumers will need to call [Service.Open] manually after Configure
|
||||
* in order to reconnect with the new configuration.
|
||||
*
|
||||
* See [NewWithConfig] for details on configuration.
|
||||
*/
|
||||
export function Configure(config: $models.Config | null): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(1939578712, config) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* ExecContext executes a query without returning any rows.
|
||||
* It supports early cancellation.
|
||||
*/
|
||||
function ExecContext(query: string, ...args: any[]): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(674944556, query, args) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* ExecPrepared executes a prepared statement
|
||||
* obtained with [Service.Prepare] or [Service.PrepareContext]
|
||||
* without returning any rows.
|
||||
* It supports early cancellation.
|
||||
*/
|
||||
function ExecPrepared(stmt: $models.Stmt | null, ...args: any[]): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(2086877656, stmt, args) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute executes a query without returning any rows.
|
||||
*/
|
||||
export function Execute(query: string, ...args: any[]): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(3811930203, query, args) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open validates the current configuration,
|
||||
* closes the current connection if one is present,
|
||||
* then opens and validates a new connection.
|
||||
*
|
||||
* Even when a non-nil error is returned,
|
||||
* the database service is left in a consistent state,
|
||||
* ready for a new call to Open.
|
||||
*/
|
||||
export function Open(): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(2012175612) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare creates a prepared statement for later queries or executions.
|
||||
* Multiple queries or executions may be run concurrently from the returned statement.
|
||||
*
|
||||
* The caller should call the statement's Close method when it is no longer needed.
|
||||
* Statements are closed automatically
|
||||
* when the connection they are associated with is closed.
|
||||
*/
|
||||
export function Prepare(query: string): Promise<$models.Stmt | null> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(1801965143, query) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* PrepareContext creates a prepared statement for later queries or executions.
|
||||
* Multiple queries or executions may be run concurrently from the returned statement.
|
||||
*
|
||||
* The caller must call the statement's Close method when it is no longer needed.
|
||||
* Statements are closed automatically
|
||||
* when the connection they are associated with is closed.
|
||||
*
|
||||
* PrepareContext supports early cancellation.
|
||||
*/
|
||||
function PrepareContext(query: string): Promise<$models.Stmt | null> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(570941694, query) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query executes a query and returns a slice of key-value records,
|
||||
* one per row, with column names as keys.
|
||||
*/
|
||||
export function Query(query: string, ...args: any[]): Promise<$models.Rows> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(860757720, query, args) as any;
|
||||
let $typingPromise = $resultPromise.then(($result: any) => {
|
||||
return $$createType1($result);
|
||||
}) as any;
|
||||
$typingPromise.cancel = $resultPromise.cancel.bind($resultPromise);
|
||||
return $typingPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* QueryContext executes a query and returns a slice of key-value records,
|
||||
* one per row, with column names as keys.
|
||||
* It supports early cancellation, returning the slice of results fetched so far.
|
||||
*/
|
||||
function QueryContext(query: string, ...args: any[]): Promise<$models.Rows> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(4115542347, query, args) as any;
|
||||
let $typingPromise = $resultPromise.then(($result: any) => {
|
||||
return $$createType1($result);
|
||||
}) as any;
|
||||
$typingPromise.cancel = $resultPromise.cancel.bind($resultPromise);
|
||||
return $typingPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* QueryPrepared executes a prepared statement
|
||||
* obtained with [Service.Prepare] or [Service.PrepareContext]
|
||||
* and returns a slice of key-value records, one per row, with column names as keys.
|
||||
* It supports early cancellation, returning the slice of results fetched so far.
|
||||
*/
|
||||
function QueryPrepared(stmt: $models.Stmt | null, ...args: any[]): Promise<$models.Rows> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(3885083725, stmt, args) as any;
|
||||
let $typingPromise = $resultPromise.then(($result: any) => {
|
||||
return $$createType1($result);
|
||||
}) as any;
|
||||
$typingPromise.cancel = $resultPromise.cancel.bind($resultPromise);
|
||||
return $typingPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* ServiceName returns the name of the plugin.
|
||||
* You should use the go module format e.g. github.com/myuser/myplugin
|
||||
*/
|
||||
export function ServiceName(): Promise<string> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(1637123084) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* ServiceShutdown closes the database connection.
|
||||
* It returns a non-nil error in case of failures.
|
||||
*/
|
||||
export function ServiceShutdown(): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(3650435925) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* ServiceStartup opens the database connection.
|
||||
* It returns a non-nil error in case of failures.
|
||||
*/
|
||||
export function ServiceStartup(options: application$0.ServiceOptions): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(1113159936, options) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = $Create.Map($Create.Any, $Create.Any);
|
||||
const $$createType1 = $Create.Array($$createType0);
|
@@ -0,0 +1,79 @@
|
||||
//@ts-check
|
||||
|
||||
//@ts-ignore: Unused imports
|
||||
import * as $models from "./models.js";
|
||||
|
||||
const execSymbol = Symbol("exec"),
|
||||
querySymbol = Symbol("query"),
|
||||
closeSymbol = Symbol("close");
|
||||
|
||||
/**
|
||||
* Stmt represents a prepared statement for later queries or executions.
|
||||
* Multiple queries or executions may be run concurrently on the same statement.
|
||||
*
|
||||
* The caller must call the statement's Close method when it is no longer needed.
|
||||
* Statements are closed automatically
|
||||
* when the connection they are associated with is closed.
|
||||
*/
|
||||
export class Stmt {
|
||||
/**
|
||||
* Constructs a new prepared statement instance.
|
||||
* @param {(...args: any[]) => Promise<void>} close
|
||||
* @param {(...args: any[]) => Promise<void> & { cancel(): void }} exec
|
||||
* @param {(...args: any[]) => Promise<$models.Rows> & { cancel(): void }} query
|
||||
*/
|
||||
constructor(close, exec, query) {
|
||||
/**
|
||||
* @member
|
||||
* @private
|
||||
* @type {typeof close}
|
||||
*/
|
||||
this[closeSymbol] = close;
|
||||
|
||||
/**
|
||||
* @member
|
||||
* @private
|
||||
* @type {typeof exec}
|
||||
*/
|
||||
this[execSymbol] = exec;
|
||||
|
||||
/**
|
||||
* @member
|
||||
* @private
|
||||
* @type {typeof query}
|
||||
*/
|
||||
this[querySymbol] = query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the prepared statement.
|
||||
* It has no effect when the statement is already closed.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
Close() {
|
||||
return this[closeSymbol]();
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the prepared statement without returning any rows.
|
||||
* It supports early cancellation.
|
||||
*
|
||||
* @param {any[]} args
|
||||
* @returns {Promise<void> & { cancel(): void }}
|
||||
*/
|
||||
Exec(...args) {
|
||||
return this[execSymbol](...args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the prepared statement
|
||||
* and returns a slice of key-value records, one per row, with column names as keys.
|
||||
* It supports early cancellation, returning the array of results fetched so far.
|
||||
*
|
||||
* @param {any[]} args
|
||||
* @returns {Promise<$models.Rows> & { cancel(): void }}
|
||||
*/
|
||||
Query(...args) {
|
||||
return this[querySymbol](...args);
|
||||
}
|
||||
}
|
@@ -963,84 +963,6 @@ export enum KeyBindingCommand {
|
||||
TextHighlightToggleCommand = "textHighlightToggle",
|
||||
};
|
||||
|
||||
/**
|
||||
* KeyBindingConfig 快捷键配置
|
||||
*/
|
||||
export class KeyBindingConfig {
|
||||
/**
|
||||
* 快捷键列表
|
||||
*/
|
||||
"keyBindings": KeyBinding[];
|
||||
|
||||
/**
|
||||
* 配置元数据
|
||||
*/
|
||||
"metadata": KeyBindingMetadata;
|
||||
|
||||
/** Creates a new KeyBindingConfig instance. */
|
||||
constructor($$source: Partial<KeyBindingConfig> = {}) {
|
||||
if (!("keyBindings" in $$source)) {
|
||||
this["keyBindings"] = [];
|
||||
}
|
||||
if (!("metadata" in $$source)) {
|
||||
this["metadata"] = (new KeyBindingMetadata());
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new KeyBindingConfig instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): KeyBindingConfig {
|
||||
const $$createField0_0 = $$createType9;
|
||||
const $$createField1_0 = $$createType10;
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
if ("keyBindings" in $$parsedSource) {
|
||||
$$parsedSource["keyBindings"] = $$createField0_0($$parsedSource["keyBindings"]);
|
||||
}
|
||||
if ("metadata" in $$parsedSource) {
|
||||
$$parsedSource["metadata"] = $$createField1_0($$parsedSource["metadata"]);
|
||||
}
|
||||
return new KeyBindingConfig($$parsedSource as Partial<KeyBindingConfig>);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* KeyBindingMetadata 快捷键配置元数据
|
||||
*/
|
||||
export class KeyBindingMetadata {
|
||||
/**
|
||||
* 配置版本
|
||||
*/
|
||||
"version": string;
|
||||
|
||||
/**
|
||||
* 最后更新时间
|
||||
*/
|
||||
"lastUpdated": string;
|
||||
|
||||
/** Creates a new KeyBindingMetadata instance. */
|
||||
constructor($$source: Partial<KeyBindingMetadata> = {}) {
|
||||
if (!("version" in $$source)) {
|
||||
this["version"] = "";
|
||||
}
|
||||
if (!("lastUpdated" in $$source)) {
|
||||
this["lastUpdated"] = "";
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new KeyBindingMetadata instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): KeyBindingMetadata {
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
return new KeyBindingMetadata($$parsedSource as Partial<KeyBindingMetadata>);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* LanguageType 语言类型定义
|
||||
*/
|
||||
@@ -1204,8 +1126,8 @@ export class UpdatesConfig {
|
||||
* Creates a new UpdatesConfig instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): UpdatesConfig {
|
||||
const $$createField6_0 = $$createType11;
|
||||
const $$createField7_0 = $$createType12;
|
||||
const $$createField6_0 = $$createType8;
|
||||
const $$createField7_0 = $$createType9;
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
if ("github" in $$parsedSource) {
|
||||
$$parsedSource["github"] = $$createField6_0($$parsedSource["github"]);
|
||||
@@ -1231,8 +1153,5 @@ var $$createType5 = (function $$initCreateType5(...args): any {
|
||||
});
|
||||
const $$createType6 = $Create.Map($Create.Any, $Create.Any);
|
||||
const $$createType7 = HotkeyCombo.createFrom;
|
||||
const $$createType8 = KeyBinding.createFrom;
|
||||
const $$createType9 = $Create.Array($$createType8);
|
||||
const $$createType10 = KeyBindingMetadata.createFrom;
|
||||
const $$createType11 = GithubConfig.createFrom;
|
||||
const $$createType12 = GiteaConfig.createFrom;
|
||||
const $$createType8 = GithubConfig.createFrom;
|
||||
const $$createType9 = GiteaConfig.createFrom;
|
||||
|
@@ -42,6 +42,14 @@ export function ResetConfig(): Promise<void> & { cancel(): void } {
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* ServiceShutdown 关闭服务
|
||||
*/
|
||||
export function ServiceShutdown(): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(3963562361) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set 设置配置项
|
||||
*/
|
||||
|
@@ -12,19 +12,7 @@ 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 sql$0 from "../../../database/sql/models.js";
|
||||
|
||||
/**
|
||||
* GetDB returns the database connection
|
||||
*/
|
||||
export function GetDB(): Promise<sql$0.DB | null> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(228760371) as any;
|
||||
let $typingPromise = $resultPromise.then(($result: any) => {
|
||||
return $$createType1($result);
|
||||
}) as any;
|
||||
$typingPromise.cancel = $resultPromise.cancel.bind($resultPromise);
|
||||
return $typingPromise;
|
||||
}
|
||||
import * as application$0 from "../../../github.com/wailsapp/wails/v3/pkg/application/models.js";
|
||||
|
||||
/**
|
||||
* OnDataPathChanged handles data path changes
|
||||
@@ -34,6 +22,18 @@ export function OnDataPathChanged(): Promise<void> & { cancel(): void } {
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = sql$0.DB.createFrom;
|
||||
const $$createType1 = $Create.Nullable($$createType0);
|
||||
/**
|
||||
* ServiceShutdown shuts down the service when the application closes
|
||||
*/
|
||||
export function ServiceShutdown(): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(3907893632) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* ServiceStartup initializes the service when the application starts
|
||||
*/
|
||||
export function ServiceStartup(options: application$0.ServiceOptions): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(2067840771, options) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
@@ -10,6 +10,9 @@
|
||||
// @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 application$0 from "../../../github.com/wailsapp/wails/v3/pkg/application/models.js";
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as models$0 from "../models/models.js";
|
||||
@@ -86,6 +89,14 @@ export function RestoreDocument(id: number): Promise<void> & { cancel(): void }
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* ServiceStartup initializes the service when the application starts
|
||||
*/
|
||||
export function ServiceStartup(options: application$0.ServiceOptions): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(1474135487, options) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* UpdateDocumentContent updates the content of a document
|
||||
*/
|
||||
|
@@ -10,6 +10,9 @@
|
||||
// @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 application$0 from "../../../github.com/wailsapp/wails/v3/pkg/application/models.js";
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as models$0 from "../models/models.js";
|
||||
@@ -42,6 +45,14 @@ export function ResetExtensionToDefault(id: models$0.ExtensionID): Promise<void>
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* ServiceStartup 启动时调用
|
||||
*/
|
||||
export function ServiceStartup(options: application$0.ServiceOptions): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(40324057, options) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* UpdateExtensionEnabled 更新扩展启用状态
|
||||
*/
|
||||
|
@@ -2,7 +2,7 @@
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
/**
|
||||
* HotkeyService Linux全局热键服务
|
||||
* HotkeyService Windows全局热键服务
|
||||
* @module
|
||||
*/
|
||||
|
||||
@@ -53,6 +53,14 @@ export function RegisterHotkey(hotkey: models$0.HotkeyCombo | null): Promise<voi
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* ServiceShutdown 关闭服务
|
||||
*/
|
||||
export function ServiceShutdown(): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(157291181) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* UnregisterHotkey 取消注册全局热键
|
||||
*/
|
||||
|
@@ -10,6 +10,9 @@
|
||||
// @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 application$0 from "../../../github.com/wailsapp/wails/v3/pkg/application/models.js";
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as models$0 from "../models/models.js";
|
||||
@@ -27,19 +30,13 @@ export function GetAllKeyBindings(): Promise<models$0.KeyBinding[]> & { cancel()
|
||||
}
|
||||
|
||||
/**
|
||||
* GetKeyBindingConfig 获取完整快捷键配置
|
||||
* ServiceStartup 启动时调用
|
||||
*/
|
||||
export function GetKeyBindingConfig(): Promise<models$0.KeyBindingConfig | null> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(3804318356) as any;
|
||||
let $typingPromise = $resultPromise.then(($result: any) => {
|
||||
return $$createType3($result);
|
||||
}) as any;
|
||||
$typingPromise.cancel = $resultPromise.cancel.bind($resultPromise);
|
||||
return $typingPromise;
|
||||
export function ServiceStartup(options: application$0.ServiceOptions): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(2057121990, options) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = models$0.KeyBinding.createFrom;
|
||||
const $$createType1 = $Create.Array($$createType0);
|
||||
const $$createType2 = models$0.KeyBindingConfig.createFrom;
|
||||
const $$createType3 = $Create.Nullable($$createType2);
|
||||
|
@@ -42,5 +42,13 @@ export function MigrateDirectory(srcPath: string, dstPath: string): Promise<void
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* ServiceShutdown 服务关闭
|
||||
*/
|
||||
export function ServiceShutdown(): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(3472042605) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = $models.MigrationProgress.createFrom;
|
||||
|
136
frontend/package-lock.json
generated
136
frontend/package-lock.json
generated
@@ -60,7 +60,7 @@
|
||||
"@eslint/js": "^9.30.1",
|
||||
"@lezer/generator": "^1.8.0",
|
||||
"@types/lodash": "^4.17.20",
|
||||
"@types/node": "^24.0.10",
|
||||
"@types/node": "^24.0.12",
|
||||
"@types/remarkable": "^2.0.8",
|
||||
"@vitejs/plugin-vue": "^6.0.0",
|
||||
"@wailsio/runtime": "latest",
|
||||
@@ -68,9 +68,9 @@
|
||||
"eslint-plugin-vue": "^10.3.0",
|
||||
"globals": "^16.3.0",
|
||||
"typescript": "^5.8.3",
|
||||
"typescript-eslint": "^8.35.1",
|
||||
"typescript-eslint": "^8.36.0",
|
||||
"unplugin-vue-components": "^28.8.0",
|
||||
"vite": "^7.0.2",
|
||||
"vite": "^7.0.3",
|
||||
"vue-eslint-parser": "^10.2.0",
|
||||
"vue-tsc": "^3.0.1"
|
||||
}
|
||||
@@ -2131,9 +2131,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "24.0.10",
|
||||
"resolved": "https://registry.npmmirror.com/@types/node/-/node-24.0.10.tgz",
|
||||
"integrity": "sha512-ENHwaH+JIRTDIEEbDK6QSQntAYGtbvdDXnMXnZaZ6k13Du1dPMmprkEHIL7ok2Wl2aZevetwTAb5S+7yIF+enA==",
|
||||
"version": "24.0.12",
|
||||
"resolved": "https://registry.npmmirror.com/@types/node/-/node-24.0.12.tgz",
|
||||
"integrity": "sha512-LtOrbvDf5ndC9Xi+4QZjVL0woFymF/xSTKZKPgrrl7H7XoeDvnD+E2IclKVDyaK9UM756W/3BXqSU+JEHopA9g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@@ -2148,17 +2148,17 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||
"version": "8.35.1",
|
||||
"resolved": "https://registry.npmmirror.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.35.1.tgz",
|
||||
"integrity": "sha512-9XNTlo7P7RJxbVeICaIIIEipqxLKguyh+3UbXuT2XQuFp6d8VOeDEGuz5IiX0dgZo8CiI6aOFLg4e8cF71SFVg==",
|
||||
"version": "8.36.0",
|
||||
"resolved": "https://registry.npmmirror.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.36.0.tgz",
|
||||
"integrity": "sha512-lZNihHUVB6ZZiPBNgOQGSxUASI7UJWhT8nHyUGCnaQ28XFCw98IfrMCG3rUl1uwUWoAvodJQby2KTs79UTcrAg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@eslint-community/regexpp": "^4.10.0",
|
||||
"@typescript-eslint/scope-manager": "8.35.1",
|
||||
"@typescript-eslint/type-utils": "8.35.1",
|
||||
"@typescript-eslint/utils": "8.35.1",
|
||||
"@typescript-eslint/visitor-keys": "8.35.1",
|
||||
"@typescript-eslint/scope-manager": "8.36.0",
|
||||
"@typescript-eslint/type-utils": "8.36.0",
|
||||
"@typescript-eslint/utils": "8.36.0",
|
||||
"@typescript-eslint/visitor-keys": "8.36.0",
|
||||
"graphemer": "^1.4.0",
|
||||
"ignore": "^7.0.0",
|
||||
"natural-compare": "^1.4.0",
|
||||
@@ -2172,7 +2172,7 @@
|
||||
"url": "https://opencollective.com/typescript-eslint"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@typescript-eslint/parser": "^8.35.1",
|
||||
"@typescript-eslint/parser": "^8.36.0",
|
||||
"eslint": "^8.57.0 || ^9.0.0",
|
||||
"typescript": ">=4.8.4 <5.9.0"
|
||||
}
|
||||
@@ -2188,16 +2188,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser": {
|
||||
"version": "8.35.1",
|
||||
"resolved": "https://registry.npmmirror.com/@typescript-eslint/parser/-/parser-8.35.1.tgz",
|
||||
"integrity": "sha512-3MyiDfrfLeK06bi/g9DqJxP5pV74LNv4rFTyvGDmT3x2p1yp1lOd+qYZfiRPIOf/oON+WRZR5wxxuF85qOar+w==",
|
||||
"version": "8.36.0",
|
||||
"resolved": "https://registry.npmmirror.com/@typescript-eslint/parser/-/parser-8.36.0.tgz",
|
||||
"integrity": "sha512-FuYgkHwZLuPbZjQHzJXrtXreJdFMKl16BFYyRrLxDhWr6Qr7Kbcu2s1Yhu8tsiMXw1S0W1pjfFfYEt+R604s+Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "8.35.1",
|
||||
"@typescript-eslint/types": "8.35.1",
|
||||
"@typescript-eslint/typescript-estree": "8.35.1",
|
||||
"@typescript-eslint/visitor-keys": "8.35.1",
|
||||
"@typescript-eslint/scope-manager": "8.36.0",
|
||||
"@typescript-eslint/types": "8.36.0",
|
||||
"@typescript-eslint/typescript-estree": "8.36.0",
|
||||
"@typescript-eslint/visitor-keys": "8.36.0",
|
||||
"debug": "^4.3.4"
|
||||
},
|
||||
"engines": {
|
||||
@@ -2213,14 +2213,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/project-service": {
|
||||
"version": "8.35.1",
|
||||
"resolved": "https://registry.npmmirror.com/@typescript-eslint/project-service/-/project-service-8.35.1.tgz",
|
||||
"integrity": "sha512-VYxn/5LOpVxADAuP3NrnxxHYfzVtQzLKeldIhDhzC8UHaiQvYlXvKuVho1qLduFbJjjy5U5bkGwa3rUGUb1Q6Q==",
|
||||
"version": "8.36.0",
|
||||
"resolved": "https://registry.npmmirror.com/@typescript-eslint/project-service/-/project-service-8.36.0.tgz",
|
||||
"integrity": "sha512-JAhQFIABkWccQYeLMrHadu/fhpzmSQ1F1KXkpzqiVxA/iYI6UnRt2trqXHt1sYEcw1mxLnB9rKMsOxXPxowN/g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/tsconfig-utils": "^8.35.1",
|
||||
"@typescript-eslint/types": "^8.35.1",
|
||||
"@typescript-eslint/tsconfig-utils": "^8.36.0",
|
||||
"@typescript-eslint/types": "^8.36.0",
|
||||
"debug": "^4.3.4"
|
||||
},
|
||||
"engines": {
|
||||
@@ -2235,14 +2235,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/scope-manager": {
|
||||
"version": "8.35.1",
|
||||
"resolved": "https://registry.npmmirror.com/@typescript-eslint/scope-manager/-/scope-manager-8.35.1.tgz",
|
||||
"integrity": "sha512-s/Bpd4i7ht2934nG+UoSPlYXd08KYz3bmjLEb7Ye1UVob0d1ENiT3lY8bsCmik4RqfSbPw9xJJHbugpPpP5JUg==",
|
||||
"version": "8.36.0",
|
||||
"resolved": "https://registry.npmmirror.com/@typescript-eslint/scope-manager/-/scope-manager-8.36.0.tgz",
|
||||
"integrity": "sha512-wCnapIKnDkN62fYtTGv2+RY8FlnBYA3tNm0fm91kc2BjPhV2vIjwwozJ7LToaLAyb1ca8BxrS7vT+Pvvf7RvqA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "8.35.1",
|
||||
"@typescript-eslint/visitor-keys": "8.35.1"
|
||||
"@typescript-eslint/types": "8.36.0",
|
||||
"@typescript-eslint/visitor-keys": "8.36.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
@@ -2253,9 +2253,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/tsconfig-utils": {
|
||||
"version": "8.35.1",
|
||||
"resolved": "https://registry.npmmirror.com/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.35.1.tgz",
|
||||
"integrity": "sha512-K5/U9VmT9dTHoNowWZpz+/TObS3xqC5h0xAIjXPw+MNcKV9qg6eSatEnmeAwkjHijhACH0/N7bkhKvbt1+DXWQ==",
|
||||
"version": "8.36.0",
|
||||
"resolved": "https://registry.npmmirror.com/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.36.0.tgz",
|
||||
"integrity": "sha512-Nhh3TIEgN18mNbdXpd5Q8mSCBnrZQeY9V7Ca3dqYvNDStNIGRmJA6dmrIPMJ0kow3C7gcQbpsG2rPzy1Ks/AnA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
@@ -2270,14 +2270,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/type-utils": {
|
||||
"version": "8.35.1",
|
||||
"resolved": "https://registry.npmmirror.com/@typescript-eslint/type-utils/-/type-utils-8.35.1.tgz",
|
||||
"integrity": "sha512-HOrUBlfVRz5W2LIKpXzZoy6VTZzMu2n8q9C2V/cFngIC5U1nStJgv0tMV4sZPzdf4wQm9/ToWUFPMN9Vq9VJQQ==",
|
||||
"version": "8.36.0",
|
||||
"resolved": "https://registry.npmmirror.com/@typescript-eslint/type-utils/-/type-utils-8.36.0.tgz",
|
||||
"integrity": "sha512-5aaGYG8cVDd6cxfk/ynpYzxBRZJk7w/ymto6uiyUFtdCozQIsQWh7M28/6r57Fwkbweng8qAzoMCPwSJfWlmsg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/typescript-estree": "8.35.1",
|
||||
"@typescript-eslint/utils": "8.35.1",
|
||||
"@typescript-eslint/typescript-estree": "8.36.0",
|
||||
"@typescript-eslint/utils": "8.36.0",
|
||||
"debug": "^4.3.4",
|
||||
"ts-api-utils": "^2.1.0"
|
||||
},
|
||||
@@ -2294,9 +2294,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/types": {
|
||||
"version": "8.35.1",
|
||||
"resolved": "https://registry.npmmirror.com/@typescript-eslint/types/-/types-8.35.1.tgz",
|
||||
"integrity": "sha512-q/O04vVnKHfrrhNAscndAn1tuQhIkwqnaW+eu5waD5IPts2eX1dgJxgqcPx5BX109/qAz7IG6VrEPTOYKCNfRQ==",
|
||||
"version": "8.36.0",
|
||||
"resolved": "https://registry.npmmirror.com/@typescript-eslint/types/-/types-8.36.0.tgz",
|
||||
"integrity": "sha512-xGms6l5cTJKQPZOKM75Dl9yBfNdGeLRsIyufewnxT4vZTrjC0ImQT4fj8QmtJK84F58uSh5HVBSANwcfiXxABQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
@@ -2308,16 +2308,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/typescript-estree": {
|
||||
"version": "8.35.1",
|
||||
"resolved": "https://registry.npmmirror.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.35.1.tgz",
|
||||
"integrity": "sha512-Vvpuvj4tBxIka7cPs6Y1uvM7gJgdF5Uu9F+mBJBPY4MhvjrjWGK4H0lVgLJd/8PWZ23FTqsaJaLEkBCFUk8Y9g==",
|
||||
"version": "8.36.0",
|
||||
"resolved": "https://registry.npmmirror.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.36.0.tgz",
|
||||
"integrity": "sha512-JaS8bDVrfVJX4av0jLpe4ye0BpAaUW7+tnS4Y4ETa3q7NoZgzYbN9zDQTJ8kPb5fQ4n0hliAt9tA4Pfs2zA2Hg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/project-service": "8.35.1",
|
||||
"@typescript-eslint/tsconfig-utils": "8.35.1",
|
||||
"@typescript-eslint/types": "8.35.1",
|
||||
"@typescript-eslint/visitor-keys": "8.35.1",
|
||||
"@typescript-eslint/project-service": "8.36.0",
|
||||
"@typescript-eslint/tsconfig-utils": "8.36.0",
|
||||
"@typescript-eslint/types": "8.36.0",
|
||||
"@typescript-eslint/visitor-keys": "8.36.0",
|
||||
"debug": "^4.3.4",
|
||||
"fast-glob": "^3.3.2",
|
||||
"is-glob": "^4.0.3",
|
||||
@@ -2363,16 +2363,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/utils": {
|
||||
"version": "8.35.1",
|
||||
"resolved": "https://registry.npmmirror.com/@typescript-eslint/utils/-/utils-8.35.1.tgz",
|
||||
"integrity": "sha512-lhnwatFmOFcazAsUm3ZnZFpXSxiwoa1Lj50HphnDe1Et01NF4+hrdXONSUHIcbVu2eFb1bAf+5yjXkGVkXBKAQ==",
|
||||
"version": "8.36.0",
|
||||
"resolved": "https://registry.npmmirror.com/@typescript-eslint/utils/-/utils-8.36.0.tgz",
|
||||
"integrity": "sha512-VOqmHu42aEMT+P2qYjylw6zP/3E/HvptRwdn/PZxyV27KhZg2IOszXod4NcXisWzPAGSS4trE/g4moNj6XmH2g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.7.0",
|
||||
"@typescript-eslint/scope-manager": "8.35.1",
|
||||
"@typescript-eslint/types": "8.35.1",
|
||||
"@typescript-eslint/typescript-estree": "8.35.1"
|
||||
"@typescript-eslint/scope-manager": "8.36.0",
|
||||
"@typescript-eslint/types": "8.36.0",
|
||||
"@typescript-eslint/typescript-estree": "8.36.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
@@ -2387,13 +2387,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/visitor-keys": {
|
||||
"version": "8.35.1",
|
||||
"resolved": "https://registry.npmmirror.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.35.1.tgz",
|
||||
"integrity": "sha512-VRwixir4zBWCSTP/ljEo091lbpypz57PoeAQ9imjG+vbeof9LplljsL1mos4ccG6H9IjfrVGM359RozUnuFhpw==",
|
||||
"version": "8.36.0",
|
||||
"resolved": "https://registry.npmmirror.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.36.0.tgz",
|
||||
"integrity": "sha512-vZrhV2lRPWDuGoxcmrzRZyxAggPL+qp3WzUrlZD+slFueDiYHxeBa34dUXPuC0RmGKzl4lS5kFJYvKCq9cnNDA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "8.35.1",
|
||||
"@typescript-eslint/types": "8.36.0",
|
||||
"eslint-visitor-keys": "^4.2.1"
|
||||
},
|
||||
"engines": {
|
||||
@@ -4816,15 +4816,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/typescript-eslint": {
|
||||
"version": "8.35.1",
|
||||
"resolved": "https://registry.npmmirror.com/typescript-eslint/-/typescript-eslint-8.35.1.tgz",
|
||||
"integrity": "sha512-xslJjFzhOmHYQzSB/QTeASAHbjmxOGEP6Coh93TXmUBFQoJ1VU35UHIDmG06Jd6taf3wqqC1ntBnCMeymy5Ovw==",
|
||||
"version": "8.36.0",
|
||||
"resolved": "https://registry.npmmirror.com/typescript-eslint/-/typescript-eslint-8.36.0.tgz",
|
||||
"integrity": "sha512-fTCqxthY+h9QbEgSIBfL9iV6CvKDFuoxg6bHPNpJ9HIUzS+jy2lCEyCmGyZRWEBSaykqcDPf1SJ+BfCI8DRopA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "8.35.1",
|
||||
"@typescript-eslint/parser": "8.35.1",
|
||||
"@typescript-eslint/utils": "8.35.1"
|
||||
"@typescript-eslint/eslint-plugin": "8.36.0",
|
||||
"@typescript-eslint/parser": "8.36.0",
|
||||
"@typescript-eslint/utils": "8.36.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
@@ -5124,9 +5124,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "7.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/vite/-/vite-7.0.2.tgz",
|
||||
"integrity": "sha512-hxdyZDY1CM6SNpKI4w4lcUc3Mtkd9ej4ECWVHSMrOdSinVc2zYOAppHeGc/hzmRo3pxM5blMzkuWHOJA/3NiFw==",
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmmirror.com/vite/-/vite-7.0.3.tgz",
|
||||
"integrity": "sha512-y2L5oJZF7bj4c0jgGYgBNSdIu+5HF+m68rn2cQXFbGoShdhV1phX9rbnxy9YXj82aS8MMsCLAAFkRxZeWdldrQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
@@ -64,7 +64,7 @@
|
||||
"@eslint/js": "^9.30.1",
|
||||
"@lezer/generator": "^1.8.0",
|
||||
"@types/lodash": "^4.17.20",
|
||||
"@types/node": "^24.0.10",
|
||||
"@types/node": "^24.0.12",
|
||||
"@types/remarkable": "^2.0.8",
|
||||
"@vitejs/plugin-vue": "^6.0.0",
|
||||
"@wailsio/runtime": "latest",
|
||||
@@ -72,9 +72,9 @@
|
||||
"eslint-plugin-vue": "^10.3.0",
|
||||
"globals": "^16.3.0",
|
||||
"typescript": "^5.8.3",
|
||||
"typescript-eslint": "^8.35.1",
|
||||
"typescript-eslint": "^8.36.0",
|
||||
"unplugin-vue-components": "^28.8.0",
|
||||
"vite": "^7.0.2",
|
||||
"vite": "^7.0.3",
|
||||
"vue-eslint-parser": "^10.2.0",
|
||||
"vue-tsc": "^3.0.1"
|
||||
}
|
||||
|
10
go.mod
10
go.mod
@@ -10,11 +10,10 @@ require (
|
||||
github.com/knadh/koanf/providers/structs v1.0.0
|
||||
github.com/knadh/koanf/v2 v2.2.1
|
||||
github.com/robertkrimen/otto v0.5.1
|
||||
github.com/wailsapp/wails/v3 v3.0.0-alpha.9
|
||||
github.com/wailsapp/wails/v3 v3.0.0-alpha.10
|
||||
golang.org/x/net v0.41.0
|
||||
golang.org/x/sys v0.33.0
|
||||
golang.org/x/text v0.26.0
|
||||
modernc.org/sqlite v1.38.0
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -54,14 +53,14 @@ require (
|
||||
github.com/leaanthony/go-ansi-parser v1.6.1 // indirect
|
||||
github.com/leaanthony/u v1.1.1 // indirect
|
||||
github.com/lmittmann/tint v1.1.2 // indirect
|
||||
github.com/matryer/is v1.4.1 // indirect
|
||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mitchellh/copystructure v1.2.0 // indirect
|
||||
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
||||
github.com/ncruces/go-strftime v0.1.9 // indirect
|
||||
github.com/pjbgf/sha1cd v0.3.2 // indirect
|
||||
github.com/pjbgf/sha1cd v0.4.0 // indirect
|
||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||
github.com/rivo/uniseg v0.4.7 // indirect
|
||||
github.com/samber/lo v1.51.0 // indirect
|
||||
@@ -80,7 +79,8 @@ require (
|
||||
gopkg.in/sourcemap.v1 v1.0.5 // indirect
|
||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
modernc.org/libc v1.66.2 // indirect
|
||||
modernc.org/libc v1.66.3 // indirect
|
||||
modernc.org/mathutil v1.7.1 // indirect
|
||||
modernc.org/memory v1.11.0 // indirect
|
||||
modernc.org/sqlite v1.38.0 // indirect
|
||||
)
|
||||
|
16
go.sum
16
go.sum
@@ -129,8 +129,8 @@ github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdh
|
||||
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
|
||||
github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
|
||||
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
|
||||
github.com/pjbgf/sha1cd v0.3.2 h1:a9wb0bp1oC2TGwStyn0Umc/IGKQnEgF0vVaZ8QF8eo4=
|
||||
github.com/pjbgf/sha1cd v0.3.2/go.mod h1:zQWigSxVmsHEZow5qaLtPYxpcKMMQpa09ixqBxuCS6A=
|
||||
github.com/pjbgf/sha1cd v0.4.0 h1:NXzbL1RvjTUi6kgYZCX3fPwwl27Q1LJndxtUDVfJGRY=
|
||||
github.com/pjbgf/sha1cd v0.4.0/go.mod h1:zQWigSxVmsHEZow5qaLtPYxpcKMMQpa09ixqBxuCS6A=
|
||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
|
||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
@@ -164,8 +164,8 @@ github.com/wailsapp/go-webview2 v1.0.21 h1:k3dtoZU4KCoN/AEIbWiPln3P2661GtA2oEgA2
|
||||
github.com/wailsapp/go-webview2 v1.0.21/go.mod h1:qJmWAmAmaniuKGZPWwne+uor3AHMB5PFhqiK0Bbj8kc=
|
||||
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
|
||||
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
|
||||
github.com/wailsapp/wails/v3 v3.0.0-alpha.9 h1:b8CfRrhPno8Fra0xFp4Ifyj+ogmXBc35rsQWvcrHtsI=
|
||||
github.com/wailsapp/wails/v3 v3.0.0-alpha.9/go.mod h1:dSv6s722nSWaUyUiapAM1DHc5HKggNGY1a79shO85/g=
|
||||
github.com/wailsapp/wails/v3 v3.0.0-alpha.10 h1:SrxwhkBcdtaSxQ/zujJuifJN5q8hxyba5UKv5oaM/X4=
|
||||
github.com/wailsapp/wails/v3 v3.0.0-alpha.10/go.mod h1:4LCCW7s9e4PuSmu7l9OTvfWIGMO8TaSiftSeR5NpBIc=
|
||||
github.com/xanzy/go-gitlab v0.115.0 h1:6DmtItNcVe+At/liXSgfE/DZNZrGfalQmBRmOcJjOn8=
|
||||
github.com/xanzy/go-gitlab v0.115.0/go.mod h1:5XCDtM7AM6WMKmfDdOiEpyRWUqui2iS9ILfvCZ2gJ5M=
|
||||
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
|
||||
@@ -242,10 +242,10 @@ modernc.org/fileutil v1.3.8 h1:qtzNm7ED75pd1C7WgAGcK4edm4fvhtBsEiI/0NQ54YM=
|
||||
modernc.org/fileutil v1.3.8/go.mod h1:HxmghZSZVAz/LXcMNwZPA/DRrQZEVP9VX0V4LQGQFOc=
|
||||
modernc.org/gc/v2 v2.6.5 h1:nyqdV8q46KvTpZlsw66kWqwXRHdjIlJOhG6kxiV/9xI=
|
||||
modernc.org/gc/v2 v2.6.5/go.mod h1:YgIahr1ypgfe7chRuJi2gD7DBQiKSLMPgBQe9oIiito=
|
||||
modernc.org/goabi0 v0.1.2 h1:9mfG19tFBypPnlSKRAjI5nXGMLmVy+jLyKNVKsMzt/8=
|
||||
modernc.org/goabi0 v0.1.2/go.mod h1:CEFRnnJhKvWT1c1JTI3Avm+tgOWbkOu5oPA8eH8LnMI=
|
||||
modernc.org/libc v1.66.2 h1:JCBxlJzZOIwZY54fzjHN3Wsn8Ty5PUTPr/xioRkmecI=
|
||||
modernc.org/libc v1.66.2/go.mod h1:ceIGzvXxP+JV3pgVjP9avPZo6Chlsfof2egXBH3YT5Q=
|
||||
modernc.org/goabi0 v0.2.0 h1:HvEowk7LxcPd0eq6mVOAEMai46V+i7Jrj13t4AzuNks=
|
||||
modernc.org/goabi0 v0.2.0/go.mod h1:CEFRnnJhKvWT1c1JTI3Avm+tgOWbkOu5oPA8eH8LnMI=
|
||||
modernc.org/libc v1.66.3 h1:cfCbjTUcdsKyyZZfEUKfoHcP3S0Wkvz3jgSzByEWVCQ=
|
||||
modernc.org/libc v1.66.3/go.mod h1:XD9zO8kt59cANKvHPXpx7yS2ELPheAey0vjIuZOhOU8=
|
||||
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
|
||||
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
|
||||
modernc.org/memory v1.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI=
|
||||
|
@@ -38,7 +38,7 @@ type Migratable interface {
|
||||
|
||||
// ConfigMigrationService 配置迁移服务
|
||||
type ConfigMigrationService[T Migratable] struct {
|
||||
logger *log.LoggerService
|
||||
logger *log.Service
|
||||
configDir string
|
||||
configName string
|
||||
targetVersion string
|
||||
@@ -54,7 +54,7 @@ type MigrationResult struct {
|
||||
|
||||
// NewConfigMigrationService 创建配置迁移服务
|
||||
func NewConfigMigrationService[T Migratable](
|
||||
logger *log.LoggerService,
|
||||
logger *log.Service,
|
||||
configDir string,
|
||||
configName, targetVersion, configPath string,
|
||||
) *ConfigMigrationService[T] {
|
||||
@@ -312,7 +312,7 @@ func chainLoad(k *koanf.Koanf, loaders ...func() error) error {
|
||||
}
|
||||
|
||||
// 工厂函数
|
||||
func NewAppConfigMigrationService(logger *log.LoggerService, configDir, settingsPath string) *ConfigMigrationService[*models.AppConfig] {
|
||||
func NewAppConfigMigrationService(logger *log.Service, configDir, settingsPath string) *ConfigMigrationService[*models.AppConfig] {
|
||||
return NewConfigMigrationService[*models.AppConfig](
|
||||
logger, configDir, "settings", CurrentAppConfigVersion, settingsPath)
|
||||
}
|
||||
|
@@ -49,7 +49,7 @@ type ConfigListener struct {
|
||||
type ConfigNotificationService struct {
|
||||
listeners map[ConfigChangeType][]*ConfigListener // 支持多监听器的map
|
||||
mu sync.RWMutex // 监听器map的读写锁
|
||||
logger *log.LoggerService // 日志服务
|
||||
logger *log.Service // 日志服务
|
||||
koanf *koanf.Koanf // koanf实例
|
||||
ctx context.Context
|
||||
cancel context.CancelFunc
|
||||
@@ -57,7 +57,7 @@ type ConfigNotificationService struct {
|
||||
}
|
||||
|
||||
// NewConfigNotificationService 创建配置通知服务
|
||||
func NewConfigNotificationService(k *koanf.Koanf, logger *log.LoggerService) *ConfigNotificationService {
|
||||
func NewConfigNotificationService(k *koanf.Koanf, logger *log.Service) *ConfigNotificationService {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
return &ConfigNotificationService{
|
||||
listeners: make(map[ConfigChangeType][]*ConfigListener),
|
||||
@@ -445,8 +445,8 @@ func CreateDataPathListener(name string, callback func() error) *ConfigListener
|
||||
}
|
||||
}
|
||||
|
||||
// OnShutdown 关闭服务
|
||||
func (cns *ConfigNotificationService) OnShutdown() error {
|
||||
// ServiceShutdown 关闭服务
|
||||
func (cns *ConfigNotificationService) ServiceShutdown() error {
|
||||
cns.Cleanup()
|
||||
return nil
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@ import (
|
||||
// ConfigService 应用配置服务
|
||||
type ConfigService struct {
|
||||
koanf *koanf.Koanf // koanf 实例
|
||||
logger *log.LoggerService // 日志服务
|
||||
logger *log.Service // 日志服务
|
||||
configDir string // 配置目录
|
||||
settingsPath string // 设置文件路径
|
||||
mu sync.RWMutex // 读写锁
|
||||
@@ -55,7 +55,7 @@ func (e *ConfigError) Is(target error) bool {
|
||||
}
|
||||
|
||||
// NewConfigService 创建新的配置服务实例
|
||||
func NewConfigService(logger *log.LoggerService) *ConfigService {
|
||||
func NewConfigService(logger *log.Service) *ConfigService {
|
||||
// 获取用户主目录
|
||||
homeDir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
@@ -298,8 +298,8 @@ func (cs *ConfigService) SetDataPathChangeCallback(callback func() error) error
|
||||
return cs.notificationService.RegisterListener(dataPathListener)
|
||||
}
|
||||
|
||||
// OnShutdown 关闭服务
|
||||
func (cs *ConfigService) OnShutdown() error {
|
||||
// ServiceShutdown 关闭服务
|
||||
func (cs *ConfigService) ServiceShutdown() error {
|
||||
cs.stopWatching()
|
||||
if cs.notificationService != nil {
|
||||
cs.notificationService.Cleanup()
|
||||
|
@@ -2,7 +2,6 @@ package services
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -10,7 +9,7 @@ import (
|
||||
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
"github.com/wailsapp/wails/v3/pkg/services/log"
|
||||
_ "modernc.org/sqlite" // SQLite driver
|
||||
"github.com/wailsapp/wails/v3/pkg/services/sqlite"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -64,14 +63,14 @@ CREATE TABLE IF NOT EXISTS key_bindings (
|
||||
// DatabaseService provides shared database functionality
|
||||
type DatabaseService struct {
|
||||
configService *ConfigService
|
||||
logger *log.LoggerService
|
||||
db *sql.DB
|
||||
logger *log.Service
|
||||
SQLite *sqlite.Service
|
||||
mu sync.RWMutex
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
// NewDatabaseService creates a new database service
|
||||
func NewDatabaseService(configService *ConfigService, logger *log.LoggerService) *DatabaseService {
|
||||
func NewDatabaseService(configService *ConfigService, logger *log.Service) *DatabaseService {
|
||||
if logger == nil {
|
||||
logger = log.New()
|
||||
}
|
||||
@@ -79,11 +78,12 @@ func NewDatabaseService(configService *ConfigService, logger *log.LoggerService)
|
||||
return &DatabaseService{
|
||||
configService: configService,
|
||||
logger: logger,
|
||||
SQLite: sqlite.New(),
|
||||
}
|
||||
}
|
||||
|
||||
// OnStartup initializes the service when the application starts
|
||||
func (ds *DatabaseService) OnStartup(ctx context.Context, _ application.ServiceOptions) error {
|
||||
// ServiceStartup initializes the service when the application starts
|
||||
func (ds *DatabaseService) ServiceStartup(ctx context.Context, options application.ServiceOptions) error {
|
||||
ds.ctx = ctx
|
||||
return ds.initDatabase()
|
||||
}
|
||||
@@ -111,24 +111,26 @@ func (ds *DatabaseService) initDatabase() error {
|
||||
file.Close()
|
||||
}
|
||||
|
||||
db, err := sql.Open("sqlite", dbPath)
|
||||
if err != nil {
|
||||
// 配置SQLite服务
|
||||
ds.SQLite.Configure(&sqlite.Config{
|
||||
DBSource: dbPath,
|
||||
})
|
||||
|
||||
// 打开数据库连接
|
||||
if err := ds.SQLite.Open(); err != nil {
|
||||
return fmt.Errorf("failed to open database: %w", err)
|
||||
}
|
||||
|
||||
ds.db = db
|
||||
|
||||
// Apply optimization settings
|
||||
if _, err := db.Exec(sqlOptimizationSettings); err != nil {
|
||||
// 应用性能优化设置
|
||||
if err := ds.SQLite.Execute(sqlOptimizationSettings); err != nil {
|
||||
return fmt.Errorf("failed to apply optimization settings: %w", err)
|
||||
}
|
||||
|
||||
// Create all tables
|
||||
// 创建表和索引
|
||||
if err := ds.createTables(); err != nil {
|
||||
return fmt.Errorf("failed to create tables: %w", err)
|
||||
}
|
||||
|
||||
// Create indexes
|
||||
if err := ds.createIndexes(); err != nil {
|
||||
return fmt.Errorf("failed to create indexes: %w", err)
|
||||
}
|
||||
@@ -154,7 +156,7 @@ func (ds *DatabaseService) createTables() error {
|
||||
}
|
||||
|
||||
for _, table := range tables {
|
||||
if _, err := ds.db.Exec(table); err != nil {
|
||||
if err := ds.SQLite.Execute(table); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -177,35 +179,25 @@ func (ds *DatabaseService) createIndexes() error {
|
||||
}
|
||||
|
||||
for _, index := range indexes {
|
||||
if _, err := ds.db.Exec(index); err != nil {
|
||||
if err := ds.SQLite.Execute(index); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetDB returns the database connection
|
||||
func (ds *DatabaseService) GetDB() *sql.DB {
|
||||
ds.mu.RLock()
|
||||
defer ds.mu.RUnlock()
|
||||
return ds.db
|
||||
}
|
||||
|
||||
// OnShutdown shuts down the service when the application closes
|
||||
func (ds *DatabaseService) OnShutdown() error {
|
||||
if ds.db != nil {
|
||||
return ds.db.Close()
|
||||
}
|
||||
return nil
|
||||
// ServiceShutdown shuts down the service when the application closes
|
||||
func (ds *DatabaseService) ServiceShutdown() error {
|
||||
return ds.SQLite.Close()
|
||||
}
|
||||
|
||||
// OnDataPathChanged handles data path changes
|
||||
func (ds *DatabaseService) OnDataPathChanged() error {
|
||||
// Close existing database
|
||||
if ds.db != nil {
|
||||
ds.db.Close()
|
||||
// 关闭当前连接
|
||||
if err := ds.SQLite.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Reinitialize with new path
|
||||
// 用新路径重新初始化
|
||||
return ds.initDatabase()
|
||||
}
|
||||
|
@@ -7,12 +7,12 @@ import (
|
||||
|
||||
// DialogService 对话框服务,处理文件选择等对话框操作
|
||||
type DialogService struct {
|
||||
logger *log.LoggerService
|
||||
logger *log.Service
|
||||
window *application.WebviewWindow // 绑定的窗口
|
||||
}
|
||||
|
||||
// NewDialogService 创建新的对话框服务实例
|
||||
func NewDialogService(logger *log.LoggerService) *DialogService {
|
||||
func NewDialogService(logger *log.Service) *DialogService {
|
||||
if logger == nil {
|
||||
logger = log.New()
|
||||
}
|
||||
@@ -30,7 +30,8 @@ func (ds *DialogService) SetWindow(window *application.WebviewWindow) {
|
||||
|
||||
// SelectDirectory 打开目录选择对话框
|
||||
func (ds *DialogService) SelectDirectory() (string, error) {
|
||||
dialog := application.OpenFileDialogWithOptions(&application.OpenFileDialogOptions{
|
||||
dialog := application.OpenFileDialog()
|
||||
dialog.SetOptions(&application.OpenFileDialogOptions{
|
||||
// 目录选择配置
|
||||
CanChooseDirectories: true, // 允许选择目录
|
||||
CanChooseFiles: false, // 不允许选择文件
|
||||
|
@@ -11,7 +11,6 @@ import (
|
||||
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
"github.com/wailsapp/wails/v3/pkg/services/log"
|
||||
_ "modernc.org/sqlite" // SQLite driver
|
||||
)
|
||||
|
||||
// SQL constants for document operations
|
||||
@@ -70,13 +69,13 @@ SELECT id FROM documents WHERE is_deleted = 0 ORDER BY id LIMIT 1`
|
||||
// DocumentService provides document management functionality
|
||||
type DocumentService struct {
|
||||
databaseService *DatabaseService
|
||||
logger *log.LoggerService
|
||||
logger *log.Service
|
||||
mu sync.RWMutex
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
// NewDocumentService creates a new document service
|
||||
func NewDocumentService(databaseService *DatabaseService, logger *log.LoggerService) *DocumentService {
|
||||
func NewDocumentService(databaseService *DatabaseService, logger *log.Service) *DocumentService {
|
||||
if logger == nil {
|
||||
logger = log.New()
|
||||
}
|
||||
@@ -87,8 +86,8 @@ func NewDocumentService(databaseService *DatabaseService, logger *log.LoggerServ
|
||||
}
|
||||
}
|
||||
|
||||
// OnStartup initializes the service when the application starts
|
||||
func (ds *DocumentService) OnStartup(ctx context.Context, _ application.ServiceOptions) error {
|
||||
// ServiceStartup initializes the service when the application starts
|
||||
func (ds *DocumentService) ServiceStartup(ctx context.Context, options application.ServiceOptions) error {
|
||||
ds.ctx = ctx
|
||||
// Ensure default document exists
|
||||
if err := ds.ensureDefaultDocument(); err != nil {
|
||||
@@ -100,13 +99,20 @@ func (ds *DocumentService) OnStartup(ctx context.Context, _ application.ServiceO
|
||||
// ensureDefaultDocument ensures a default document exists
|
||||
func (ds *DocumentService) ensureDefaultDocument() error {
|
||||
// Check if any document exists
|
||||
var count int
|
||||
db := ds.databaseService.GetDB()
|
||||
err := db.QueryRow(sqlCountDocuments).Scan(&count)
|
||||
rows, err := ds.databaseService.SQLite.Query(sqlCountDocuments)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(rows) == 0 {
|
||||
return fmt.Errorf("failed to query document count")
|
||||
}
|
||||
|
||||
count, ok := rows[0]["COUNT(*)"].(int64)
|
||||
if !ok {
|
||||
return fmt.Errorf("failed to convert count to int64")
|
||||
}
|
||||
|
||||
// If no documents exist, create default document
|
||||
if count == 0 {
|
||||
defaultDoc := models.NewDefaultDocument()
|
||||
@@ -121,20 +127,50 @@ func (ds *DocumentService) GetDocumentByID(id int64) (*models.Document, error) {
|
||||
ds.mu.RLock()
|
||||
defer ds.mu.RUnlock()
|
||||
|
||||
var doc models.Document
|
||||
var isDeletedInt int
|
||||
db := ds.databaseService.GetDB()
|
||||
row := db.QueryRow(sqlGetDocumentByID, id)
|
||||
err := row.Scan(&doc.ID, &doc.Title, &doc.Content, &doc.CreatedAt, &doc.UpdatedAt, &isDeletedInt)
|
||||
rows, err := ds.databaseService.SQLite.Query(sqlGetDocumentByID, id)
|
||||
if err != nil {
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
return nil, nil
|
||||
}
|
||||
return nil, fmt.Errorf("failed to get document by ID: %w", err)
|
||||
}
|
||||
doc.IsDeleted = isDeletedInt == 1
|
||||
|
||||
return &doc, nil
|
||||
if len(rows) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
row := rows[0]
|
||||
doc := &models.Document{}
|
||||
|
||||
// 从Row中提取数据
|
||||
if idVal, ok := row["id"].(int64); ok {
|
||||
doc.ID = idVal
|
||||
}
|
||||
|
||||
if title, ok := row["title"].(string); ok {
|
||||
doc.Title = title
|
||||
}
|
||||
|
||||
if content, ok := row["content"].(string); ok {
|
||||
doc.Content = content
|
||||
}
|
||||
|
||||
if createdAt, ok := row["created_at"].(string); ok {
|
||||
t, err := time.Parse("2006-01-02 15:04:05", createdAt)
|
||||
if err == nil {
|
||||
doc.CreatedAt = t
|
||||
}
|
||||
}
|
||||
|
||||
if updatedAt, ok := row["updated_at"].(string); ok {
|
||||
t, err := time.Parse("2006-01-02 15:04:05", updatedAt)
|
||||
if err == nil {
|
||||
doc.UpdatedAt = t
|
||||
}
|
||||
}
|
||||
|
||||
if isDeletedInt, ok := row["is_deleted"].(int64); ok {
|
||||
doc.IsDeleted = isDeletedInt == 1
|
||||
}
|
||||
|
||||
return doc, nil
|
||||
}
|
||||
|
||||
// CreateDocument creates a new document and returns the created document with ID
|
||||
@@ -152,20 +188,30 @@ func (ds *DocumentService) CreateDocument(title string) (*models.Document, error
|
||||
IsDeleted: false,
|
||||
}
|
||||
|
||||
db := ds.databaseService.GetDB()
|
||||
result, err := db.Exec(sqlInsertDocument, doc.Title, doc.Content, doc.CreatedAt, doc.UpdatedAt)
|
||||
if err != nil {
|
||||
// 执行插入操作
|
||||
if err := ds.databaseService.SQLite.Execute(sqlInsertDocument,
|
||||
doc.Title, doc.Content, doc.CreatedAt, doc.UpdatedAt); err != nil {
|
||||
return nil, fmt.Errorf("failed to create document: %w", err)
|
||||
}
|
||||
|
||||
// Get the auto-generated ID
|
||||
id, err := result.LastInsertId()
|
||||
// 获取自增ID
|
||||
lastIDRows, err := ds.databaseService.SQLite.Query("SELECT last_insert_rowid()")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get last insert ID: %w", err)
|
||||
}
|
||||
|
||||
// Return the created document with ID
|
||||
doc.ID = id
|
||||
if len(lastIDRows) == 0 {
|
||||
return nil, fmt.Errorf("no rows returned for last insert ID query")
|
||||
}
|
||||
|
||||
// 从结果中提取ID
|
||||
lastID, ok := lastIDRows[0]["last_insert_rowid()"].(int64)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("failed to convert last insert ID to int64")
|
||||
}
|
||||
|
||||
// 返回带ID的文档
|
||||
doc.ID = lastID
|
||||
return doc, nil
|
||||
}
|
||||
|
||||
@@ -174,8 +220,7 @@ func (ds *DocumentService) UpdateDocumentContent(id int64, content string) error
|
||||
ds.mu.Lock()
|
||||
defer ds.mu.Unlock()
|
||||
|
||||
db := ds.databaseService.GetDB()
|
||||
_, err := db.Exec(sqlUpdateDocumentContent, content, time.Now(), id)
|
||||
err := ds.databaseService.SQLite.Execute(sqlUpdateDocumentContent, content, time.Now(), id)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to update document content: %w", err)
|
||||
}
|
||||
@@ -187,8 +232,7 @@ func (ds *DocumentService) UpdateDocumentTitle(id int64, title string) error {
|
||||
ds.mu.Lock()
|
||||
defer ds.mu.Unlock()
|
||||
|
||||
db := ds.databaseService.GetDB()
|
||||
_, err := db.Exec(sqlUpdateDocumentTitle, title, time.Now(), id)
|
||||
err := ds.databaseService.SQLite.Execute(sqlUpdateDocumentTitle, title, time.Now(), id)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to update document title: %w", err)
|
||||
}
|
||||
@@ -205,8 +249,7 @@ func (ds *DocumentService) DeleteDocument(id int64) error {
|
||||
return fmt.Errorf("cannot delete the default document")
|
||||
}
|
||||
|
||||
db := ds.databaseService.GetDB()
|
||||
_, err := db.Exec(sqlMarkDocumentAsDeleted, time.Now(), id)
|
||||
err := ds.databaseService.SQLite.Execute(sqlMarkDocumentAsDeleted, time.Now(), id)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to mark document as deleted: %w", err)
|
||||
}
|
||||
@@ -218,8 +261,7 @@ func (ds *DocumentService) RestoreDocument(id int64) error {
|
||||
ds.mu.Lock()
|
||||
defer ds.mu.Unlock()
|
||||
|
||||
db := ds.databaseService.GetDB()
|
||||
_, err := db.Exec(sqlRestoreDocument, time.Now(), id)
|
||||
err := ds.databaseService.SQLite.Execute(sqlRestoreDocument, time.Now(), id)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to restore document: %w", err)
|
||||
}
|
||||
@@ -231,22 +273,38 @@ func (ds *DocumentService) ListAllDocumentsMeta() ([]*models.Document, error) {
|
||||
ds.mu.RLock()
|
||||
defer ds.mu.RUnlock()
|
||||
|
||||
db := ds.databaseService.GetDB()
|
||||
rows, err := db.Query(sqlListAllDocumentsMeta)
|
||||
rows, err := ds.databaseService.SQLite.Query(sqlListAllDocumentsMeta)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to list document meta: %w", err)
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
var documents []*models.Document
|
||||
for rows.Next() {
|
||||
var doc models.Document
|
||||
err := rows.Scan(&doc.ID, &doc.Title, &doc.CreatedAt, &doc.UpdatedAt)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to scan document meta: %w", err)
|
||||
for _, row := range rows {
|
||||
doc := &models.Document{IsDeleted: false}
|
||||
|
||||
if id, ok := row["id"].(int64); ok {
|
||||
doc.ID = id
|
||||
}
|
||||
doc.IsDeleted = false
|
||||
documents = append(documents, &doc)
|
||||
|
||||
if title, ok := row["title"].(string); ok {
|
||||
doc.Title = title
|
||||
}
|
||||
|
||||
if createdAt, ok := row["created_at"].(string); ok {
|
||||
t, err := time.Parse("2006-01-02 15:04:05", createdAt)
|
||||
if err == nil {
|
||||
doc.CreatedAt = t
|
||||
}
|
||||
}
|
||||
|
||||
if updatedAt, ok := row["updated_at"].(string); ok {
|
||||
t, err := time.Parse("2006-01-02 15:04:05", updatedAt)
|
||||
if err == nil {
|
||||
doc.UpdatedAt = t
|
||||
}
|
||||
}
|
||||
|
||||
documents = append(documents, doc)
|
||||
}
|
||||
|
||||
return documents, nil
|
||||
@@ -257,22 +315,38 @@ func (ds *DocumentService) ListDeletedDocumentsMeta() ([]*models.Document, error
|
||||
ds.mu.RLock()
|
||||
defer ds.mu.RUnlock()
|
||||
|
||||
db := ds.databaseService.GetDB()
|
||||
rows, err := db.Query(sqlListDeletedDocumentsMeta)
|
||||
rows, err := ds.databaseService.SQLite.Query(sqlListDeletedDocumentsMeta)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to list deleted document meta: %w", err)
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
var documents []*models.Document
|
||||
for rows.Next() {
|
||||
var doc models.Document
|
||||
err := rows.Scan(&doc.ID, &doc.Title, &doc.CreatedAt, &doc.UpdatedAt)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to scan deleted document meta: %w", err)
|
||||
for _, row := range rows {
|
||||
doc := &models.Document{IsDeleted: true}
|
||||
|
||||
if id, ok := row["id"].(int64); ok {
|
||||
doc.ID = id
|
||||
}
|
||||
doc.IsDeleted = true
|
||||
documents = append(documents, &doc)
|
||||
|
||||
if title, ok := row["title"].(string); ok {
|
||||
doc.Title = title
|
||||
}
|
||||
|
||||
if createdAt, ok := row["created_at"].(string); ok {
|
||||
t, err := time.Parse("2006-01-02 15:04:05", createdAt)
|
||||
if err == nil {
|
||||
doc.CreatedAt = t
|
||||
}
|
||||
}
|
||||
|
||||
if updatedAt, ok := row["updated_at"].(string); ok {
|
||||
t, err := time.Parse("2006-01-02 15:04:05", updatedAt)
|
||||
if err == nil {
|
||||
doc.UpdatedAt = t
|
||||
}
|
||||
}
|
||||
|
||||
documents = append(documents, doc)
|
||||
}
|
||||
|
||||
return documents, nil
|
||||
@@ -283,14 +357,22 @@ func (ds *DocumentService) GetFirstDocumentID() (int64, error) {
|
||||
ds.mu.RLock()
|
||||
defer ds.mu.RUnlock()
|
||||
|
||||
db := ds.databaseService.GetDB()
|
||||
var id int64
|
||||
err := db.QueryRow(sqlGetFirstDocumentID).Scan(&id)
|
||||
rows, err := ds.databaseService.SQLite.Query(sqlGetFirstDocumentID)
|
||||
if err != nil {
|
||||
if err == sql.ErrNoRows {
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
return 0, nil // No documents exist
|
||||
}
|
||||
return 0, fmt.Errorf("failed to get first document ID: %w", err)
|
||||
}
|
||||
|
||||
if len(rows) == 0 {
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
id, ok := rows[0]["id"].(int64)
|
||||
if !ok {
|
||||
return 0, fmt.Errorf("failed to convert ID to int64")
|
||||
}
|
||||
|
||||
return id, nil
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ WHERE id = ?`
|
||||
// ExtensionService 扩展管理服务
|
||||
type ExtensionService struct {
|
||||
databaseService *DatabaseService
|
||||
logger *log.LoggerService
|
||||
logger *log.Service
|
||||
|
||||
mu sync.RWMutex
|
||||
ctx context.Context
|
||||
@@ -73,7 +73,7 @@ func (e *ExtensionError) Is(target error) bool {
|
||||
}
|
||||
|
||||
// NewExtensionService 创建扩展服务实例
|
||||
func NewExtensionService(databaseService *DatabaseService, logger *log.LoggerService) *ExtensionService {
|
||||
func NewExtensionService(databaseService *DatabaseService, logger *log.Service) *ExtensionService {
|
||||
if logger == nil {
|
||||
logger = log.New()
|
||||
}
|
||||
@@ -105,29 +105,26 @@ func (es *ExtensionService) initDatabase() error {
|
||||
defer es.mu.Unlock()
|
||||
|
||||
// 检查是否已有扩展数据
|
||||
db := es.databaseService.GetDB()
|
||||
if db == nil {
|
||||
return &ExtensionError{"get_database", "", fmt.Errorf("database connection is nil")}
|
||||
}
|
||||
|
||||
var count int
|
||||
err := db.QueryRow("SELECT COUNT(*) FROM extensions").Scan(&count)
|
||||
rows, err := es.databaseService.SQLite.Query("SELECT COUNT(*) FROM extensions")
|
||||
if err != nil {
|
||||
return &ExtensionError{"check_extensions_count", "", err}
|
||||
}
|
||||
|
||||
es.logger.Info("Extension database check", "existing_count", count)
|
||||
if len(rows) == 0 {
|
||||
return &ExtensionError{"check_extensions_count", "", fmt.Errorf("no rows returned")}
|
||||
}
|
||||
|
||||
count, ok := rows[0]["COUNT(*)"].(int64)
|
||||
if !ok {
|
||||
return &ExtensionError{"convert_count", "", fmt.Errorf("failed to convert count to int64")}
|
||||
}
|
||||
|
||||
// 如果没有数据,插入默认配置
|
||||
if count == 0 {
|
||||
es.logger.Info("No extensions found, inserting default extensions...")
|
||||
if err := es.insertDefaultExtensions(); err != nil {
|
||||
es.logger.Error("Failed to insert default extensions", "error", err)
|
||||
return err
|
||||
}
|
||||
es.logger.Info("Default extensions inserted successfully")
|
||||
} else {
|
||||
es.logger.Info("Extensions already exist, skipping default insertion")
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -136,21 +133,16 @@ func (es *ExtensionService) initDatabase() error {
|
||||
// insertDefaultExtensions 插入默认扩展配置
|
||||
func (es *ExtensionService) insertDefaultExtensions() error {
|
||||
defaultSettings := models.NewDefaultExtensionSettings()
|
||||
db := es.databaseService.GetDB()
|
||||
now := time.Now()
|
||||
|
||||
es.logger.Info("Starting to insert default extensions", "count", len(defaultSettings.Extensions))
|
||||
|
||||
for i, ext := range defaultSettings.Extensions {
|
||||
es.logger.Info("Inserting extension", "index", i+1, "id", ext.ID, "enabled", ext.Enabled)
|
||||
for _, ext := range defaultSettings.Extensions {
|
||||
|
||||
configJSON, err := json.Marshal(ext.Config)
|
||||
if err != nil {
|
||||
es.logger.Error("Failed to marshal config", "extension", ext.ID, "error", err)
|
||||
return &ExtensionError{"marshal_config", string(ext.ID), err}
|
||||
}
|
||||
|
||||
_, err = db.Exec(sqlInsertExtension,
|
||||
err = es.databaseService.SQLite.Execute(sqlInsertExtension,
|
||||
string(ext.ID),
|
||||
ext.Enabled,
|
||||
ext.IsDefault,
|
||||
@@ -159,31 +151,24 @@ func (es *ExtensionService) insertDefaultExtensions() error {
|
||||
now,
|
||||
)
|
||||
if err != nil {
|
||||
es.logger.Error("Failed to insert extension", "extension", ext.ID, "error", err)
|
||||
return &ExtensionError{"insert_extension", string(ext.ID), err}
|
||||
}
|
||||
|
||||
es.logger.Info("Successfully inserted extension", "id", ext.ID)
|
||||
}
|
||||
|
||||
es.logger.Info("Completed inserting all default extensions")
|
||||
return nil
|
||||
}
|
||||
|
||||
// OnStartup 启动时调用
|
||||
func (es *ExtensionService) OnStartup(ctx context.Context, _ application.ServiceOptions) error {
|
||||
// ServiceStartup 启动时调用
|
||||
func (es *ExtensionService) ServiceStartup(ctx context.Context, options application.ServiceOptions) error {
|
||||
es.ctx = ctx
|
||||
es.logger.Info("Extension service starting up")
|
||||
|
||||
// 初始化数据库
|
||||
var initErr error
|
||||
es.initOnce.Do(func() {
|
||||
es.logger.Info("Initializing extension database...")
|
||||
if err := es.initDatabase(); err != nil {
|
||||
es.logger.Error("failed to initialize extension database", "error", err)
|
||||
initErr = err
|
||||
} else {
|
||||
es.logger.Info("Extension database initialized successfully")
|
||||
}
|
||||
})
|
||||
return initErr
|
||||
@@ -194,28 +179,36 @@ func (es *ExtensionService) GetAllExtensions() ([]models.Extension, error) {
|
||||
es.mu.RLock()
|
||||
defer es.mu.RUnlock()
|
||||
|
||||
db := es.databaseService.GetDB()
|
||||
rows, err := db.Query(sqlGetAllExtensions)
|
||||
rows, err := es.databaseService.SQLite.Query(sqlGetAllExtensions)
|
||||
if err != nil {
|
||||
return nil, &ExtensionError{"query_extensions", "", err}
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
var extensions []models.Extension
|
||||
for rows.Next() {
|
||||
for _, row := range rows {
|
||||
var ext models.Extension
|
||||
var configJSON string
|
||||
if err := rows.Scan(&ext.ID, &ext.Enabled, &ext.IsDefault, &configJSON); err != nil {
|
||||
return nil, &ExtensionError{"scan_extension", "", err}
|
||||
}
|
||||
if err := json.Unmarshal([]byte(configJSON), &ext.Config); err != nil {
|
||||
return nil, &ExtensionError{"unmarshal_config", string(ext.ID), err}
|
||||
}
|
||||
extensions = append(extensions, ext)
|
||||
|
||||
if id, ok := row["id"].(string); ok {
|
||||
ext.ID = models.ExtensionID(id)
|
||||
}
|
||||
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, &ExtensionError{"rows_error", "", err}
|
||||
if enabled, ok := row["enabled"].(int64); ok {
|
||||
ext.Enabled = enabled == 1
|
||||
}
|
||||
|
||||
if isDefault, ok := row["is_default"].(int64); ok {
|
||||
ext.IsDefault = isDefault == 1
|
||||
}
|
||||
|
||||
if configJSON, ok := row["config"].(string); ok {
|
||||
var config models.ExtensionConfig
|
||||
if err := json.Unmarshal([]byte(configJSON), &config); err != nil {
|
||||
return nil, &ExtensionError{"unmarshal_config", string(ext.ID), err}
|
||||
}
|
||||
ext.Config = config
|
||||
}
|
||||
|
||||
extensions = append(extensions, ext)
|
||||
}
|
||||
|
||||
return extensions, nil
|
||||
@@ -231,7 +224,6 @@ func (es *ExtensionService) UpdateExtensionState(id models.ExtensionID, enabled
|
||||
es.mu.Lock()
|
||||
defer es.mu.Unlock()
|
||||
|
||||
db := es.databaseService.GetDB()
|
||||
var configJSON []byte
|
||||
var err error
|
||||
|
||||
@@ -242,20 +234,28 @@ func (es *ExtensionService) UpdateExtensionState(id models.ExtensionID, enabled
|
||||
}
|
||||
} else {
|
||||
// 如果没有提供配置,保持原有配置
|
||||
var currentConfigJSON string
|
||||
err = db.QueryRow("SELECT config FROM extensions WHERE id = ?", string(id)).Scan(¤tConfigJSON)
|
||||
rows, err := es.databaseService.SQLite.Query("SELECT config FROM extensions WHERE id = ?", string(id))
|
||||
if err != nil {
|
||||
return &ExtensionError{"query_current_config", string(id), err}
|
||||
}
|
||||
|
||||
if len(rows) == 0 {
|
||||
return &ExtensionError{"query_current_config", string(id), fmt.Errorf("extension not found")}
|
||||
}
|
||||
|
||||
currentConfigJSON, ok := rows[0]["config"].(string)
|
||||
if !ok {
|
||||
return &ExtensionError{"convert_config", string(id), fmt.Errorf("failed to get current config")}
|
||||
}
|
||||
|
||||
configJSON = []byte(currentConfigJSON)
|
||||
}
|
||||
|
||||
_, err = db.Exec(sqlUpdateExtension, enabled, string(configJSON), time.Now(), string(id))
|
||||
err = es.databaseService.SQLite.Execute(sqlUpdateExtension, enabled, string(configJSON), time.Now(), string(id))
|
||||
if err != nil {
|
||||
return &ExtensionError{"update_extension", string(id), err}
|
||||
}
|
||||
|
||||
es.logger.Info("extension state updated", "id", id, "enabled", enabled)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -277,8 +277,7 @@ func (es *ExtensionService) ResetAllExtensionsToDefault() error {
|
||||
defer es.mu.Unlock()
|
||||
|
||||
// 删除所有现有扩展
|
||||
db := es.databaseService.GetDB()
|
||||
_, err := db.Exec(sqlDeleteAllExtensions)
|
||||
err := es.databaseService.SQLite.Execute(sqlDeleteAllExtensions)
|
||||
if err != nil {
|
||||
return &ExtensionError{"delete_all_extensions", "", err}
|
||||
}
|
||||
@@ -288,6 +287,5 @@ func (es *ExtensionService) ResetAllExtensionsToDefault() error {
|
||||
return err
|
||||
}
|
||||
|
||||
es.logger.Info("all extensions reset to default")
|
||||
return nil
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@ import (
|
||||
|
||||
// HotkeyService Windows全局热键服务
|
||||
type HotkeyService struct {
|
||||
logger *log.LoggerService
|
||||
logger *log.Service
|
||||
configService *ConfigService
|
||||
app *application.App
|
||||
|
||||
@@ -52,7 +52,7 @@ func (e *HotkeyError) Unwrap() error {
|
||||
}
|
||||
|
||||
// NewHotkeyService 创建热键服务实例
|
||||
func NewHotkeyService(configService *ConfigService, logger *log.LoggerService) *HotkeyService {
|
||||
func NewHotkeyService(configService *ConfigService, logger *log.Service) *HotkeyService {
|
||||
if logger == nil {
|
||||
logger = log.New()
|
||||
}
|
||||
@@ -202,7 +202,7 @@ func cBool(b bool) C.int {
|
||||
// toggleWindow 切换窗口
|
||||
func (hs *HotkeyService) toggleWindow() {
|
||||
if hs.app != nil {
|
||||
hs.app.EmitEvent("hotkey:toggle-window", nil)
|
||||
hs.app.Event.Emit("hotkey:toggle-window", nil)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ func (hs *HotkeyService) IsRegistered() bool {
|
||||
return hs.isRegistered.Load()
|
||||
}
|
||||
|
||||
// OnShutdown 关闭服务
|
||||
// ServiceShutdown 关闭服务
|
||||
func (hs *HotkeyService) ServiceShutdown() error {
|
||||
hs.cancel()
|
||||
hs.wg.Wait()
|
||||
|
@@ -80,7 +80,7 @@ var globalHotkeyService *HotkeyService
|
||||
|
||||
// HotkeyService macOS全局热键服务
|
||||
type HotkeyService struct {
|
||||
logger *log.LoggerService
|
||||
logger *log.Service
|
||||
configService *ConfigService
|
||||
app *application.App
|
||||
mu sync.RWMutex
|
||||
@@ -105,7 +105,7 @@ func (e *HotkeyError) Unwrap() error {
|
||||
}
|
||||
|
||||
// NewHotkeyService 创建新的热键服务实例
|
||||
func NewHotkeyService(configService *ConfigService, logger *log.LoggerService) *HotkeyService {
|
||||
func NewHotkeyService(configService *ConfigService, logger *log.Service) *HotkeyService {
|
||||
if logger == nil {
|
||||
logger = log.New()
|
||||
}
|
||||
@@ -290,8 +290,8 @@ func (hs *HotkeyService) ToggleWindow() {
|
||||
}
|
||||
}
|
||||
|
||||
// OnShutdown 关闭热键服务
|
||||
func (hs *HotkeyService) OnShutdown() error {
|
||||
// ServiceShutdown 关闭热键服务
|
||||
func (hs *HotkeyService) ServiceShutdown() error {
|
||||
return hs.UnregisterHotkey()
|
||||
}
|
||||
|
||||
|
@@ -141,7 +141,7 @@ import (
|
||||
|
||||
// HotkeyService Linux全局热键服务
|
||||
type HotkeyService struct {
|
||||
logger *log.LoggerService
|
||||
logger *log.Service
|
||||
configService *ConfigService
|
||||
app *application.App
|
||||
|
||||
@@ -170,7 +170,7 @@ func (e *HotkeyError) Unwrap() error {
|
||||
}
|
||||
|
||||
// NewHotkeyService 创建热键服务实例
|
||||
func NewHotkeyService(configService *ConfigService, logger *log.LoggerService) *HotkeyService {
|
||||
func NewHotkeyService(configService *ConfigService, logger *log.Service) *HotkeyService {
|
||||
if logger == nil {
|
||||
logger = log.New()
|
||||
}
|
||||
@@ -384,8 +384,8 @@ func (hs *HotkeyService) IsRegistered() bool {
|
||||
return hs.isRegistered.Load()
|
||||
}
|
||||
|
||||
// OnShutdown 关闭服务
|
||||
func (hs *HotkeyService) OnShutdown() error {
|
||||
// ServiceShutdown 关闭服务
|
||||
func (hs *HotkeyService) ServiceShutdown() error {
|
||||
hs.cancel()
|
||||
hs.wg.Wait()
|
||||
C.closeX11Display()
|
||||
|
@@ -51,7 +51,7 @@ const (
|
||||
// KeyBindingService 快捷键管理服务
|
||||
type KeyBindingService struct {
|
||||
databaseService *DatabaseService
|
||||
logger *log.LoggerService
|
||||
logger *log.Service
|
||||
|
||||
mu sync.RWMutex
|
||||
ctx context.Context
|
||||
@@ -83,7 +83,7 @@ func (e *KeyBindingError) Is(target error) bool {
|
||||
}
|
||||
|
||||
// NewKeyBindingService 创建快捷键服务实例
|
||||
func NewKeyBindingService(databaseService *DatabaseService, logger *log.LoggerService) *KeyBindingService {
|
||||
func NewKeyBindingService(databaseService *DatabaseService, logger *log.Service) *KeyBindingService {
|
||||
if logger == nil {
|
||||
logger = log.New()
|
||||
}
|
||||
@@ -106,29 +106,26 @@ func (kbs *KeyBindingService) initDatabase() error {
|
||||
defer kbs.mu.Unlock()
|
||||
|
||||
// 检查是否已有快捷键数据
|
||||
db := kbs.databaseService.GetDB()
|
||||
if db == nil {
|
||||
return &KeyBindingError{"get_database", "", fmt.Errorf("database connection is nil")}
|
||||
}
|
||||
|
||||
var count int
|
||||
err := db.QueryRow("SELECT COUNT(*) FROM key_bindings").Scan(&count)
|
||||
rows, err := kbs.databaseService.SQLite.Query("SELECT COUNT(*) FROM key_bindings")
|
||||
if err != nil {
|
||||
return &KeyBindingError{"check_keybindings_count", "", err}
|
||||
}
|
||||
|
||||
kbs.logger.Info("KeyBinding database check", "existing_count", count)
|
||||
if len(rows) == 0 {
|
||||
return &KeyBindingError{"check_keybindings_count", "", fmt.Errorf("no rows returned")}
|
||||
}
|
||||
|
||||
count, ok := rows[0]["COUNT(*)"].(int64)
|
||||
if !ok {
|
||||
return &KeyBindingError{"convert_count", "", fmt.Errorf("failed to convert count to int64")}
|
||||
}
|
||||
|
||||
// 如果没有数据,插入默认配置
|
||||
if count == 0 {
|
||||
kbs.logger.Info("No key bindings found, inserting default key bindings...")
|
||||
if err := kbs.insertDefaultKeyBindings(); err != nil {
|
||||
kbs.logger.Error("Failed to insert default key bindings", "error", err)
|
||||
return err
|
||||
}
|
||||
kbs.logger.Info("Default key bindings inserted successfully")
|
||||
} else {
|
||||
kbs.logger.Info("Key bindings already exist, skipping default insertion")
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -137,17 +134,13 @@ func (kbs *KeyBindingService) initDatabase() error {
|
||||
// insertDefaultKeyBindings 插入默认快捷键配置
|
||||
func (kbs *KeyBindingService) insertDefaultKeyBindings() error {
|
||||
defaultConfig := models.NewDefaultKeyBindingConfig()
|
||||
db := kbs.databaseService.GetDB()
|
||||
now := time.Now()
|
||||
|
||||
kbs.logger.Info("Starting to insert default key bindings", "count", len(defaultConfig.KeyBindings))
|
||||
for _, kb := range defaultConfig.KeyBindings {
|
||||
|
||||
for i, kb := range defaultConfig.KeyBindings {
|
||||
kbs.logger.Info("Inserting key binding", "index", i+1, "command", kb.Command, "key", kb.Key, "extension", kb.Extension)
|
||||
|
||||
_, err := db.Exec(sqlInsertKeyBinding,
|
||||
kb.Command,
|
||||
kb.Extension,
|
||||
err := kbs.databaseService.SQLite.Execute(sqlInsertKeyBinding,
|
||||
string(kb.Command), // 转换为字符串存储
|
||||
string(kb.Extension), // 转换为字符串存储
|
||||
kb.Key,
|
||||
kb.Enabled,
|
||||
kb.IsDefault,
|
||||
@@ -155,72 +148,63 @@ func (kbs *KeyBindingService) insertDefaultKeyBindings() error {
|
||||
now,
|
||||
)
|
||||
if err != nil {
|
||||
kbs.logger.Error("Failed to insert key binding", "command", kb.Command, "error", err)
|
||||
return &KeyBindingError{"insert_keybinding", string(kb.Command), err}
|
||||
}
|
||||
|
||||
kbs.logger.Info("Successfully inserted key binding", "command", kb.Command)
|
||||
}
|
||||
|
||||
kbs.logger.Info("Completed inserting all default key bindings")
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetKeyBindingConfig 获取完整快捷键配置
|
||||
func (kbs *KeyBindingService) GetKeyBindingConfig() (*models.KeyBindingConfig, error) {
|
||||
keyBindings, err := kbs.GetAllKeyBindings()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
config := &models.KeyBindingConfig{
|
||||
KeyBindings: keyBindings,
|
||||
}
|
||||
return config, nil
|
||||
}
|
||||
|
||||
// GetAllKeyBindings 获取所有快捷键配置
|
||||
func (kbs *KeyBindingService) GetAllKeyBindings() ([]models.KeyBinding, error) {
|
||||
kbs.mu.RLock()
|
||||
defer kbs.mu.RUnlock()
|
||||
|
||||
db := kbs.databaseService.GetDB()
|
||||
rows, err := db.Query(sqlGetAllKeyBindings)
|
||||
rows, err := kbs.databaseService.SQLite.Query(sqlGetAllKeyBindings)
|
||||
if err != nil {
|
||||
return nil, &KeyBindingError{"query_keybindings", "", err}
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
var keyBindings []models.KeyBinding
|
||||
for rows.Next() {
|
||||
for _, row := range rows {
|
||||
var kb models.KeyBinding
|
||||
if err := rows.Scan(&kb.Command, &kb.Extension, &kb.Key, &kb.Enabled, &kb.IsDefault); err != nil {
|
||||
return nil, &KeyBindingError{"scan_keybinding", "", err}
|
||||
}
|
||||
keyBindings = append(keyBindings, kb)
|
||||
|
||||
if command, ok := row["command"].(string); ok {
|
||||
kb.Command = models.KeyBindingCommand(command)
|
||||
}
|
||||
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, &KeyBindingError{"rows_error", "", err}
|
||||
if extension, ok := row["extension"].(string); ok {
|
||||
kb.Extension = models.ExtensionID(extension)
|
||||
}
|
||||
|
||||
if key, ok := row["key"].(string); ok {
|
||||
kb.Key = key
|
||||
}
|
||||
|
||||
if enabled, ok := row["enabled"].(int64); ok {
|
||||
kb.Enabled = enabled == 1
|
||||
}
|
||||
|
||||
if isDefault, ok := row["is_default"].(int64); ok {
|
||||
kb.IsDefault = isDefault == 1
|
||||
}
|
||||
|
||||
keyBindings = append(keyBindings, kb)
|
||||
}
|
||||
|
||||
return keyBindings, nil
|
||||
}
|
||||
|
||||
// OnStartup 启动时调用
|
||||
func (kbs *KeyBindingService) OnStartup(ctx context.Context, _ application.ServiceOptions) error {
|
||||
// ServiceStartup 启动时调用
|
||||
func (kbs *KeyBindingService) ServiceStartup(ctx context.Context, options application.ServiceOptions) error {
|
||||
kbs.ctx = ctx
|
||||
kbs.logger.Info("KeyBinding service starting up")
|
||||
|
||||
// 初始化数据库
|
||||
var initErr error
|
||||
kbs.initOnce.Do(func() {
|
||||
kbs.logger.Info("Initializing keybinding database...")
|
||||
if err := kbs.initDatabase(); err != nil {
|
||||
kbs.logger.Error("failed to initialize keybinding database", "error", err)
|
||||
initErr = err
|
||||
} else {
|
||||
kbs.logger.Info("KeyBinding database initialized successfully")
|
||||
}
|
||||
})
|
||||
return initErr
|
||||
|
@@ -33,7 +33,7 @@ type MigrationProgress struct {
|
||||
|
||||
// MigrationService 迁移服务
|
||||
type MigrationService struct {
|
||||
logger *log.LoggerService
|
||||
logger *log.Service
|
||||
mu sync.RWMutex
|
||||
progress atomic.Value // stores MigrationProgress
|
||||
|
||||
@@ -42,7 +42,7 @@ type MigrationService struct {
|
||||
}
|
||||
|
||||
// NewMigrationService 创建迁移服务
|
||||
func NewMigrationService(logger *log.LoggerService) *MigrationService {
|
||||
func NewMigrationService(logger *log.Service) *MigrationService {
|
||||
if logger == nil {
|
||||
logger = log.New()
|
||||
}
|
||||
@@ -417,8 +417,8 @@ func (ms *MigrationService) CancelMigration() error {
|
||||
return fmt.Errorf("no active migration to cancel")
|
||||
}
|
||||
|
||||
// OnShutdown 服务关闭
|
||||
func (ms *MigrationService) OnShutdown() error {
|
||||
// ServiceShutdown 服务关闭
|
||||
func (ms *MigrationService) ServiceShutdown() error {
|
||||
ms.CancelMigration()
|
||||
return nil
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ type SelfUpdateResult struct {
|
||||
|
||||
// SelfUpdateService 自我更新服务
|
||||
type SelfUpdateService struct {
|
||||
logger *log.LoggerService
|
||||
logger *log.Service
|
||||
configService *ConfigService
|
||||
config *models.AppConfig
|
||||
|
||||
@@ -35,7 +35,7 @@ type SelfUpdateService struct {
|
||||
}
|
||||
|
||||
// NewSelfUpdateService 创建自我更新服务实例
|
||||
func NewSelfUpdateService(configService *ConfigService, logger *log.LoggerService) (*SelfUpdateService, error) {
|
||||
func NewSelfUpdateService(configService *ConfigService, logger *log.Service) (*SelfUpdateService, error) {
|
||||
// 获取配置
|
||||
appConfig, err := configService.GetConfig()
|
||||
if err != nil {
|
||||
|
@@ -5,12 +5,14 @@ import (
|
||||
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
"github.com/wailsapp/wails/v3/pkg/services/log"
|
||||
"github.com/wailsapp/wails/v3/pkg/services/sqlite"
|
||||
)
|
||||
|
||||
// ServiceManager 服务管理器,负责协调各个服务
|
||||
type ServiceManager struct {
|
||||
configService *ConfigService
|
||||
databaseService *DatabaseService
|
||||
sqliteService *sqlite.Service
|
||||
documentService *DocumentService
|
||||
migrationService *MigrationService
|
||||
systemService *SystemService
|
||||
@@ -22,7 +24,7 @@ type ServiceManager struct {
|
||||
startupService *StartupService
|
||||
selfUpdateService *SelfUpdateService
|
||||
translationService *TranslationService
|
||||
logger *log.LoggerService
|
||||
logger *log.Service
|
||||
}
|
||||
|
||||
// NewServiceManager 创建新的服务管理器实例
|
||||
@@ -33,6 +35,9 @@ func NewServiceManager() *ServiceManager {
|
||||
// 初始化配置服务
|
||||
configService := NewConfigService(logger)
|
||||
|
||||
// 初始化SQLite服务
|
||||
sqliteService := sqlite.New()
|
||||
|
||||
// 初始化数据库服务
|
||||
databaseService := NewDatabaseService(configService, logger)
|
||||
|
||||
@@ -91,6 +96,7 @@ func NewServiceManager() *ServiceManager {
|
||||
return &ServiceManager{
|
||||
configService: configService,
|
||||
databaseService: databaseService,
|
||||
sqliteService: sqliteService,
|
||||
documentService: documentService,
|
||||
migrationService: migrationService,
|
||||
systemService: systemService,
|
||||
@@ -111,7 +117,8 @@ func NewServiceManager() *ServiceManager {
|
||||
func (sm *ServiceManager) GetServices() []application.Service {
|
||||
services := []application.Service{
|
||||
application.NewService(sm.configService),
|
||||
application.NewService(sm.databaseService),
|
||||
application.NewService(sm.sqliteService), // SQLite服务必须在数据库服务之前初始化
|
||||
application.NewService(sm.databaseService), // 数据库服务必须在依赖它的服务之前初始化
|
||||
application.NewService(sm.documentService),
|
||||
application.NewService(sm.keyBindingService),
|
||||
application.NewService(sm.extensionService),
|
||||
@@ -138,7 +145,7 @@ func (sm *ServiceManager) GetDialogService() *DialogService {
|
||||
}
|
||||
|
||||
// GetLogger 获取日志服务实例
|
||||
func (sm *ServiceManager) GetLogger() *log.LoggerService {
|
||||
func (sm *ServiceManager) GetLogger() *log.Service {
|
||||
return sm.logger
|
||||
}
|
||||
|
||||
@@ -181,3 +188,8 @@ func (sm *ServiceManager) GetTranslationService() *TranslationService {
|
||||
func (sm *ServiceManager) GetDatabaseService() *DatabaseService {
|
||||
return sm.databaseService
|
||||
}
|
||||
|
||||
// GetSQLiteService 获取SQLite服务实例
|
||||
func (sm *ServiceManager) GetSQLiteService() *sqlite.Service {
|
||||
return sm.sqliteService
|
||||
}
|
||||
|
@@ -15,14 +15,14 @@ import (
|
||||
|
||||
// DarwinStartupImpl macOS 平台开机启动实现
|
||||
type DarwinStartupImpl struct {
|
||||
logger *log.LoggerService
|
||||
logger *log.Service
|
||||
disabled bool
|
||||
appPath string
|
||||
appName string
|
||||
}
|
||||
|
||||
// newStartupImplementation 创建平台特定的开机启动实现
|
||||
func newStartupImplementation(logger *log.LoggerService) StartupImplementation {
|
||||
func newStartupImplementation(logger *log.Service) StartupImplementation {
|
||||
return &DarwinStartupImpl{
|
||||
logger: logger,
|
||||
}
|
||||
|
@@ -13,7 +13,7 @@ import (
|
||||
|
||||
// LinuxStartupImpl Linux 平台开机启动实现
|
||||
type LinuxStartupImpl struct {
|
||||
logger *log.LoggerService
|
||||
logger *log.Service
|
||||
autostartDir string
|
||||
execPath string
|
||||
appName string
|
||||
@@ -37,7 +37,7 @@ X-GNOME-Autostart-enabled=true
|
||||
`
|
||||
|
||||
// newStartupImplementation 创建平台特定的开机启动实现
|
||||
func newStartupImplementation(logger *log.LoggerService) StartupImplementation {
|
||||
func newStartupImplementation(logger *log.Service) StartupImplementation {
|
||||
return &LinuxStartupImpl{
|
||||
logger: logger,
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
// StartupService 开机启动服务
|
||||
type StartupService struct {
|
||||
configService *ConfigService
|
||||
logger *log.LoggerService
|
||||
logger *log.Service
|
||||
impl StartupImplementation
|
||||
initError error
|
||||
}
|
||||
@@ -19,7 +19,7 @@ type StartupImplementation interface {
|
||||
}
|
||||
|
||||
// NewStartupService 创建开机启动服务实例
|
||||
func NewStartupService(configService *ConfigService, logger *log.LoggerService) *StartupService {
|
||||
func NewStartupService(configService *ConfigService, logger *log.Service) *StartupService {
|
||||
service := &StartupService{
|
||||
configService: configService,
|
||||
logger: logger,
|
||||
|
@@ -15,7 +15,7 @@ import (
|
||||
|
||||
// WindowsStartupImpl Windows 平台开机启动实现
|
||||
type WindowsStartupImpl struct {
|
||||
logger *log.LoggerService
|
||||
logger *log.Service
|
||||
registryKey string
|
||||
execPath string
|
||||
workingDir string
|
||||
@@ -23,7 +23,7 @@ type WindowsStartupImpl struct {
|
||||
}
|
||||
|
||||
// newStartupImplementation 创建平台特定的开机启动实现
|
||||
func newStartupImplementation(logger *log.LoggerService) StartupImplementation {
|
||||
func newStartupImplementation(logger *log.Service) StartupImplementation {
|
||||
return &WindowsStartupImpl{
|
||||
logger: logger,
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ import (
|
||||
type StoreOption struct {
|
||||
FilePath string
|
||||
AutoSave bool
|
||||
Logger *log.LoggerService
|
||||
Logger *log.Service
|
||||
}
|
||||
|
||||
// Store 泛型存储服务
|
||||
@@ -25,7 +25,7 @@ type Store[T any] struct {
|
||||
dataMap sync.Map // thread-safe map
|
||||
unsaved atomic.Bool
|
||||
initOnce sync.Once
|
||||
logger *log.LoggerService
|
||||
logger *log.Service
|
||||
}
|
||||
|
||||
// NewStore 存储服务
|
||||
|
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// SystemService 系统监控服务
|
||||
type SystemService struct {
|
||||
logger *log.LoggerService
|
||||
logger *log.Service
|
||||
}
|
||||
|
||||
// MemoryStats 内存统计信息
|
||||
@@ -29,7 +29,7 @@ type MemoryStats struct {
|
||||
}
|
||||
|
||||
// NewSystemService 创建新的系统服务实例
|
||||
func NewSystemService(logger *log.LoggerService) *SystemService {
|
||||
func NewSystemService(logger *log.Service) *SystemService {
|
||||
return &SystemService{
|
||||
logger: logger,
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
// TranslationService 翻译服务
|
||||
type TranslationService struct {
|
||||
logger *log.LoggerService
|
||||
logger *log.Service
|
||||
factory *translator.TranslatorFactory
|
||||
defaultTimeout time.Duration
|
||||
translators map[translator.TranslatorType]translator.Translator
|
||||
@@ -18,7 +18,7 @@ type TranslationService struct {
|
||||
}
|
||||
|
||||
// NewTranslationService 创建翻译服务实例
|
||||
func NewTranslationService(logger *log.LoggerService) *TranslationService {
|
||||
func NewTranslationService(logger *log.Service) *TranslationService {
|
||||
service := &TranslationService{
|
||||
logger: logger,
|
||||
factory: translator.NewTranslatorFactory(),
|
||||
|
@@ -7,14 +7,14 @@ import (
|
||||
|
||||
// TrayService 系统托盘服务
|
||||
type TrayService struct {
|
||||
logger *log.LoggerService
|
||||
logger *log.Service
|
||||
configService *ConfigService
|
||||
app *application.App
|
||||
mainWindow *application.WebviewWindow
|
||||
}
|
||||
|
||||
// NewTrayService 创建新的系统托盘服务实例
|
||||
func NewTrayService(logger *log.LoggerService, configService *ConfigService) *TrayService {
|
||||
func NewTrayService(logger *log.Service, configService *ConfigService) *TrayService {
|
||||
return &TrayService{
|
||||
logger: logger,
|
||||
configService: configService,
|
||||
@@ -42,7 +42,7 @@ func (ts *TrayService) HandleWindowClose() {
|
||||
if ts.ShouldMinimizeToTray() {
|
||||
// 隐藏到托盘
|
||||
ts.mainWindow.Hide()
|
||||
ts.app.EmitEvent("window:hidden", nil)
|
||||
ts.app.Event.Emit("window:hidden", nil)
|
||||
} else {
|
||||
// 直接退出应用
|
||||
ts.app.Quit()
|
||||
@@ -54,7 +54,7 @@ func (ts *TrayService) HandleWindowMinimize() {
|
||||
if ts.ShouldMinimizeToTray() {
|
||||
// 隐藏到托盘
|
||||
ts.mainWindow.Hide()
|
||||
ts.app.EmitEvent("window:hidden", nil)
|
||||
ts.app.Event.Emit("window:hidden", nil)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ func (ts *TrayService) ShowWindow() {
|
||||
ts.mainWindow.Restore()
|
||||
ts.mainWindow.Focus()
|
||||
if ts.app != nil {
|
||||
ts.app.EmitEvent("window:shown", nil)
|
||||
ts.app.Event.Emit("window:shown", nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@ import (
|
||||
// SetupSystemTray 设置系统托盘及其功能
|
||||
func SetupSystemTray(app *application.App, mainWindow *application.WebviewWindow, assets embed.FS, trayService *services.TrayService) {
|
||||
// 创建系统托盘
|
||||
systray := app.NewSystemTray()
|
||||
systray := app.SystemTray.New()
|
||||
|
||||
// 设置图标
|
||||
iconBytes, _ := assets.ReadFile("appicon.png")
|
||||
|
6
main.go
6
main.go
@@ -75,7 +75,7 @@ func main() {
|
||||
// 'Mac' options tailor the window when running on macOS.
|
||||
// 'BackgroundColour' is the background colour of the window.
|
||||
// 'URL' is the URL that will be loaded into the webview.
|
||||
mainWindow := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
|
||||
mainWindow := app.Window.NewWithOptions(application.WebviewWindowOptions{
|
||||
Title: "voidraft",
|
||||
Width: 700,
|
||||
Height: 800,
|
||||
@@ -92,7 +92,7 @@ func main() {
|
||||
Theme: application.SystemDefault,
|
||||
},
|
||||
BackgroundColour: application.NewRGB(27, 38, 54),
|
||||
URL: "/#/",
|
||||
URL: "/",
|
||||
})
|
||||
mainWindow.Center()
|
||||
|
||||
@@ -122,7 +122,7 @@ func main() {
|
||||
go func() {
|
||||
for {
|
||||
now := time.Now().Format(time.RFC1123)
|
||||
app.EmitEvent("time", now)
|
||||
app.Event.Emit("time", now)
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
}()
|
||||
|
Reference in New Issue
Block a user