mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-04-24 16:27:23 +08:00
Merge branch 'feat/new-update' into dev_electron
This commit is contained in:
@@ -8,6 +8,7 @@ import { initializeFileManager } from './modules/fileManager';
|
|||||||
import { initializeFonts } from './modules/fonts';
|
import { initializeFonts } from './modules/fonts';
|
||||||
import { initializeShortcuts, registerShortcuts } from './modules/shortcuts';
|
import { initializeShortcuts, registerShortcuts } from './modules/shortcuts';
|
||||||
import { initializeTray } from './modules/tray';
|
import { initializeTray } from './modules/tray';
|
||||||
|
import { setupUpdateHandlers } from './modules/update';
|
||||||
import { createMainWindow, initializeWindowManager } from './modules/window';
|
import { createMainWindow, initializeWindowManager } from './modules/window';
|
||||||
import { startMusicApi } from './server';
|
import { startMusicApi } from './server';
|
||||||
|
|
||||||
@@ -48,6 +49,9 @@ function initialize() {
|
|||||||
|
|
||||||
// 初始化快捷键
|
// 初始化快捷键
|
||||||
initializeShortcuts(mainWindow);
|
initializeShortcuts(mainWindow);
|
||||||
|
|
||||||
|
// 初始化更新处理程序
|
||||||
|
setupUpdateHandlers(mainWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查是否为第一个实例
|
// 检查是否为第一个实例
|
||||||
|
|||||||
Vendored
+4
@@ -13,6 +13,10 @@ declare global {
|
|||||||
miniTray: () => void;
|
miniTray: () => void;
|
||||||
restart: () => void;
|
restart: () => void;
|
||||||
unblockMusic: (id: number, data: any) => Promise<any>;
|
unblockMusic: (id: number, data: any) => Promise<any>;
|
||||||
|
startDownload: (url: string) => void;
|
||||||
|
onDownloadProgress: (callback: (progress: number, status: string) => void) => void;
|
||||||
|
onDownloadComplete: (callback: (success: boolean, filePath: string) => void) => void;
|
||||||
|
removeDownloadListeners: () => void;
|
||||||
invoke: (channel: string, ...args: any[]) => Promise<any>;
|
invoke: (channel: string, ...args: any[]) => Promise<any>;
|
||||||
};
|
};
|
||||||
$message: any;
|
$message: any;
|
||||||
|
|||||||
@@ -12,6 +12,18 @@ const api = {
|
|||||||
openLyric: () => ipcRenderer.send('open-lyric'),
|
openLyric: () => ipcRenderer.send('open-lyric'),
|
||||||
sendLyric: (data) => ipcRenderer.send('send-lyric', data),
|
sendLyric: (data) => ipcRenderer.send('send-lyric', data),
|
||||||
unblockMusic: (id) => ipcRenderer.invoke('unblock-music', id),
|
unblockMusic: (id) => ipcRenderer.invoke('unblock-music', id),
|
||||||
|
// 更新相关
|
||||||
|
startDownload: (url: string) => ipcRenderer.send('start-download', url),
|
||||||
|
onDownloadProgress: (callback: (progress: number, status: string) => void) => {
|
||||||
|
ipcRenderer.on('download-progress', (_event, progress, status) => callback(progress, status));
|
||||||
|
},
|
||||||
|
onDownloadComplete: (callback: (success: boolean, filePath: string) => void) => {
|
||||||
|
ipcRenderer.on('download-complete', (_event, success, filePath) => callback(success, filePath));
|
||||||
|
},
|
||||||
|
removeDownloadListeners: () => {
|
||||||
|
ipcRenderer.removeAllListeners('download-progress');
|
||||||
|
ipcRenderer.removeAllListeners('download-complete');
|
||||||
|
},
|
||||||
// 歌词缓存相关
|
// 歌词缓存相关
|
||||||
invoke: (channel: string, ...args: any[]) => {
|
invoke: (channel: string, ...args: any[]) => {
|
||||||
const validChannels = [
|
const validChannels = [
|
||||||
|
|||||||
Reference in New Issue
Block a user