mirror of
https://github.com/timeshiftsauce/CeruMusic.git
synced 2025-11-24 19:12:53 +08:00
fix: 禁止打开多实例,添加默认封面图,修复已知bug
This commit is contained in:
@@ -19,6 +19,7 @@ win:
|
||||
- target: nsis
|
||||
arch:
|
||||
- x64
|
||||
- ia32
|
||||
# 简化版本信息设置,避免rcedit错误
|
||||
fileAssociations:
|
||||
- ext: cerumusic
|
||||
@@ -30,7 +31,7 @@ win:
|
||||
# 或者使用证书存储
|
||||
# certificateSubjectName: "Your Company Name"
|
||||
nsis:
|
||||
artifactName: ${name}-${version}-setup.${ext}
|
||||
artifactName: ${name}-${version}-${arch}-setup.${ext}
|
||||
shortcutName: ${productName}
|
||||
uninstallDisplayName: ${productName}
|
||||
createDesktopShortcut: always
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ceru-music",
|
||||
"version": "1.2.4",
|
||||
"version": "1.2.5",
|
||||
"description": "一款简洁优雅的音乐播放器",
|
||||
"main": "./out/main/index.js",
|
||||
"author": "sqj,wldss,star",
|
||||
@@ -18,7 +18,8 @@
|
||||
"onlybuild": "electron-vite build && electron-builder --win --x64",
|
||||
"postinstall": "electron-builder install-app-deps",
|
||||
"build:unpack": "yarn run build && electron-builder --dir",
|
||||
"build:win": "yarn run build && electron-builder --win --x64 --config --publish never",
|
||||
"build:win": "yarn run build && electron-builder --win --config --publish never",
|
||||
"build:win32": "yarn run build && electron-builder --win --ia32 --config --publish never",
|
||||
"build:mac": "yarn run build && electron-builder --mac --config --publish never",
|
||||
"build:linux": "yarn run build && electron-builder --linux --config --publish never",
|
||||
"build:deps": "electron-builder install-app-deps && yarn run build && electron-builder --win --x64 --config",
|
||||
|
||||
BIN
resources/default-cover.png
Normal file
BIN
resources/default-cover.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 824 KiB |
@@ -8,6 +8,24 @@ import pluginService from './services/plugin'
|
||||
import aiEvents from './events/ai'
|
||||
import './services/musicSdk/index'
|
||||
|
||||
// 获取单实例锁
|
||||
const gotTheLock = app.requestSingleInstanceLock()
|
||||
|
||||
if (!gotTheLock) {
|
||||
// 如果没有获得锁,说明已经有实例在运行,退出当前实例
|
||||
app.quit()
|
||||
} else {
|
||||
// 当第二个实例尝试启动时,聚焦到第一个实例的窗口
|
||||
app.on('second-instance', () => {
|
||||
// 如果有窗口存在,聚焦到该窗口
|
||||
if (mainWindow) {
|
||||
if (mainWindow.isMinimized()) mainWindow.restore()
|
||||
if (!mainWindow.isVisible()) mainWindow.show()
|
||||
mainWindow.focus()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// import wy from './utils/musicSdk/wy/index'
|
||||
// import kg from './utils/musicSdk/kg/index'
|
||||
// wy.hotSearch.getList().then((res) => {
|
||||
|
||||
BIN
src/renderer/public/default-cover.png
Normal file
BIN
src/renderer/public/default-cover.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 824 KiB |
BIN
src/renderer/src/assets/logo.png
Normal file
BIN
src/renderer/src/assets/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
@@ -503,15 +503,17 @@ const handleLowFreqUpdate = (volume: number) => {
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 10%;
|
||||
left: 10%;
|
||||
width: 30%;
|
||||
height: 30%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background:
|
||||
radial-gradient(ellipse at 30% 30%,
|
||||
rgba(255, 255, 255, 0.15) 0%,
|
||||
rgba(255, 255, 255, 0.05) 40%,
|
||||
transparent 70%
|
||||
rgba(255, 255, 255, 0.08) 0%,
|
||||
rgba(255, 255, 255, 0.04) 25%,
|
||||
rgba(255, 255, 255, 0.02) 50%,
|
||||
rgba(255, 255, 255, 0.01) 75%,
|
||||
transparent 100%
|
||||
);
|
||||
border-radius: 50%;
|
||||
z-index: 2;
|
||||
|
||||
@@ -25,6 +25,7 @@ import {
|
||||
destroyPlaylistEventListeners,
|
||||
getSongRealUrl
|
||||
} from '@renderer/utils/playlistManager'
|
||||
import defaultCoverImg from '/default-cover.png'
|
||||
|
||||
const controlAudio = ControlAudioStore()
|
||||
const localUserStore = LocalUserDetailStore()
|
||||
@@ -702,22 +703,31 @@ async function setColor() {
|
||||
playbg.value = 'rgba(255,255,255,0.2)'
|
||||
playbghover.value = 'rgba(255,255,255,0.33)'
|
||||
}
|
||||
const bg = ref('#ffffff46')
|
||||
|
||||
watch(
|
||||
songInfo,
|
||||
async (newVal) => {
|
||||
bg.value = bg.value==='#ffffff'?'#ffffff46':toRaw(bg.value)
|
||||
if (newVal.img) {
|
||||
await setColor()
|
||||
} else if(songInfo.value.songmid) {
|
||||
songInfo.value.img = defaultCoverImg
|
||||
await setColor()
|
||||
}else{
|
||||
bg.value='#ffffff'
|
||||
}
|
||||
|
||||
},
|
||||
{ deep: true, immediate: true }
|
||||
)
|
||||
|
||||
const bg = ref('#ffffff46')
|
||||
watch(showFullPlay,(val)=>{
|
||||
if(val){
|
||||
|
||||
watch(showFullPlay, (val) => {
|
||||
if (val) {
|
||||
console.log('背景hei')
|
||||
bg.value = '#00000000'
|
||||
}else{
|
||||
bg.value = '#00000020'
|
||||
} else {
|
||||
bg.value = '#ffffff46'
|
||||
}
|
||||
})
|
||||
@@ -739,8 +749,9 @@ watch(showFullPlay,(val)=>{
|
||||
<div class="player-content">
|
||||
<!-- 左侧:封面和歌曲信息 -->
|
||||
<div class="left-section">
|
||||
<div class="album-cover" v-show="songInfo.img">
|
||||
<img :src="songInfo.img" alt="专辑封面" />
|
||||
<div class="album-cover" v-if="songInfo.albumId">
|
||||
<img :src="songInfo.img" alt="专辑封面" v-if="songInfo.img" />
|
||||
<img :src="defaultCoverImg" alt="默认封面" />
|
||||
</div>
|
||||
|
||||
<div class="song-info">
|
||||
@@ -813,7 +824,8 @@ watch(showFullPlay,(val)=>{
|
||||
</div>
|
||||
<div class="fullbox">
|
||||
<FullPlay :song-id="songInfo.songmid ? songInfo.songmid.toString() : null" :show="showFullPlay"
|
||||
:cover-image="songInfo.img" @toggle-fullscreen="toggleFullPlay" :song-info="songInfo" :main-color="maincolor" />
|
||||
:cover-image="songInfo.img" @toggle-fullscreen="toggleFullPlay"
|
||||
:song-info="songInfo" :main-color="maincolor" />
|
||||
</div>
|
||||
|
||||
<!-- 播放列表 -->
|
||||
|
||||
@@ -52,7 +52,7 @@ class AudioManager {
|
||||
// 创建分析器
|
||||
const analyser = context.createAnalyser()
|
||||
analyser.fftSize = fftSize
|
||||
analyser.smoothingTimeConstant = 0.9
|
||||
analyser.smoothingTimeConstant = 0.6
|
||||
|
||||
// 创建增益节点作为中介,避免直接断开主音频链
|
||||
const gainNode = context.createGain()
|
||||
|
||||
@@ -105,7 +105,7 @@ async function setPic(offset: number, source: string) {
|
||||
if (typeof url !== 'object') {
|
||||
searchResults.value[i].img = url
|
||||
} else {
|
||||
searchResults.value[i].img = 'resources/logo.png'
|
||||
searchResults.value[i].img = ''
|
||||
}
|
||||
} catch (e) {
|
||||
searchResults.value[i].img = 'logo.svg'
|
||||
|
||||
Reference in New Issue
Block a user