Files
AlgerMusicPlayer/src/preload/index.d.ts
alger bf341fa7c8 feat(update): 重构自动更新系统,使用 electron-updater 替代手动下载
- CI 构建 macOS 拆分为 x64/arm64 分别构建,合并 latest-mac.yml
- 主进程使用 electron-updater 管理检查、下载、安装全流程
- 渲染进程 UpdateModal 改为响应式同步主进程更新状态
- IPC 通道统一为 app-update:* 系列
- 窗口拦截外部链接在系统浏览器打开
- 新增 5 语言更新相关国际化文案
2026-03-11 22:30:35 +08:00

64 lines
2.5 KiB
TypeScript

import { ElectronAPI } from '@electron-toolkit/preload';
import type { AppUpdateState } from '../shared/appUpdate';
interface API {
minimize: () => void;
maximize: () => void;
close: () => void;
quitApp: () => void;
dragStart: (data: any) => void;
miniTray: () => void;
miniWindow: () => void;
restore: () => void;
restart: () => void;
resizeWindow: (width: number, height: number) => void;
resizeMiniWindow: (showPlaylist: boolean) => void;
openLyric: () => void;
sendLyric: (data: any) => void;
sendSong: (data: any) => void;
unblockMusic: (id: number, data: any, enabledSources?: string[]) => Promise<any>;
onLyricWindowClosed: (callback: () => void) => void;
getAppUpdateState: () => Promise<AppUpdateState>;
checkAppUpdate: (manual?: boolean) => Promise<AppUpdateState>;
downloadAppUpdate: () => Promise<AppUpdateState>;
installAppUpdate: () => Promise<boolean>;
openAppUpdatePage: () => Promise<boolean>;
onAppUpdateState: (callback: (state: AppUpdateState) => void) => void;
removeAppUpdateListeners: () => void;
onLanguageChanged: (callback: (locale: string) => void) => void;
importCustomApiPlugin: () => Promise<{ name: string; content: string } | null>;
importLxMusicScript: () => Promise<{ name: string; content: string } | null>;
invoke: (channel: string, ...args: any[]) => Promise<any>;
getSearchSuggestions: (keyword: string) => Promise<any>;
lxMusicHttpRequest: (request: { url: string; options: any; requestId: string }) => Promise<any>;
lxMusicHttpCancel: (requestId: string) => Promise<void>;
/** 扫描指定文件夹中的本地音乐文件 */
scanLocalMusic: (folderPath: string) => Promise<{ files: string[]; count: number }>;
/** 扫描指定文件夹中的本地音乐文件(包含修改时间) */
scanLocalMusicWithStats: (
folderPath: string
) => Promise<{ files: { path: string; modifiedTime: number }[]; count: number }>;
/** 批量解析本地音乐文件元数据 */
parseLocalMusicMetadata: (
filePaths: string[]
) => Promise<import('../renderer/types/localMusic').LocalMusicMeta[]>;
}
// 自定义IPC渲染进程通信接口
interface IpcRenderer {
send: (channel: string, ...args: any[]) => void;
invoke: (channel: string, ...args: any[]) => Promise<any>;
on: (channel: string, listener: (...args: any[]) => void) => () => void;
removeAllListeners: (channel: string) => void;
}
declare global {
interface Window {
electron: ElectronAPI;
api: API;
ipcRenderer: IpcRenderer;
$message: any;
}
}