forked from miao-moe/QZMusic_PC
feat: 迁移架构&实现功能
- 持久化音量设置 - 搜索页支持自定义每页显示数量(持久化) - vite-electron-plugin迁移electron-vite
This commit is contained in:
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -1,39 +0,0 @@
|
||||
"use strict";
|
||||
const electron = require("electron");
|
||||
electron.contextBridge.exposeInMainWorld("electronAPI", {
|
||||
// 窗口控制
|
||||
minimizeWindow: () => electron.ipcRenderer.send("window-minimize"),
|
||||
maximizeWindow: () => electron.ipcRenderer.send("window-maximize"),
|
||||
closeWindow: () => electron.ipcRenderer.send("window-close"),
|
||||
isMaximized: () => electron.ipcRenderer.invoke("window-is-maximized"),
|
||||
// qzplayer Control
|
||||
qzplayer: {
|
||||
load: (url) => electron.ipcRenderer.invoke("qzplayer-load", url),
|
||||
play: () => electron.ipcRenderer.invoke("qzplayer-play"),
|
||||
pause: () => electron.ipcRenderer.invoke("qzplayer-pause"),
|
||||
togglePause: () => electron.ipcRenderer.invoke("qzplayer-toggle-pause"),
|
||||
stop: () => electron.ipcRenderer.invoke("qzplayer-stop"),
|
||||
setVolume: (vol) => electron.ipcRenderer.invoke("qzplayer-set-volume", vol),
|
||||
seek: (time) => electron.ipcRenderer.invoke("qzplayer-seek", time),
|
||||
onEvent: (callback) => electron.ipcRenderer.on("qzplayer-event", callback)
|
||||
},
|
||||
// Plugin System
|
||||
plugin: {
|
||||
call: (pluginId, method, args) => electron.ipcRenderer.invoke("plugin:call", pluginId, method, args),
|
||||
search: (pluginId, query, page, limit) => electron.ipcRenderer.invoke("plugin:call", pluginId, "search", [query, page, limit])
|
||||
},
|
||||
// Cache Control
|
||||
getCacheInfo: () => electron.ipcRenderer.invoke("cache:getInfo"),
|
||||
setCachePersist: (persist) => electron.ipcRenderer.invoke("cache:setPersist", persist),
|
||||
openCacheFolder: () => electron.ipcRenderer.invoke("cache:openFolder"),
|
||||
clearCache: () => electron.ipcRenderer.invoke("cache:clear"),
|
||||
// Settings
|
||||
settings: {
|
||||
getAll: () => electron.ipcRenderer.invoke("settings:getAll"),
|
||||
set: (settings) => electron.ipcRenderer.invoke("settings:set", settings),
|
||||
getTheme: () => electron.ipcRenderer.invoke("settings:getTheme"),
|
||||
setTheme: (theme) => electron.ipcRenderer.invoke("settings:setTheme", theme),
|
||||
getAccentColor: () => electron.ipcRenderer.invoke("settings:getAccentColor"),
|
||||
setAccentColor: (color) => electron.ipcRenderer.invoke("settings:setAccentColor", color)
|
||||
}
|
||||
});
|
||||
@@ -1,43 +0,0 @@
|
||||
// @see - https://www.electron.build/configuration/configuration
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/electron-userland/electron-builder/master/packages/app-builder-lib/scheme.json",
|
||||
"appId": "YourAppID",
|
||||
"asar": true,
|
||||
"productName": "YourAppName",
|
||||
"directories": {
|
||||
"output": "release/${version}"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"dist-electron"
|
||||
],
|
||||
"mac": {
|
||||
"target": [
|
||||
"dmg"
|
||||
],
|
||||
"artifactName": "${productName}-Mac-${version}-Installer.${ext}"
|
||||
},
|
||||
"win": {
|
||||
"target": [
|
||||
{
|
||||
"target": "nsis",
|
||||
"arch": [
|
||||
"x64"
|
||||
]
|
||||
}
|
||||
],
|
||||
"artifactName": "${productName}-Windows-${version}-Setup.${ext}"
|
||||
},
|
||||
"nsis": {
|
||||
"oneClick": false,
|
||||
"perMachine": false,
|
||||
"allowToChangeInstallationDirectory": true,
|
||||
"deleteAppDataOnUninstall": false
|
||||
},
|
||||
"linux": {
|
||||
"target": [
|
||||
"AppImage"
|
||||
],
|
||||
"artifactName": "${productName}-Linux-${version}.${ext}"
|
||||
}
|
||||
}
|
||||
29
electron.vite.config.ts
Normal file
29
electron.vite.config.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { resolve } from 'path'
|
||||
import { defineConfig } from 'electron-vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import vueJsx from '@vitejs/plugin-vue-jsx'
|
||||
import wasm from 'vite-plugin-wasm'
|
||||
|
||||
export default defineConfig({
|
||||
main: {
|
||||
},
|
||||
preload: {
|
||||
},
|
||||
renderer: {
|
||||
resolve: {
|
||||
alias: {
|
||||
'@renderer': resolve('src/renderer/src'),
|
||||
'@assets': resolve('src/renderer/assets')
|
||||
}
|
||||
},
|
||||
plugins: [vue(), vueJsx(), wasm()],
|
||||
build: {
|
||||
rollupOptions: {
|
||||
input: resolve(__dirname, 'src/renderer/index.html')
|
||||
}
|
||||
},
|
||||
server: {
|
||||
host: "0.0.0.0"
|
||||
}
|
||||
}
|
||||
})
|
||||
27
electron/electron-env.d.ts
vendored
27
electron/electron-env.d.ts
vendored
@@ -1,27 +0,0 @@
|
||||
/// <reference types="vite-plugin-electron/electron-env" />
|
||||
|
||||
declare namespace NodeJS {
|
||||
interface ProcessEnv {
|
||||
/**
|
||||
* The built directory structure
|
||||
*
|
||||
* ```tree
|
||||
* ├─┬─┬ dist
|
||||
* │ │ └── index.html
|
||||
* │ │
|
||||
* │ ├─┬ dist-electron
|
||||
* │ │ ├── main.js
|
||||
* │ │ └── preload.js
|
||||
* │
|
||||
* ```
|
||||
*/
|
||||
APP_ROOT: string
|
||||
/** /dist/ or /public/ */
|
||||
VITE_PUBLIC: string
|
||||
}
|
||||
}
|
||||
|
||||
// Used in Renderer process, expose in `preload.ts`
|
||||
interface Window {
|
||||
ipcRenderer: import('electron').IpcRenderer
|
||||
}
|
||||
234
electron/main.ts
234
electron/main.ts
@@ -1,234 +0,0 @@
|
||||
import { app, BrowserWindow, Menu, ipcMain } from 'electron'
|
||||
import { createRequire } from 'node:module'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import path from 'node:path'
|
||||
import fs from 'node:fs'
|
||||
import { QzpController } from './qzpController.ts'
|
||||
import { startProxyServer, cleanupCache, getCacheDir, getCacheSize, setPersistCache, clearCacheNow } from './proxyServer'
|
||||
import { PluginSystem } from '../src/main/pluginSystem.ts'
|
||||
import { loadSettings, saveSettings, getSetting, AppSettings } from './settingsStore'
|
||||
// @ts-ignore
|
||||
const require = createRequire(import.meta.url)
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
process.env.APP_ROOT = path.join(__dirname, '..')
|
||||
|
||||
export const VITE_DEV_SERVER_URL = process.env['VITE_DEV_SERVER_URL']
|
||||
export const MAIN_DIST = path.join(process.env.APP_ROOT, 'dist-electron')
|
||||
export const RENDERER_DIST = path.join(process.env.APP_ROOT, 'dist')
|
||||
|
||||
process.env.VITE_PUBLIC = VITE_DEV_SERVER_URL ? path.join(process.env.APP_ROOT, 'public') : RENDERER_DIST
|
||||
|
||||
let win: BrowserWindow | null
|
||||
let qzplayer: QzpController | null
|
||||
|
||||
// === Electron 窗口逻辑 ===
|
||||
|
||||
function createWindow() {
|
||||
win = new BrowserWindow({
|
||||
frame: false,
|
||||
minWidth: 950,
|
||||
minHeight: 800,
|
||||
width: 1000,
|
||||
height: 800,
|
||||
icon: path.join(process.env.VITE_PUBLIC, 'electron-vite.svg'),
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, 'preload.mjs'),
|
||||
// nodeIntegration: false,
|
||||
// contextIsolation: true,
|
||||
},
|
||||
})
|
||||
|
||||
win.webContents.on('did-finish-load', () => {
|
||||
win?.webContents.send('main-process-message', new Date().toLocaleString())
|
||||
})
|
||||
|
||||
if (VITE_DEV_SERVER_URL) {
|
||||
win.loadURL(VITE_DEV_SERVER_URL)
|
||||
} else {
|
||||
win.loadFile(path.join(RENDERER_DIST, 'index.html'))
|
||||
}
|
||||
win.webContents.openDevTools();
|
||||
registerZoomShortcuts(win)
|
||||
}
|
||||
|
||||
// === IPC 监听 ===
|
||||
|
||||
ipcMain.on('window-minimize', (event) => BrowserWindow.fromWebContents(event.sender)?.minimize())
|
||||
ipcMain.on('window-maximize', () => win?.isMaximized() ? win.unmaximize() : win?.maximize())
|
||||
ipcMain.on('window-close', () => win?.close())
|
||||
ipcMain.handle('window-is-maximized', () => win?.isMaximized() || false)
|
||||
|
||||
// --- qzplayer IPC Handlers ---
|
||||
ipcMain.handle('qzplayer-command', async (_, command: any[]) => {
|
||||
if (qzplayer) {
|
||||
qzplayer.send(command)
|
||||
}
|
||||
})
|
||||
|
||||
// Quick Helpers
|
||||
ipcMain.handle('qzplayer-load', (_, url) => qzplayer?.load(url))
|
||||
ipcMain.handle('qzplayer-play', () => qzplayer?.play())
|
||||
ipcMain.handle('qzplayer-pause', () => qzplayer?.pause())
|
||||
ipcMain.handle('qzplayer-toggle-pause', () => qzplayer?.togglePause())
|
||||
ipcMain.handle('qzplayer-stop', () => qzplayer?.stop())
|
||||
ipcMain.handle('qzplayer-set-volume', (_, vol) => qzplayer?.setVolume(vol))
|
||||
ipcMain.handle('qzplayer-seek', (_, time) => qzplayer?.seek(time))
|
||||
|
||||
// PluginSystem
|
||||
ipcMain.handle(
|
||||
'plugin:call',
|
||||
async (_evenv, pluginId: string, method: string, args: any[]) => {
|
||||
const plugin = new PluginSystem(pluginId)
|
||||
|
||||
if (typeof (plugin as any)[method] !== 'function') {
|
||||
return {
|
||||
success: false,
|
||||
error: `Method ${method} not found`
|
||||
}
|
||||
}
|
||||
|
||||
return await (plugin as any)[method](...args)
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
|
||||
// Cache IPC Handlers
|
||||
ipcMain.handle('cache:getInfo', () => {
|
||||
const settings = loadSettings();
|
||||
return {
|
||||
path: getCacheDir(),
|
||||
size: getCacheSize(),
|
||||
persistCache: settings.persistCache
|
||||
}
|
||||
})
|
||||
|
||||
ipcMain.handle('cache:setPersist', (_, persist: boolean) => {
|
||||
setPersistCache(persist)
|
||||
saveSettings({ persistCache: persist })
|
||||
})
|
||||
|
||||
ipcMain.handle('cache:openFolder', () => {
|
||||
const dir = getCacheDir()
|
||||
require('electron').shell.openPath(dir)
|
||||
})
|
||||
|
||||
ipcMain.handle('cache:clear', () => {
|
||||
clearCacheNow()
|
||||
})
|
||||
|
||||
// Settings IPC Handlers
|
||||
ipcMain.handle('settings:getAll', () => {
|
||||
return loadSettings()
|
||||
})
|
||||
|
||||
ipcMain.handle('settings:set', (_, settings: Partial<AppSettings>) => {
|
||||
return saveSettings(settings)
|
||||
})
|
||||
|
||||
ipcMain.handle('settings:getTheme', () => {
|
||||
return getSetting('theme')
|
||||
})
|
||||
|
||||
ipcMain.handle('settings:setTheme', (_, theme: 'dark' | 'light') => {
|
||||
saveSettings({ theme })
|
||||
})
|
||||
|
||||
ipcMain.handle('settings:getAccentColor', () => {
|
||||
return getSetting('accentColor')
|
||||
})
|
||||
|
||||
ipcMain.handle('settings:setAccentColor', (_, color: string) => {
|
||||
saveSettings({ accentColor: color })
|
||||
})
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
win = null
|
||||
}
|
||||
})
|
||||
|
||||
app.on('will-quit', () => {
|
||||
cleanupCache()
|
||||
if (qzplayer) {
|
||||
qzplayer.destroy()
|
||||
}
|
||||
})
|
||||
|
||||
function registerZoomShortcuts(win: BrowserWindow) {
|
||||
win.webContents.on('before-input-event', (event, input) => {
|
||||
if (input.control || input.meta) {
|
||||
if (input.key.toLowerCase() === '=' || input.key === '+') {
|
||||
let currentZoom = win.webContents.getZoomFactor();
|
||||
win.webContents.setZoomFactor(currentZoom + 0.1);
|
||||
event.preventDefault();
|
||||
} else if (input.key === '-' || input.key === '_') {
|
||||
let currentZoom = win.webContents.getZoomFactor();
|
||||
// Limit minimum zoom to avoid making it too small to see
|
||||
if (currentZoom > 0.5) {
|
||||
win.webContents.setZoomFactor(currentZoom - 0.1);
|
||||
}
|
||||
event.preventDefault();
|
||||
} else if (input.key === '0') {
|
||||
win.webContents.setZoomFactor(1);
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow()
|
||||
}
|
||||
})
|
||||
|
||||
// Test
|
||||
app.whenReady().then(() => {
|
||||
// Ensure plugins directory exists
|
||||
const pluginsPath = path.join(app.getPath('userData'), 'plugins')
|
||||
if (!fs.existsSync(pluginsPath)) {
|
||||
fs.mkdirSync(pluginsPath, { recursive: true })
|
||||
}
|
||||
|
||||
// --- Ensure Sample 'wy' Plugin Exists ---
|
||||
const wyPluginPath = path.join(pluginsPath, 'wy')
|
||||
const wyPluginIndex = path.join(wyPluginPath, 'index.js')
|
||||
if (!fs.existsSync(wyPluginIndex)) {
|
||||
if (!fs.existsSync(wyPluginPath)) fs.mkdirSync(wyPluginPath, { recursive: true })
|
||||
fs.writeFileSync(wyPluginIndex, `
|
||||
module.exports = {
|
||||
async getUrl(id, quality) {
|
||||
const url = \`https://api.qz.shiqianjiang.cn/music/url?source=wy&songId=\${id}&quality=\${quality}&key=testkey\`;
|
||||
try {
|
||||
const response = await fetch(url);
|
||||
const data = await response.json();
|
||||
return data;
|
||||
} catch (e) {
|
||||
return { success: false, error: e.message };
|
||||
}
|
||||
}
|
||||
}
|
||||
`.trim())
|
||||
}
|
||||
// ----------------------------------------
|
||||
|
||||
Menu.setApplicationMenu(null)
|
||||
createWindow()
|
||||
|
||||
// Start Proxy Server
|
||||
startProxyServer()
|
||||
|
||||
// Start qzplayer
|
||||
qzplayer = new QzpController()
|
||||
qzplayer.start()
|
||||
|
||||
qzplayer.on('event', (data) => {
|
||||
// Forward qzplayer events to Render Process
|
||||
if (win && !win.isDestroyed()) {
|
||||
win.webContents.send('qzplayer-event', data)
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -1,43 +0,0 @@
|
||||
import { contextBridge, ipcRenderer } from 'electron'
|
||||
|
||||
contextBridge.exposeInMainWorld('electronAPI', {
|
||||
// 窗口控制
|
||||
minimizeWindow: () => ipcRenderer.send('window-minimize'),
|
||||
maximizeWindow: () => ipcRenderer.send('window-maximize'),
|
||||
closeWindow: () => ipcRenderer.send('window-close'),
|
||||
isMaximized: () => ipcRenderer.invoke('window-is-maximized'),
|
||||
|
||||
// qzplayer Control
|
||||
qzplayer: {
|
||||
load: (url: string) => ipcRenderer.invoke('qzplayer-load', url),
|
||||
play: () => ipcRenderer.invoke('qzplayer-play'),
|
||||
pause: () => ipcRenderer.invoke('qzplayer-pause'),
|
||||
togglePause: () => ipcRenderer.invoke('qzplayer-toggle-pause'),
|
||||
stop: () => ipcRenderer.invoke('qzplayer-stop'),
|
||||
setVolume: (vol: number) => ipcRenderer.invoke('qzplayer-set-volume', vol),
|
||||
seek: (time: number) => ipcRenderer.invoke('qzplayer-seek', time),
|
||||
onEvent: (callback: (event: any, data: any) => void) => ipcRenderer.on('qzplayer-event', callback)
|
||||
},
|
||||
|
||||
// Plugin System
|
||||
plugin: {
|
||||
call: (pluginId: string, method: string, args: any[]) => ipcRenderer.invoke('plugin:call', pluginId, method, args),
|
||||
search: (pluginId: string, query: string, page: number, limit: number) => ipcRenderer.invoke('plugin:call', pluginId, 'search', [query, page, limit]),
|
||||
},
|
||||
|
||||
// Cache Control
|
||||
getCacheInfo: () => ipcRenderer.invoke('cache:getInfo'),
|
||||
setCachePersist: (persist: boolean) => ipcRenderer.invoke('cache:setPersist', persist),
|
||||
openCacheFolder: () => ipcRenderer.invoke('cache:openFolder'),
|
||||
clearCache: () => ipcRenderer.invoke('cache:clear'),
|
||||
|
||||
// Settings
|
||||
settings: {
|
||||
getAll: () => ipcRenderer.invoke('settings:getAll'),
|
||||
set: (settings: any) => ipcRenderer.invoke('settings:set', settings),
|
||||
getTheme: () => ipcRenderer.invoke('settings:getTheme'),
|
||||
setTheme: (theme: 'dark' | 'light') => ipcRenderer.invoke('settings:setTheme', theme),
|
||||
getAccentColor: () => ipcRenderer.invoke('settings:getAccentColor'),
|
||||
setAccentColor: (color: string) => ipcRenderer.invoke('settings:setAccentColor', color)
|
||||
}
|
||||
})
|
||||
13
index.html
13
index.html
@@ -1,13 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vite + Vue + TS</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/renderer/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
576
package-lock.json
generated
576
package-lock.json
generated
@@ -11,6 +11,7 @@
|
||||
"@applemusic-like-lyrics/core": "^0.2.0",
|
||||
"@applemusic-like-lyrics/lyric": "^0.3.0",
|
||||
"@applemusic-like-lyrics/vue": "^0.2.0",
|
||||
"@electron-toolkit/tsconfig": "^2.0.0",
|
||||
"@iconify/vue": "^5.0.0",
|
||||
"@pixi/app": "^7.4.3",
|
||||
"@pixi/core": "^7.4.3",
|
||||
@@ -26,7 +27,6 @@
|
||||
"pinia": "^3.0.4",
|
||||
"tdesign-vue-next": "^1.17.7",
|
||||
"url": "^0.11.4",
|
||||
"vite-plugin-electron-renderer": "^0.14.6",
|
||||
"vite-plugin-wasm": "^3.5.0",
|
||||
"vue": "^3.4.21",
|
||||
"vue-router": "^4.6.4"
|
||||
@@ -35,10 +35,10 @@
|
||||
"@vitejs/plugin-vue": "^5.0.4",
|
||||
"electron": "^30.0.1",
|
||||
"electron-builder": "^24.13.3",
|
||||
"electron-vite": "^5.0.0",
|
||||
"sass-embedded": "^1.97.1",
|
||||
"typescript": "^5.2.2",
|
||||
"vite": "^5.1.6",
|
||||
"vite-plugin-electron": "^0.28.6",
|
||||
"vite-plugin-node-polyfills": "^0.25.0",
|
||||
"vue-tsc": "^2.0.26"
|
||||
}
|
||||
@@ -406,6 +406,22 @@
|
||||
"@babel/core": "^7.0.0-0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-arrow-functions": {
|
||||
"version": "7.27.1",
|
||||
"resolved": "https://registry.npmmirror.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.27.1.tgz",
|
||||
"integrity": "sha512-8Z4TGic6xW70FKThA5HYEKKyBpOOsucTOD1DjU3fZxDg+K3zBJcXMFnt/4yQiZnf5+MiOMSXQ9PaEK/Ilh1DeA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.27.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0-0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-typescript": {
|
||||
"version": "7.28.6",
|
||||
"resolved": "https://registry.npmmirror.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.28.6.tgz",
|
||||
@@ -513,6 +529,15 @@
|
||||
"url": "https://opencollective.com/webpack"
|
||||
}
|
||||
},
|
||||
"node_modules/@electron-toolkit/tsconfig": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/@electron-toolkit/tsconfig/-/tsconfig-2.0.0.tgz",
|
||||
"integrity": "sha512-AdPsP770WhW7b260h13SHMdmjEEHJL6xFtgi3jwgdsSQbJOkJLeNnnpZW9qxTPCvmRI6vmdzWz5K3gibFS6SNg==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@electron/asar": {
|
||||
"version": "3.4.1",
|
||||
"resolved": "https://registry.npmmirror.com/@electron/asar/-/asar-3.4.1.tgz",
|
||||
@@ -1067,6 +1092,23 @@
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/netbsd-arm64": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz",
|
||||
"integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"netbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/netbsd-x64": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz",
|
||||
@@ -1083,6 +1125,23 @@
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/openbsd-arm64": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz",
|
||||
"integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"openbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/openbsd-x64": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz",
|
||||
@@ -1099,6 +1158,23 @@
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/openharmony-arm64": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz",
|
||||
"integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"openharmony"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/sunos-x64": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz",
|
||||
@@ -2393,7 +2469,6 @@
|
||||
"version": "20.19.27",
|
||||
"resolved": "https://registry.npmmirror.com/@types/node/-/node-20.19.27.tgz",
|
||||
"integrity": "sha512-N2clP5pJhB2YnZJ3PIHFk5RkygRX5WO/5f0WC08tp0wd+sv0rsJk3MqWn3CbNmT2J505a5336jaQj4ph1AdMug==",
|
||||
"devOptional": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"undici-types": "~6.21.0"
|
||||
@@ -3694,6 +3769,16 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/cac": {
|
||||
"version": "6.7.14",
|
||||
"resolved": "https://registry.npmmirror.com/cac/-/cac-6.7.14.tgz",
|
||||
"integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/cacheable-lookup": {
|
||||
"version": "5.0.4",
|
||||
"resolved": "https://registry.npmmirror.com/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz",
|
||||
@@ -4815,6 +4900,469 @@
|
||||
"integrity": "sha512-9tfDXhJ4RKFNerfjdCcZfufu49vg620741MNs26a9+bhLThdB+plgMeou98CAaHu/WATj2iHOOHTp1hWtABj2A==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/electron-vite": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/electron-vite/-/electron-vite-5.0.0.tgz",
|
||||
"integrity": "sha512-OHp/vjdlubNlhNkPkL/+3JD34ii5ov7M0GpuXEVdQeqdQ3ulvVR7Dg/rNBLfS5XPIFwgoBLDf9sjjrL+CuDyRQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.28.4",
|
||||
"@babel/plugin-transform-arrow-functions": "^7.27.1",
|
||||
"cac": "^6.7.14",
|
||||
"esbuild": "^0.25.11",
|
||||
"magic-string": "^0.30.19",
|
||||
"picocolors": "^1.1.1"
|
||||
},
|
||||
"bin": {
|
||||
"electron-vite": "bin/electron-vite.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@swc/core": "^1.0.0",
|
||||
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@swc/core": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/electron-vite/node_modules/@esbuild/aix-ppc64": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz",
|
||||
"integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"aix"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-vite/node_modules/@esbuild/android-arm": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/android-arm/-/android-arm-0.25.12.tgz",
|
||||
"integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-vite/node_modules/@esbuild/android-arm64": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz",
|
||||
"integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-vite/node_modules/@esbuild/android-x64": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/android-x64/-/android-x64-0.25.12.tgz",
|
||||
"integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-vite/node_modules/@esbuild/darwin-arm64": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz",
|
||||
"integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-vite/node_modules/@esbuild/darwin-x64": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz",
|
||||
"integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-vite/node_modules/@esbuild/freebsd-arm64": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz",
|
||||
"integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-vite/node_modules/@esbuild/freebsd-x64": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz",
|
||||
"integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-vite/node_modules/@esbuild/linux-arm": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz",
|
||||
"integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-vite/node_modules/@esbuild/linux-arm64": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz",
|
||||
"integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-vite/node_modules/@esbuild/linux-ia32": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz",
|
||||
"integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-vite/node_modules/@esbuild/linux-loong64": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz",
|
||||
"integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==",
|
||||
"cpu": [
|
||||
"loong64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-vite/node_modules/@esbuild/linux-mips64el": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz",
|
||||
"integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==",
|
||||
"cpu": [
|
||||
"mips64el"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-vite/node_modules/@esbuild/linux-ppc64": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz",
|
||||
"integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-vite/node_modules/@esbuild/linux-riscv64": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz",
|
||||
"integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==",
|
||||
"cpu": [
|
||||
"riscv64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-vite/node_modules/@esbuild/linux-s390x": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz",
|
||||
"integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==",
|
||||
"cpu": [
|
||||
"s390x"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-vite/node_modules/@esbuild/linux-x64": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz",
|
||||
"integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-vite/node_modules/@esbuild/netbsd-x64": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz",
|
||||
"integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"netbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-vite/node_modules/@esbuild/openbsd-x64": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz",
|
||||
"integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"openbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-vite/node_modules/@esbuild/sunos-x64": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz",
|
||||
"integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"sunos"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-vite/node_modules/@esbuild/win32-arm64": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz",
|
||||
"integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-vite/node_modules/@esbuild/win32-ia32": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz",
|
||||
"integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-vite/node_modules/@esbuild/win32-x64": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz",
|
||||
"integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-vite/node_modules/esbuild": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmmirror.com/esbuild/-/esbuild-0.25.12.tgz",
|
||||
"integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"esbuild": "bin/esbuild"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@esbuild/aix-ppc64": "0.25.12",
|
||||
"@esbuild/android-arm": "0.25.12",
|
||||
"@esbuild/android-arm64": "0.25.12",
|
||||
"@esbuild/android-x64": "0.25.12",
|
||||
"@esbuild/darwin-arm64": "0.25.12",
|
||||
"@esbuild/darwin-x64": "0.25.12",
|
||||
"@esbuild/freebsd-arm64": "0.25.12",
|
||||
"@esbuild/freebsd-x64": "0.25.12",
|
||||
"@esbuild/linux-arm": "0.25.12",
|
||||
"@esbuild/linux-arm64": "0.25.12",
|
||||
"@esbuild/linux-ia32": "0.25.12",
|
||||
"@esbuild/linux-loong64": "0.25.12",
|
||||
"@esbuild/linux-mips64el": "0.25.12",
|
||||
"@esbuild/linux-ppc64": "0.25.12",
|
||||
"@esbuild/linux-riscv64": "0.25.12",
|
||||
"@esbuild/linux-s390x": "0.25.12",
|
||||
"@esbuild/linux-x64": "0.25.12",
|
||||
"@esbuild/netbsd-arm64": "0.25.12",
|
||||
"@esbuild/netbsd-x64": "0.25.12",
|
||||
"@esbuild/openbsd-arm64": "0.25.12",
|
||||
"@esbuild/openbsd-x64": "0.25.12",
|
||||
"@esbuild/openharmony-arm64": "0.25.12",
|
||||
"@esbuild/sunos-x64": "0.25.12",
|
||||
"@esbuild/win32-arm64": "0.25.12",
|
||||
"@esbuild/win32-ia32": "0.25.12",
|
||||
"@esbuild/win32-x64": "0.25.12"
|
||||
}
|
||||
},
|
||||
"node_modules/element-plus": {
|
||||
"version": "2.13.0",
|
||||
"resolved": "https://registry.npmmirror.com/element-plus/-/element-plus-2.13.0.tgz",
|
||||
@@ -8764,7 +9312,6 @@
|
||||
"version": "6.21.0",
|
||||
"resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-6.21.0.tgz",
|
||||
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
|
||||
"devOptional": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/universalify": {
|
||||
@@ -8955,27 +9502,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/vite-plugin-electron": {
|
||||
"version": "0.28.8",
|
||||
"resolved": "https://registry.npmmirror.com/vite-plugin-electron/-/vite-plugin-electron-0.28.8.tgz",
|
||||
"integrity": "sha512-ir+B21oSGK9j23OEvt4EXyco9xDCaF6OGFe0V/8Zc0yL2+HMyQ6mmNQEIhXsEsZCSfIowBpwQBeHH4wVsfraeg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"vite-plugin-electron-renderer": "*"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"vite-plugin-electron-renderer": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/vite-plugin-electron-renderer": {
|
||||
"version": "0.14.6",
|
||||
"resolved": "https://registry.npmmirror.com/vite-plugin-electron-renderer/-/vite-plugin-electron-renderer-0.14.6.tgz",
|
||||
"integrity": "sha512-oqkWFa7kQIkvHXG7+Mnl1RTroA4sP0yesKatmAy0gjZC4VwUqlvF9IvOpHd1fpLWsqYX/eZlVxlhULNtaQ78Jw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/vite-plugin-node-polyfills": {
|
||||
"version": "0.25.0",
|
||||
"resolved": "https://registry.npmmirror.com/vite-plugin-node-polyfills/-/vite-plugin-node-polyfills-0.25.0.tgz",
|
||||
|
||||
13
package.json
13
package.json
@@ -2,16 +2,16 @@
|
||||
"name": "qzmusic",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vue-tsc && vite build && electron-builder",
|
||||
"preview": "vite preview"
|
||||
"dev": "electron-vite dev",
|
||||
"build": "electron-vite build",
|
||||
"preview": "electron-vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@applemusic-like-lyrics/core": "^0.2.0",
|
||||
"@applemusic-like-lyrics/lyric": "^0.3.0",
|
||||
"@applemusic-like-lyrics/vue": "^0.2.0",
|
||||
"@electron-toolkit/tsconfig": "^2.0.0",
|
||||
"@iconify/vue": "^5.0.0",
|
||||
"@pixi/app": "^7.4.3",
|
||||
"@pixi/core": "^7.4.3",
|
||||
@@ -27,7 +27,6 @@
|
||||
"pinia": "^3.0.4",
|
||||
"tdesign-vue-next": "^1.17.7",
|
||||
"url": "^0.11.4",
|
||||
"vite-plugin-electron-renderer": "^0.14.6",
|
||||
"vite-plugin-wasm": "^3.5.0",
|
||||
"vue": "^3.4.21",
|
||||
"vue-router": "^4.6.4"
|
||||
@@ -36,12 +35,12 @@
|
||||
"@vitejs/plugin-vue": "^5.0.4",
|
||||
"electron": "^30.0.1",
|
||||
"electron-builder": "^24.13.3",
|
||||
"electron-vite": "^5.0.0",
|
||||
"sass-embedded": "^1.97.1",
|
||||
"typescript": "^5.2.2",
|
||||
"vite": "^5.1.6",
|
||||
"vite-plugin-electron": "^0.28.6",
|
||||
"vite-plugin-node-polyfills": "^0.25.0",
|
||||
"vue-tsc": "^2.0.26"
|
||||
},
|
||||
"main": "dist-electron/main.js"
|
||||
"main": "out/main/index.js"
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { app } from 'electron'
|
||||
import path from 'path'
|
||||
import fs from 'fs'
|
||||
import { createRequire } from 'node:module'
|
||||
import { MessagePlugin } from "tdesign-vue-next";
|
||||
|
||||
const require = createRequire(import.meta.url)
|
||||
|
||||
@@ -15,7 +16,8 @@ type PluginModule = {
|
||||
getUrl?: (id: string, quality: string) => Promise<string> | string,
|
||||
musicSearch?: {
|
||||
search: (query: string, page: number, limit: number) => Promise<any> | any
|
||||
}
|
||||
},
|
||||
getLyric?: (id: string) => Promise<string> | object
|
||||
}
|
||||
|
||||
export class PluginSystem {
|
||||
@@ -26,27 +28,6 @@ export class PluginSystem {
|
||||
this.loadPlugin()
|
||||
}
|
||||
|
||||
async search(query: string, page: number, limit: number): Promise<any> {
|
||||
if (!this.plugin?.musicSearch?.search) {
|
||||
return {
|
||||
list: [],
|
||||
total: 0,
|
||||
allPage: 0,
|
||||
error: 'Search not implemented'
|
||||
}
|
||||
}
|
||||
try {
|
||||
return await this.plugin.musicSearch.search(query, page, limit)
|
||||
} catch (e: any) {
|
||||
return {
|
||||
list: [],
|
||||
total: 0,
|
||||
allPage: 0,
|
||||
error: e.message || 'Plugin search error'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private loadPlugin() {
|
||||
try {
|
||||
const pluginPath = path.join(
|
||||
@@ -100,4 +81,42 @@ export class PluginSystem {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async search(query: string, page: number, limit: number): Promise<any> {
|
||||
if (!this.plugin?.musicSearch?.search) {
|
||||
return {
|
||||
list: [],
|
||||
total: 0,
|
||||
allPage: 0,
|
||||
error: 'Search not implemented'
|
||||
}
|
||||
}
|
||||
try {
|
||||
return await this.plugin.musicSearch.search(query, page, limit)
|
||||
} catch (e: any) {
|
||||
return {
|
||||
list: [],
|
||||
total: 0,
|
||||
allPage: 0,
|
||||
error: e.message || 'Plugin search error'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async getLyric(id: string): Promise<any> {
|
||||
console.log("getLyric not implemented");
|
||||
if (!this.plugin?.getLyric) {
|
||||
console.log("getLyric not implemented2");
|
||||
return
|
||||
}
|
||||
try {
|
||||
const result = await this.plugin.getLyric(id)
|
||||
console.log(result)
|
||||
return result
|
||||
} catch (e: any) {
|
||||
console.log(e)
|
||||
MessagePlugin.error(e).then()
|
||||
return {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { app } from 'electron';
|
||||
// @ts-ignore
|
||||
import { PluginSystem } from '../src/main/pluginSystem.ts';
|
||||
import { PluginSystem } from './pluginSystem.ts';
|
||||
|
||||
const PORT = 5266;
|
||||
let CACHE_DIR = '';
|
||||
@@ -97,7 +97,7 @@ export class QzpController extends EventEmitter {
|
||||
|
||||
for (const msg of messages) {
|
||||
if (!msg.trim()) continue;
|
||||
console.log('[IPC]', msg); // User requested raw communication
|
||||
//console.log('[IPC]', msg); // User requested raw communication
|
||||
try {
|
||||
const json = JSON.parse(msg);
|
||||
this.emit('message', json);
|
||||
16
src/renderer/index.html
Normal file
16
src/renderer/index.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vite + Vue + TS</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="src/main.ts"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -26,5 +26,5 @@ onMounted(async () => {
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@import "./styles/main.css";
|
||||
@import "styles/main.css";
|
||||
</style>
|
||||
@@ -234,6 +234,7 @@ const drawSpectrum = () => {
|
||||
|
||||
// Adjust canvas size
|
||||
const dpr = window.devicePixelRatio || 1;
|
||||
|
||||
const rect = canvas.getBoundingClientRect();
|
||||
canvas.width = rect.width * dpr;
|
||||
canvas.height = rect.height * dpr;
|
||||
@@ -241,7 +242,7 @@ const drawSpectrum = () => {
|
||||
|
||||
const width = rect.width;
|
||||
const height = rect.height;
|
||||
|
||||
|
||||
ctx.clearRect(0, 0, width, height);
|
||||
|
||||
const targetData = playerStore.spectrum;
|
||||
@@ -251,8 +252,8 @@ const drawSpectrum = () => {
|
||||
// Adjust speed (0.1 - 0.3) for desired smoothness
|
||||
const lerpSpeed = 0.15;
|
||||
for (let i = 0; i < 32; i++) {
|
||||
const target = targetData[i] || 0;
|
||||
currentData[i] = currentData[i] + (target - currentData[i]) * lerpSpeed;
|
||||
const target = targetData[i] || 0;
|
||||
currentData[i] = currentData[i] + (target - currentData[i]) * lerpSpeed;
|
||||
}
|
||||
|
||||
// 2. Draw Smooth Wave
|
||||
@@ -260,7 +261,7 @@ const drawSpectrum = () => {
|
||||
ctx.moveTo(0, height);
|
||||
|
||||
const pointCount = currentData.length;
|
||||
// Use a subset if desired, but 32 is fine.
|
||||
// Use a subset if desired, but 32 is fine.
|
||||
// We want the wave to be centered or span the width.
|
||||
const step = width / (pointCount - 1);
|
||||
|
||||
@@ -272,14 +273,14 @@ const drawSpectrum = () => {
|
||||
for (let i = 0; i < pointCount - 1; i++) {
|
||||
const xCurr = i * step;
|
||||
const yCurr = height - (currentData[i] * height * 0.5);
|
||||
|
||||
|
||||
const xNext = (i + 1) * step;
|
||||
const yNext = height - (currentData[i + 1] * height * 0.5);
|
||||
|
||||
|
||||
// Control point for quadratic curve (midpoint)
|
||||
const xMid = (xCurr + xNext) / 2;
|
||||
const yMid = (yCurr + yNext) / 2;
|
||||
|
||||
|
||||
ctx.quadraticCurveTo(xCurr, yCurr, xMid, yMid);
|
||||
}
|
||||
|
||||
@@ -296,13 +297,13 @@ const drawSpectrum = () => {
|
||||
const gradient = ctx.createLinearGradient(0, height - 200, 0, height);
|
||||
gradient.addColorStop(0, 'rgba(255, 255, 255, 0.4)');
|
||||
gradient.addColorStop(1, 'rgba(255, 255, 255, 0.05)');
|
||||
|
||||
|
||||
ctx.fillStyle = gradient;
|
||||
|
||||
|
||||
// Add blur effect
|
||||
ctx.shadowBlur = 20;
|
||||
ctx.shadowColor = 'rgba(255, 255, 255, 0.5)';
|
||||
|
||||
|
||||
ctx.fill();
|
||||
|
||||
// Reset shadow for next frame (performance)
|
||||
@@ -179,7 +179,8 @@ const handleBarClick = (e: MouseEvent) => {
|
||||
};
|
||||
|
||||
// Utils
|
||||
const formatTime = (seconds: number) => {
|
||||
const formatTime = (seconds2: number) => {
|
||||
const seconds = Math.floor(seconds2 / 1000);
|
||||
if (!seconds || isNaN(seconds)) return '00:00';
|
||||
const m = Math.floor(seconds / 60);
|
||||
const s = Math.floor(seconds % 60);
|
||||
@@ -27,7 +27,6 @@ const hasSongs = computed(() => playerStore.playlist.length > 0);
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* 关键修复:全局重置盒模型 */
|
||||
/* 这确保 width: 100% + padding 不会撑破容器 */
|
||||
*, *::before, *::after {
|
||||
box-sizing: border-box;
|
||||
@@ -67,13 +66,12 @@ body {
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
/* 关键修复:防止 flex 子项内容过宽撑开容器 */
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.page-content {
|
||||
flex: 1;
|
||||
overflow-y: auto; /* 只允许内容区域滚动 */
|
||||
overflow-y: auto;
|
||||
padding: 0;
|
||||
background-color: var(--color-bg-primary);
|
||||
position: relative;
|
||||
@@ -4,7 +4,6 @@ import { createPinia } from 'pinia'
|
||||
import { createRouter, createWebHashHistory } from 'vue-router'
|
||||
|
||||
import App from './App.vue'
|
||||
import TDesign from 'tdesign-vue-next'
|
||||
import 'tdesign-vue-next/es/style/index.css'
|
||||
|
||||
const pinia = createPinia()
|
||||
@@ -42,7 +41,6 @@ const router = createRouter({
|
||||
const app = createApp(App)
|
||||
app.use(pinia)
|
||||
app.use(router)
|
||||
app.use(TDesign)
|
||||
app.mount('#app')
|
||||
|
||||
// --- TEST: Auto Play Specific Song ---
|
||||
@@ -1,7 +1,8 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { ref } from 'vue';
|
||||
import { ref, watch } from 'vue';
|
||||
import { MessagePlugin } from 'tdesign-vue-next';
|
||||
import type { Song } from '../types/song';
|
||||
import { parseLyric } from '../utils/lyricParser';
|
||||
|
||||
export enum PlayMode {
|
||||
List = 'list',
|
||||
@@ -24,9 +25,19 @@ export const usePlayerStore = defineStore('player', () => {
|
||||
// State
|
||||
const isPlaying = ref(false);
|
||||
const currentSong = ref<Song | null>(null);
|
||||
const volume = ref(50);
|
||||
const duration = ref(0);
|
||||
const currentTime = ref(0);
|
||||
const savedVolume = localStorage.getItem('qz-player-volume');
|
||||
const volume = ref(savedVolume ? Number(savedVolume) : 50); // 1~100
|
||||
|
||||
// Persistence & Sync
|
||||
watch(volume, (newVol) => {
|
||||
localStorage.setItem('qz-player-volume', newVol.toString());
|
||||
});
|
||||
// Sync initial volume to backend
|
||||
if (window.electronAPI?.qzplayer) {
|
||||
window.electronAPI.qzplayer.setVolume(volume.value).catch(console.error);
|
||||
}
|
||||
const duration = ref(0); //毫秒级
|
||||
const currentTime = ref(0); //毫秒级
|
||||
|
||||
// Audio Visualization State
|
||||
const loudness = ref(0);
|
||||
@@ -45,8 +56,10 @@ export const usePlayerStore = defineStore('player', () => {
|
||||
const MAX_RETRY_COUNT = 3;
|
||||
const hasRetriedWithFreshUrl = ref(false);
|
||||
|
||||
// --- Helpers ---
|
||||
// Lyrics State
|
||||
const lyrics = ref<{ lines: any[] }>({ lines: [] });
|
||||
|
||||
// --- Helpers ---
|
||||
const activateDummyAudio = async () => {
|
||||
if (dummyAudio.paused) {
|
||||
try {
|
||||
@@ -77,8 +90,6 @@ export const usePlayerStore = defineStore('player', () => {
|
||||
|
||||
// --- Actions ---
|
||||
|
||||
|
||||
|
||||
const setPlaylist = async (list: any[], startIndex = 0) => {
|
||||
playlist.value = list;
|
||||
currentIndex.value = startIndex;
|
||||
@@ -98,12 +109,13 @@ export const usePlayerStore = defineStore('player', () => {
|
||||
|
||||
await activateDummyAudio();
|
||||
updateMediaSession(song);
|
||||
fetchLyrics(song);
|
||||
|
||||
// 1. Get URL (Cache -> Network)
|
||||
// Get URL (Cache -> Network)
|
||||
let playUrl = song.url;
|
||||
if (song.type === 'Remote' && song.source) {
|
||||
// Use Local Proxy
|
||||
const quality = 'jymaster';
|
||||
const quality = 'hires';
|
||||
playUrl = `http://localhost:5266/music?source=${song.source}&id=${song.id}&quality=${quality}`;
|
||||
console.log('[Player] Using Proxy:', playUrl);
|
||||
}
|
||||
@@ -120,11 +132,33 @@ export const usePlayerStore = defineStore('player', () => {
|
||||
} catch (e) {
|
||||
// IPC call failed (rare), handle sync error
|
||||
console.error("IPC Play request failed:", e);
|
||||
handlePlayError();
|
||||
handlePlayError().then();
|
||||
}
|
||||
} else {
|
||||
console.warn("Song has no URL");
|
||||
handlePlayError();
|
||||
handlePlayError().then();
|
||||
}
|
||||
};
|
||||
|
||||
const fetchLyrics = async (song: Song) => {
|
||||
lyrics.value = { lines: [] }; // Reset
|
||||
if (!song || !song.id) return;
|
||||
try {
|
||||
// Check if plugin API exists
|
||||
if (window.electronAPI?.plugin?.getLyric) {
|
||||
const rawLyric = await window.electronAPI.plugin.getLyric(song.source || 'kw', song.id.toString());
|
||||
if (rawLyric) {
|
||||
const parsedLines = parseLyric(rawLyric);
|
||||
if (parsedLines) {
|
||||
lyrics.value = { lines: parsedLines };
|
||||
}
|
||||
console.log(lyrics)
|
||||
}
|
||||
} else {
|
||||
MessagePlugin.warning("当前插件不支持歌词获取").then()
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Failed to fetch lyrics:', e);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -145,7 +179,7 @@ export const usePlayerStore = defineStore('player', () => {
|
||||
|
||||
navigator.mediaSession.setActionHandler('seekto', (details) => {
|
||||
if (details.seekTime != null) {
|
||||
seek(details.seekTime);
|
||||
seek(details.seekTime).then();
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -182,7 +216,7 @@ export const usePlayerStore = defineStore('player', () => {
|
||||
|
||||
// Normal error handling
|
||||
playErrorCount.value++;
|
||||
hasRetriedWithFreshUrl.value = false; // Reset for next song
|
||||
hasRetriedWithFreshUrl.value = false;
|
||||
|
||||
if (playlist.value.length === 0) {
|
||||
isPlaying.value = false;
|
||||
@@ -191,13 +225,13 @@ export const usePlayerStore = defineStore('player', () => {
|
||||
return;
|
||||
}
|
||||
if (playErrorCount.value >= MAX_RETRY_COUNT) {
|
||||
window.electronAPI.qzplayer.pause();
|
||||
window.electronAPI.qzplayer.pause().then();
|
||||
isPlaying.value = false;
|
||||
MessagePlugin.error('连续多次播放失败,已停止播放');
|
||||
MessagePlugin.error('连续多次播放失败,已停止播放').then();
|
||||
playErrorCount.value = 0;
|
||||
syncDummyAudioState(false);
|
||||
} else {
|
||||
MessagePlugin.warning(`播放失败,尝试播放下一首 (${playErrorCount.value}/${MAX_RETRY_COUNT})`);
|
||||
MessagePlugin.warning(`播放失败,尝试播放下一首 (${playErrorCount.value}/${MAX_RETRY_COUNT})`).then();
|
||||
setTimeout(() => next(false), 500);
|
||||
}
|
||||
};
|
||||
@@ -209,11 +243,10 @@ export const usePlayerStore = defineStore('player', () => {
|
||||
if (data.name === 'pause') {
|
||||
const isPaused = data.data;
|
||||
isPlaying.value = !isPaused;
|
||||
// 核心:qzplayer 暂停 -> 同步暂停 Dummy -> 浏览器更新 SMTC 状态
|
||||
syncDummyAudioState(!isPaused);
|
||||
}
|
||||
if (data.name === 'time-pos') currentTime.value = data.data;
|
||||
if (data.name === 'duration') duration.value = data.data;
|
||||
if (data.name === 'time-pos') currentTime.value = data.data; //毫秒级
|
||||
if (data.name === 'duration') duration.value = data.data; //毫秒级
|
||||
if (data.name === 'loudness') loudness.value = data.data;
|
||||
if (data.name === 'spectrum') spectrum.value = data.data;
|
||||
}
|
||||
@@ -223,7 +256,7 @@ export const usePlayerStore = defineStore('player', () => {
|
||||
if (reason === 'eof') {
|
||||
next(false);
|
||||
} else if (reason === 'error') {
|
||||
handlePlayError();
|
||||
handlePlayError().then();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -271,6 +304,8 @@ export const usePlayerStore = defineStore('player', () => {
|
||||
setVolume,
|
||||
seek,
|
||||
toggleMode,
|
||||
toggleFullScreen
|
||||
toggleFullScreen,
|
||||
lyrics,
|
||||
fetchLyrics
|
||||
};
|
||||
});
|
||||
@@ -3,7 +3,6 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
@@ -16,6 +16,7 @@ export interface IElectronAPI {
|
||||
plugin: {
|
||||
call: (pluginId: string, method: string, args: any[]) => Promise<any>;
|
||||
search: (pluginId: string, query: string, page: number, limit: number) => Promise<any>;
|
||||
getLyric: (pluginId: string, id: string) => Promise<any>;
|
||||
};
|
||||
// Cache Control
|
||||
getCacheInfo: () => Promise<{ path: string; size: string; persistCache: boolean }>;
|
||||
@@ -2,10 +2,27 @@
|
||||
<div class="view-container search-view">
|
||||
<div class="content-wrapper">
|
||||
<div class="search-header">
|
||||
<h1 class="search-title">搜索: "{{ query }}"</h1>
|
||||
<span class="result-count">找到 {{ total }} 个结果</span>
|
||||
<div class="header-left">
|
||||
<h1 class="search-title">搜索: "{{ query }}"</h1>
|
||||
<span class="result-count">找到 {{ total }} 个结果</span>
|
||||
</div>
|
||||
<button class="icon-btn" @click="showSettings = !showSettings" :class="{ active: showSettings }" title="搜索设置">
|
||||
<Icon icon="lucide:settings-2" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<transition name="slide-fade">
|
||||
<div class="settings-panel" v-if="showSettings">
|
||||
<div class="setting-item">
|
||||
<span class="setting-label">每页显示: {{ limit }} 首</span>
|
||||
<div class="slider-container">
|
||||
<input type="range" min="10" max="100" step="10" v-model.number="limit" class="setting-slider">
|
||||
<div class="slider-track" :style="{ width: ((limit - 10) / 90) * 100 + '%' }"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<div class="song-list-container" v-if="!loading && songs.length > 0">
|
||||
<div class="list-header">
|
||||
<div class="col-index">#</div>
|
||||
@@ -71,19 +88,21 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, computed } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { Icon } from '@iconify/vue';
|
||||
import { usePlayerStore } from '../stores/player';
|
||||
import { transformSearchSong } from '../utils/songUtils';
|
||||
import type { Song } from '../types/song';
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const playerStore = usePlayerStore();
|
||||
|
||||
const query = computed(() => route.query.q as string || '');
|
||||
const currentPage = ref(1);
|
||||
const limit = ref(30);
|
||||
const showSettings = ref(false);
|
||||
const savedLimit = localStorage.getItem('qz-search-limit');
|
||||
const limit = ref(savedLimit ? Number(savedLimit) : 30);
|
||||
const total = ref(0);
|
||||
const loading = ref(false);
|
||||
const songs = ref<Song[]>([]);
|
||||
@@ -110,7 +129,7 @@ const visiblePages = computed(() => {
|
||||
start = Math.max(1, start - ((current + delta) - total));
|
||||
}
|
||||
|
||||
const pages = [];
|
||||
const pages: number[] = [];
|
||||
for (let i = start; i <= end; i++) {
|
||||
pages.push(i);
|
||||
}
|
||||
@@ -191,6 +210,12 @@ watch(query, () => {
|
||||
currentPage.value = 1;
|
||||
fetchData();
|
||||
}, { immediate: true });
|
||||
|
||||
watch(limit, (newLimit) => {
|
||||
localStorage.setItem('qz-search-limit', newLimit.toString());
|
||||
currentPage.value = 1;
|
||||
fetchData();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -210,6 +235,12 @@ watch(query, () => {
|
||||
|
||||
.search-header {
|
||||
margin-bottom: 24px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.header-left {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
@@ -239,6 +270,113 @@ watch(query, () => {
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
.icon-btn {
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: var(--color-text-secondary);
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 8px;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.icon-btn:hover {
|
||||
background: var(--color-bg-tertiary);
|
||||
color: var(--color-text-primary);
|
||||
}
|
||||
|
||||
.icon-btn.active {
|
||||
background: var(--color-bg-tertiary);
|
||||
color: var(--color-accent);
|
||||
}
|
||||
|
||||
/* Settings Panel */
|
||||
.settings-panel {
|
||||
background: var(--color-bg-secondary);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: 16px 20px;
|
||||
margin-bottom: 20px;
|
||||
border: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
.setting-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.setting-label {
|
||||
font-size: 14px;
|
||||
color: var(--color-text-secondary);
|
||||
min-width: 100px;
|
||||
}
|
||||
|
||||
.slider-container {
|
||||
position: relative;
|
||||
width: 200px;
|
||||
height: 4px;
|
||||
background: var(--color-bg-tertiary);
|
||||
border-radius: 2px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.setting-slider {
|
||||
appearance: none;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: transparent;
|
||||
top: 0;
|
||||
left: 0;
|
||||
margin: 0;
|
||||
z-index: 2;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.setting-slider::-webkit-slider-thumb {
|
||||
-webkit-appearance: none;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-radius: 50%;
|
||||
background: var(--color-accent);
|
||||
cursor: pointer;
|
||||
box-shadow: 0 0 4px rgba(0,0,0,0.2);
|
||||
}
|
||||
|
||||
.slider-track {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
background: var(--color-accent);
|
||||
border-radius: 2px;
|
||||
pointer-events: none;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.slide-fade-enter-active,
|
||||
.slide-fade-leave-active {
|
||||
transition: all 0.3s ease;
|
||||
max-height: 100px;
|
||||
overflow: hidden;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.slide-fade-enter-from,
|
||||
.slide-fade-leave-to {
|
||||
max-height: 0;
|
||||
opacity: 0;
|
||||
margin-bottom: 0;
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
border-width: 0;
|
||||
}
|
||||
|
||||
/* List Grid Layout */
|
||||
.list-header, .song-item {
|
||||
display: grid;
|
||||
@@ -1,24 +1,4 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"useDefineForClassFields": true,
|
||||
"module": "ESNext",
|
||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||
"skipLibCheck": true,
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "preserve",
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue", "electron"],
|
||||
"references": [{ "path": "./tsconfig.node.json" }]
|
||||
"files": [],
|
||||
"references": [{ "path": "./tsconfig.node.json" }, { "path": "./tsconfig.web.json" }]
|
||||
}
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
{
|
||||
"extends": "@electron-toolkit/tsconfig/tsconfig.node.json",
|
||||
"include": ["electron.vite.config.*", "src/main/**/*", "src/preload/**/*"],
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"skipLibCheck": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true
|
||||
},
|
||||
"include": ["vite.config.ts"]
|
||||
"types": ["electron-vite/node"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vueJsx from "@vitejs/plugin-vue-jsx";
|
||||
import path from 'node:path'
|
||||
import electron from 'vite-plugin-electron/simple'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import wasm from "vite-plugin-wasm";
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
resolve: {
|
||||
alias: {
|
||||
url: 'url',
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
vue(),
|
||||
vueJsx(),
|
||||
wasm(),
|
||||
electron({
|
||||
main: {
|
||||
// Shortcut of `build.lib.entry`.
|
||||
entry: 'electron/main.ts',
|
||||
},
|
||||
preload: {
|
||||
// Shortcut of `build.rollupOptions.input`.
|
||||
// Preload scripts may contain Web assets, so use the `build.rollupOptions.input` instead `build.lib.entry`.
|
||||
input: path.join(__dirname, 'electron/preload.ts'),
|
||||
},
|
||||
// Ployfill the Electron and Node.js API for Renderer process.
|
||||
// If you want use Node.js in Renderer process, the `nodeIntegration` needs to be enabled in the Main process.
|
||||
// See 👉 https://github.com/electron-vite/vite-plugin-electron-renderer
|
||||
renderer: process.env.NODE_ENV === 'test'
|
||||
// https://github.com/electron-vite/vite-plugin-electron-renderer/issues/78#issuecomment-2053600808
|
||||
? undefined
|
||||
: {},
|
||||
}),
|
||||
],
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user