chore: 仓库内容更新为电脑端(pc)代码
16 个文件变更
+237
-98
fqh@fangqihang.cn
| •README.md | +1 -1 |
| •app.go | +3 -3 |
| •build/windows/installer/project.nsi | +2 -2 |
| •build/windows/installer/wails_tools.nsh | +1 -1 |
| •frontend/package-lock.json | +2 -2 |
| •frontend/package.json | +1 -1 |
| •frontend/package.json.md5 | +1 -1 |
| •frontend/src/App.vue | +0 -2 |
| •frontend/src/common/constants.js | +4 -2 |
| •frontend/src/common/music/index.js | +53 -1 |
| •frontend/src/common/player.js | +18 -4 |
| •frontend/src/{views/AboutView.vue => components/AboutSection.vue} | +37 -35 |
| •frontend/src/composables/useShell.js | +2 -2 |
| •frontend/src/uni/index.js | +23 -1 |
| •frontend/src/views/SettingsView.vue | +88 -39 |
| •wails.json | +1 -1 |
变更内容
diff --git a/README.md b/README.md
index aaa9736..a9cf493 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
聚合多平台音源 · 支持自定义音源脚本 · 歌单与音源云端同步
-[](https://git.kazx.top/fqh/starmusic-pc)
+[](https://git.kazx.top/fqh/starmusic-pc)
[](#-运行环境)
[](https://wails.io)
[](https://vuejs.org)
diff --git a/app.go b/app.go
index 176a4fb..79b6006 100644
--- a/app.go
+++ b/app.go
@@ -21,15 +21,15 @@ import (
)
// appVersion 桌面端版本号(与移动端 1.3.x 功能对齐)
-const appVersion = "1.3.6"
+const appVersion = "1.3.7"
// appVersionCode 桌面端版本代码。
// 服务端 api.php?action=check&v=<versionCode> 用它判断是否需要更新,
// 因此必须与发布时 update.json 的 versionCode 保持同一套编号(与移动端同源)。
-const appVersionCode = 136
+const appVersionCode = 137
const desktopUA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " +
- "(KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 StarmusicDesktop/1.3.6"
+ "(KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 StarmusicDesktop/1.3.7"
// App 是暴露给前端的 Wails 绑定对象。
// 所有方法都会被生成为 window.go.main.App.Xxx,前端通过 js-bridge 调用。
diff --git a/build/windows/installer/project.nsi b/build/windows/installer/project.nsi
index 4b2bba0..8010487 100644
--- a/build/windows/installer/project.nsi
+++ b/build/windows/installer/project.nsi
@@ -1,4 +1,4 @@
-Unicode true
+Unicode true
####
## 星音乐 PC 版 —— 安装包脚本
@@ -15,7 +15,7 @@ Unicode true
!define INFO_PROJECTNAME "starmusic-pc"
!define INFO_COMPANYNAME "仰望星辰工作室"
!define INFO_PRODUCTNAME "星音乐"
-!define INFO_PRODUCTVERSION "1.3.6"
+!define INFO_PRODUCTVERSION "1.3.7"
!define INFO_COPYRIGHT "Copyright (C) 2026 仰望星辰工作室"
## 可执行文件名保持 ASCII,避免个别环境下的路径处理异常
diff --git a/build/windows/installer/wails_tools.nsh b/build/windows/installer/wails_tools.nsh
index eca016e..05c0e14 100644
--- a/build/windows/installer/wails_tools.nsh
+++ b/build/windows/installer/wails_tools.nsh
@@ -14,7 +14,7 @@
!define INFO_PRODUCTNAME "星音乐"
!endif
!ifndef INFO_PRODUCTVERSION
- !define INFO_PRODUCTVERSION "1.3.6"
+ !define INFO_PRODUCTVERSION "1.3.7"
!endif
!ifndef INFO_COPYRIGHT
!define INFO_COPYRIGHT "Copyright (C) 2026 仰望星辰工作室"
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index aa1e1a7..9dd949a 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "starmusic-pc-frontend",
- "version": "1.3.6",
+ "version": "1.3.7",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "starmusic-pc-frontend",
- "version": "1.3.6",
+ "version": "1.3.7",
"dependencies": {
"vue": "^3.5.13"
},
diff --git a/frontend/package.json b/frontend/package.json
index b269b8c..d6892bf 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -1,7 +1,7 @@
{
"name": "starmusic-pc-frontend",
"private": true,
- "version": "1.3.6",
+ "version": "1.3.7",
"type": "module",
"scripts": {
"dev": "vite",
diff --git a/frontend/package.json.md5 b/frontend/package.json.md5
index 1c00c65..4833b5a 100644
--- a/frontend/package.json.md5
+++ b/frontend/package.json.md5
@@ -1 +1 @@
-3dae4ab5b844bbe2b14117dd6afe844b
\ No newline at end of file
+f8f6f9e09b79caf9bfc10ea15ba47cf4
\ No newline at end of file
diff --git a/frontend/src/App.vue b/frontend/src/App.vue
index 995aee0..1df665f 100644
--- a/frontend/src/App.vue
+++ b/frontend/src/App.vue
@@ -23,7 +23,6 @@ import SearchView from './views/SearchView.vue'
import PlaylistView from './views/PlaylistView.vue'
import SettingsView from './views/SettingsView.vue'
import AccountView from './views/AccountView.vue'
-import AboutView from './views/AboutView.vue'
import PlayDetailView from './views/PlayDetailView.vue'
import { initList } from './common/playlist.js'
@@ -55,7 +54,6 @@ const VIEW_MAP = {
playlists: PlaylistView,
settings: SettingsView,
account: AccountView,
- about: AboutView,
}
const currentComponent = shallowRef(SearchView)
diff --git a/frontend/src/common/constants.js b/frontend/src/common/constants.js
index ea13f85..1926f8e 100644
--- a/frontend/src/common/constants.js
+++ b/frontend/src/common/constants.js
@@ -74,6 +74,8 @@ export const STORAGE_KEYS = {
export const DEFAULT_SETTING = {
// 当前音源(内置源为空字符串,自定义源为 user_api_xxx)
'common.apiSource': '',
+ // 多音源兜底:备用音源 id 列表(按尝试顺序,空数组 = 关闭)
+ 'common.fallbackSources': [],
// 主题色(可选值见 common/theme.js 的 THEMES)
'common.theme': DEFAULT_THEME_ID,
// 自定义背景图片:开关与模糊程度(0-30,图片数据见 common/background.js)
@@ -100,10 +102,10 @@ export const DEFAULT_SETTING = {
// ============ 应用信息与在线更新 ============
/** 应用版本名(与 manifest.json versionName 保持一致;App 端以 plus.runtime 为准) */
-export const APP_VERSION = '1.3.6'
+export const APP_VERSION = '1.3.7'
/** 应用版本代码(与 manifest.json versionCode 保持一致) */
-export const APP_VERSION_CODE = 136
+export const APP_VERSION_CODE = 137
/** 在线更新接口地址(官网/api.php) */
export const UPDATE_API = 'https://starmusic.fangqihang.cn/api.php'
diff --git a/frontend/src/common/music/index.js b/frontend/src/common/music/index.js
index 9ea60da..d986afe 100644
--- a/frontend/src/common/music/index.js
+++ b/frontend/src/common/music/index.js
@@ -9,7 +9,7 @@
import { getLxGlobal, waitForApiInit } from '../user-api/api-executor.js'
import { getSetting } from '../setting.js'
import { searchMusic, getSourcePic, getSourceLyric } from '../music-sdk/index.js'
-import { STORAGE_KEYS } from '../constants.js'
+import { SOURCE_NAMES, STORAGE_KEYS } from '../constants.js'
import { getData, saveData } from '../data.js'
const QUALITYS = ['flac24bit', 'flac', 'wav', 'ape', '320k', '192k', '128k']
@@ -70,6 +70,54 @@ const trimUrlCache = () => {
for (const key of keys.slice(0, Math.floor(keys.length / 2))) urlCacheMemory.delete(key)
}
+/**
+ * 多音源兜底:当前源获取播放地址失败后,按用户设置的备用源顺序,
+ * 逐个跨源匹配同一首歌并尝试获取播放地址,直到某个源成功。
+ * 一轮全部失败时抛出汇总错误(由播放层统一 toast 提醒用户)。
+ * @returns 成功时返回备用源歌曲信息(含 url/quality/fallbackFrom)
+ */
+const tryFallbackSources = async (musicInfo, quality, originErr) => {
+ const fallbackIds = (getSetting()['common.fallbackSources'] || []).filter(
+ (id) => id && id !== musicInfo.source,
+ )
+ if (!fallbackIds.length) throw originErr
+
+ // 跨源搜索匹配同一首歌(一次搜索覆盖全部备用平台,失败则无法兜底)
+ let matched = []
+ try {
+ matched = await findMusic(musicInfo)
+ } catch (err) {
+ console.log('[fallback findMusic]', err.message)
+ }
+
+ const tried = []
+ for (const sid of fallbackIds) {
+ const api = getLxGlobal().apis[sid]
+ if (!api || !api.getMusicUrl) continue
+ const target = matched.find((m) => m.source === sid)
+ if (!target) continue
+ tried.push(sid)
+ try {
+ const info = await getApiMusicUrl(target, getMusicType(target, quality))
+ if (!info.url) throw new Error('返回空地址')
+ // 缓存备用源的地址(key 按备用源歌曲标识,主源缓存不受影响)
+ getUrlCache().set(`${sid}_${target.songmid || target.id}_${info.quality}`, info.url)
+ trimUrlCache()
+ console.log('[fallback]', musicInfo.source, '→', sid, '成功')
+ return { ...target, url: info.url, quality: info.quality, fallbackFrom: musicInfo.source }
+ } catch (err) {
+ console.log('[fallback]', sid, err.message)
+ }
+ }
+
+ // 一轮结束仍无源可用:汇总提醒
+ throw new Error(
+ tried.length
+ ? `所有音源均获取失败(已尝试:${tried.map((id) => SOURCE_NAMES[id] || id).join('、')})`
+ : `备用音源不可用(${originErr.message})`,
+ )
+}
+
/**
* 获取音乐 URL(核心入口)
* @param {object} param0
@@ -100,6 +148,10 @@ export const getMusicUrl = ({ musicInfo, quality, isRefresh = false }) => {
}
return info
})
+ .catch((err) => {
+ console.log('[getMusicUrl]', musicInfo.source, err.message, '→ 尝试多音源兜底')
+ return tryFallbackSources(musicInfo, targetQuality, err)
+ })
}
// ============ 歌词 ============
diff --git a/frontend/src/common/player.js b/frontend/src/common/player.js
index 0c9f9ef..2facdcf 100644
--- a/frontend/src/common/player.js
+++ b/frontend/src/common/player.js
@@ -10,9 +10,9 @@
import event from './event.js'
import { getSetting, updateSetting } from './setting.js'
import { getMusicUrl, getLyricInfo, getPicPath } from './music/index.js'
-import { PLAY_MODE_LIST } from './constants.js'
+import { PLAY_MODE_LIST, SOURCE_NAMES } from './constants.js'
import { getRandom } from './utils.js'
-import { addListMusics, LIST_IDS } from './playlist.js'
+import { addListMusics, LIST_IDS, normalizeMusicInfo } from './playlist.js'
let audio = null
let playMusicInfo = null // 当前播放音乐信息
@@ -198,9 +198,17 @@ const playCurrent = async () => {
event.emit('playerLyricUpdated', playLyricInfo)
event.emit('playerGettingUrl')
try {
+ const requested = playMusicInfo
const info = await getMusicUrl({ musicInfo: playMusicInfo, isRefresh: false })
if (!info.url) throw new Error('获取播放地址失败')
- playMusicInfo = { ...playMusicInfo, url: info.url }
+ if (info.fallbackFrom) {
+ // 多音源兜底成功:切换为备用源的歌曲条目(补 id 供列表/歌词/封面使用),并提示用户
+ playMusicInfo = normalizeMusicInfo(info)
+ uni.showToast({ title: `已切换至${SOURCE_NAMES[info.source] || info.source}播放`, icon: 'none', duration: 2000 })
+ event.emit('playerMusicInfoChanged', { musicInfo: playMusicInfo, playList, playIndex })
+ } else {
+ playMusicInfo = { ...requested, url: info.url }
+ }
audio.src = toPlayUrl(info.url)
// URL 获取期间用户可能已点击暂停(isPlay 被乐观置 false),此时不应自动播放
if (isPlay) safePlay()
@@ -265,7 +273,13 @@ export const refreshPlayUrl = async ({ quality, isRefresh = true } = {}) => {
// 换源期间用户可能已切歌,此时放弃本次结果
if (!playMusicInfo || playMusicInfo.id !== targetId) return false
- playMusicInfo = { ...playMusicInfo, url: info.url, quality: info.quality }
+ if (info.fallbackFrom) {
+ // 多音源兜底成功:切换为备用源的歌曲条目并提示
+ playMusicInfo = normalizeMusicInfo(info)
+ uni.showToast({ title: `已切换至${SOURCE_NAMES[info.source] || info.source}播放`, icon: 'none', duration: 2000 })
+ } else {
+ playMusicInfo = { ...playMusicInfo, url: info.url, quality: info.quality }
+ }
audio.src = toPlayUrl(info.url)
// 正在播放则续播:先 seek 到原进度(onCanplay 触发时执行)
if (wasPlaying) {
diff --git a/frontend/src/views/AboutView.vue b/frontend/src/components/AboutSection.vue
similarity index 91%
rename from frontend/src/views/AboutView.vue
rename to frontend/src/components/AboutSection.vue
index 00e4868..d3ef711 100644
--- a/frontend/src/views/AboutView.vue
+++ b/frontend/src/components/AboutSection.vue
@@ -1,13 +1,14 @@
<script setup>
/**
- * AboutView — 关于
+ * AboutSection — 关于板块(嵌入设置页)
*
- * 品牌介绍 + 星空主题装饰卡 + 隐藏彩蛋(连点版本号 7 次触发「星辰跳一跳」)。
- * 页面刻意使用深色星空风格,与全局浅色主题区分,作为「惊喜」时刻。
+ * 由原独立「关于」页整体迁移而来:品牌介绍 + 星空主题装饰卡 +
+ * 隐藏彩蛋(连点版本号 7 次触发「星辰跳一跳」)。
+ * 刻意使用深色星空风格,与设置页的浅色卡片形成反差,作为「惊喜」时刻。
*/
-import { ref, computed, onMounted, onBeforeUnmount } from 'vue'
+import { ref, onBeforeUnmount } from 'vue'
import Icon from '../components/Icon.vue'
-import StarJumpGame from '../components/StarJumpGame.vue'
+import StarJumpGame from './StarJumpGame.vue'
import { getAppVersion } from '../common/update.js'
import { currentTheme } from '../composables/useTheme.js'
import { toast, toastOk } from '../composables/useFeedback.js'
@@ -82,7 +83,7 @@ const stack = [
</script>
<template>
- <div class="view-about view-scroll scroll-y">
+ <div class="about-section">
<div class="sky-deco">
<span
v-for="s in stars"
@@ -101,7 +102,7 @@ const stack = [
<div class="inner">
<!-- ============ 品牌 ============ -->
- <section class="hero a-fade-up">
+ <section class="hero">
<div class="logo">
<span class="logo-mark">
<Icon name="music2" :size="34" :width="2" />
@@ -119,7 +120,7 @@ const stack = [
</section>
<!-- ============ 星空寄语卡 ============ -->
- <section class="star-card a-fade-up" style="--delay: 80ms">
+ <section class="star-card">
<div class="card-sky">
<span class="moon" />
<span class="shooting" />
@@ -156,7 +157,7 @@ const stack = [
</TransitionGroup>
<!-- ============ 技术栈 ============ -->
- <section class="stack a-fade-up" style="--delay: 160ms">
+ <section class="stack">
<div v-for="item in stack" :key="item.label" class="stack-item">
<span class="stack-icon"><Icon :name="item.icon" :size="15" /></span>
<span class="stack-label">{{ item.label }}</span>
@@ -165,7 +166,7 @@ const stack = [
</section>
<!-- ============ 责任声明 ============ -->
- <section class="notice a-fade-up" style="--delay: 220ms">
+ <section class="notice">
<p class="notice-title">
<Icon name="info" :size="14" />
责任声明
@@ -177,7 +178,7 @@ const stack = [
</section>
<!-- ============ 页脚(彩蛋入口) ============ -->
- <footer class="foot a-fade-up" style="--delay: 280ms">
+ <footer class="foot">
<button class="ver-btn press" title="嗯?多点几下试试" @click="handleVersionTap">
<Icon name="star4" :size="13" />
<span>v{{ version }}</span>
@@ -210,13 +211,14 @@ const stack = [
</template>
<style scoped>
-.view-about {
+.about-section {
position: relative;
- height: 100%;
- min-height: 0;
- padding: 26px 32px 40px;
+ margin-top: 14px;
+ padding: 22px 20px 24px;
+ border-radius: var(--r-xl);
background: radial-gradient(120% 80% at 20% 0%, #1a2740 0%, #121c2c 42%, #0d141f 100%);
- overflow-x: hidden;
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ overflow: hidden;
}
.sky-deco {
@@ -236,7 +238,7 @@ const stack = [
.inner {
position: relative;
z-index: 2;
- max-width: 820px;
+ max-width: 760px;
margin: 0 auto;
display: flex;
flex-direction: column;
@@ -250,24 +252,24 @@ const stack = [
flex-direction: column;
align-items: center;
text-align: center;
- padding: 14px 0 6px;
+ padding: 6px 0 2px;
}
.logo {
position: relative;
display: grid;
place-items: center;
- width: 84px;
- height: 84px;
- margin-bottom: 18px;
+ width: 72px;
+ height: 72px;
+ margin-bottom: 14px;
}
.logo-mark {
display: grid;
place-items: center;
- width: 84px;
- height: 84px;
- border-radius: 26px;
+ width: 72px;
+ height: 72px;
+ border-radius: 22px;
color: #fff;
background: linear-gradient(140deg, var(--theme-color), var(--theme-color-dark));
box-shadow: 0 16px 40px rgba(var(--theme-color-rgb), 0.42);
@@ -276,14 +278,14 @@ const stack = [
.logo-ring {
position: absolute;
- inset: -12px;
- border-radius: 38px;
+ inset: -10px;
+ border-radius: 32px;
border: 1.5px solid rgba(var(--theme-color-rgb), 0.4);
animation: kPulseRing 3.6s var(--ease-out) infinite;
}
.hero h1 {
- font-size: 30px;
+ font-size: 26px;
font-weight: 700;
letter-spacing: 7px;
text-indent: 7px;
@@ -291,7 +293,7 @@ const stack = [
}
.hero-sub {
- margin-top: 9px;
+ margin-top: 8px;
font-size: 12.5px;
letter-spacing: 1.4px;
color: rgba(226, 236, 250, 0.6);
@@ -302,7 +304,7 @@ const stack = [
flex-wrap: wrap;
justify-content: center;
gap: 7px;
- margin-top: 16px;
+ margin-top: 14px;
}
.tag {
@@ -367,11 +369,11 @@ const stack = [
.card-content {
position: relative;
z-index: 2;
- padding: 30px 28px;
+ padding: 26px 24px;
}
.card-title {
- font-size: 18px;
+ font-size: 17px;
font-weight: 600;
letter-spacing: 1.4px;
color: #fff;
@@ -421,7 +423,7 @@ const stack = [
.stack {
display: grid;
- grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
+ grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
gap: 10px;
}
@@ -429,7 +431,7 @@ const stack = [
display: flex;
flex-direction: column;
gap: 6px;
- padding: 14px 16px;
+ padding: 13px 15px;
border-radius: var(--r-lg);
background: rgba(255, 255, 255, 0.05);
border: 1px solid rgba(255, 255, 255, 0.09);
@@ -459,7 +461,7 @@ const stack = [
/* ---------- 声明 ---------- */
.notice {
- padding: 16px 18px;
+ padding: 15px 17px;
border-radius: var(--r-lg);
background: rgba(255, 255, 255, 0.04);
border: 1px solid rgba(255, 255, 255, 0.08);
@@ -489,7 +491,7 @@ const stack = [
justify-content: center;
flex-wrap: wrap;
gap: 8px;
- padding: 10px 0 4px;
+ padding: 8px 0 2px;
font-size: 11.5px;
color: rgba(226, 236, 250, 0.5);
}
diff --git a/frontend/src/composables/useShell.js b/frontend/src/composables/useShell.js
index 4004f2f..1b8baec 100644
--- a/frontend/src/composables/useShell.js
+++ b/frontend/src/composables/useShell.js
@@ -12,7 +12,6 @@ export const NAV_ITEMS = [
{ key: 'playlists', label: '我的歌单', icon: 'list-music', desc: '试听列表 / 收藏 / 自建歌单' },
{ key: 'settings', label: '设置', icon: 'settings', desc: '音源、播放、外观与诊断' },
{ key: 'account', label: '账号与云同步', icon: 'user', desc: '登录后同步歌单与音源' },
- { key: 'about', label: '关于', icon: 'star', desc: '仰望星辰工作室出品' },
]
const VIEW_KEYS = NAV_ITEMS.map((v) => v.key)
@@ -100,7 +99,8 @@ export function registerUniRouterBridge() {
if (path.indexOf('my-list') >= 0) return go('playlists')
if (path.indexOf('setting') >= 0) return go('settings')
if (path.indexOf('account') >= 0) return go('account')
- if (path.indexOf('about') >= 0) return go('about')
+ // 关于页已并入设置页的「关于」板块
+ if (path.indexOf('about') >= 0) return go('settings')
return undefined
},
back() {
diff --git a/frontend/src/uni/index.js b/frontend/src/uni/index.js
index 47a36a5..68969f1 100644
--- a/frontend/src/uni/index.js
+++ b/frontend/src/uni/index.js
@@ -34,6 +34,19 @@ const STORE_PREFIX = 'starmusic_'
/** 内存表:所有读写先经过内存,保证同步语义与跨模块一致性 */
const memory = new Map()
const dirty = new Set()
+/**
+ * 墓碑:已从内存删除、但尚未落盘的键。
+ *
+ * 落盘是防抖的(260ms),而 getStorageSync 在内存未命中时会回读 localStorage
+ * (用于兼容「外部刚写入」的场景)。若无墓碑保护,「删除 → 立刻读取」会把磁盘上
+ * 尚未删除的旧值重新载入内存,删除被静默撤销:
+ * 退出登录时 clearLogin 删掉 token,AccountView 紧接着 refreshAccount 读一次
+ * → token 复活,界面仍显示已登录;而服务端 token 已被 logout 作废,
+ * 于是备份/恢复全部失败。
+ * 同理会影响 removeUserApi(删源脚本后立刻备份,脚本残留)。
+ * 墓碑在真正落盘(flush)后清除。
+ */
+const tombstones = new Set()
let flushTimer = null
/** 启动时一次性把 localStorage 里的业务数据载入内存 */
@@ -71,6 +84,8 @@ const flush = () => {
pushToast({ title: '本地存储空间不足,请清理封面或歌词缓存', icon: 'none', duration: 3600 })
}
}
+ // 磁盘已与内存一致,解除墓碑(否则该键会被永久屏蔽读取)
+ tombstones.delete(key)
}
}
@@ -98,6 +113,8 @@ const getStorageSync = (key) => {
const value = memory.get(key)
return value === undefined || value === null ? '' : value
}
+ // 墓碑键:内存已删、磁盘未删,禁止回读,否则删除会被撤销
+ if (tombstones.has(key)) return ''
// 内存未命中:可能是外部(如导入备份)刚写入,直接读一次 localStorage
try {
const raw = localStorage.getItem(key)
@@ -117,8 +134,11 @@ const getStorageSync = (key) => {
const setStorageSync = (key, value) => {
if (!key) return
+ tombstones.delete(key)
if (value === undefined || value === null) {
+ // 与 removeStorageSync 同义:空值即删除,同样需要墓碑防止旧值复活
memory.delete(key)
+ tombstones.add(key)
} else {
memory.set(key, value)
}
@@ -129,6 +149,7 @@ const setStorageSync = (key, value) => {
const removeStorageSync = (key) => {
if (!key) return
memory.delete(key)
+ tombstones.add(key)
dirty.add(key)
scheduleFlush()
}
@@ -136,6 +157,7 @@ const removeStorageSync = (key) => {
const clearStorageSync = () => {
for (const key of [...memory.keys()]) {
memory.delete(key)
+ tombstones.add(key)
dirty.add(key)
}
scheduleFlush()
@@ -622,7 +644,7 @@ const getSystemInfoSync = () => {
safeAreaInsets: { top: 0, bottom: 0, left: 0, right: 0 },
pixelRatio: typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1,
language: 'zh-Hans',
- version: '1.3.6',
+ version: '1.3.7',
}
}
diff --git a/frontend/src/views/SettingsView.vue b/frontend/src/views/SettingsView.vue
index 5c5d85a..1bba67d 100644
--- a/frontend/src/views/SettingsView.vue
+++ b/frontend/src/views/SettingsView.vue
@@ -5,7 +5,7 @@
* 与移动端对齐的全部设置项:音源(当前源 / 导入 / 已导入源管理)、播放(模式 / 音质 / 倍速)、
* 外观(主题色 / 背景图)、诊断(运行日志 / 配置目录 / 导出)、关于(版本 / 检查更新 / 赞助)。
*/
-import { ref, computed, onMounted, onBeforeUnmount } from 'vue'
+import { ref, computed, watch, onMounted, onBeforeUnmount } from 'vue'
import Icon from '../components/Icon.vue'
import UiSwitch from '../components/UiSwitch.vue'
import UiSlider from '../components/UiSlider.vue'
@@ -13,6 +13,7 @@ import UiDialog from '../components/UiDialog.vue'
import UiContextMenu from '../components/UiContextMenu.vue'
import CustomSourceImport from '../components/CustomSourceImport.vue'
import CoverImage from '../components/CoverImage.vue'
+import AboutSection from '../components/AboutSection.vue'
import { getSetting, updateSetting } from '../common/setting.js'
import { getLocalAccount, isLoggedIn } from '../common/account.js'
@@ -22,7 +23,7 @@ import { setApiSource } from '../common/api-source.js'
import { getLogs, getLogCount, clearLogs, onLogChange, formatLogsForCopy } from '../common/user-api/logger.js'
import { getAppVersion, checkUpdateDetail, promptUpdate, startUpdate } from '../common/update.js'
import { chooseBgImage, clearBgImage, getBgImage } from '../common/background.js'
-import { PLAY_MODE, PLAY_MODE_LIST, SOURCE_NAMES } from '../common/constants.js'
+import { PLAY_MODE, PLAY_MODE_LIST, SOURCE_NAMES, SOURCES } from '../common/constants.js'
import { playerActions, playerState } from '../composables/usePlayer.js'
import { THEMES, appearance, applyTheme } from '../composables/useTheme.js'
import { go } from '../composables/useShell.js'
@@ -131,6 +132,32 @@ const onSourceSelect = (id) => {
toast(id ? `已启用「${(userApiList.value.find((a) => a.id === id) || {}).name || id}」` : '已切换为内置搜索源', 'none', 1800)
}
+// ============ 多音源兜底 ============
+
+// 备用源列表(数组非空即开启,元素顺序即尝试优先级)
+const fallbackList = ref(getSetting()['common.fallbackSources'] || [])
+const fallbackEnabled = computed(() => fallbackList.value.length > 0)
+const fallbackSourceOptions = SOURCES
+
+const saveFallbackList = (list) => {
+ fallbackList.value = list
+ updateSetting({ 'common.fallbackSources': [...list] })
+ refreshSetting()
+}
+
+const onFallbackToggle = (on) => {
+ saveFallbackList(on ? SOURCES.map((s) => s.id) : [])
+ toast(on ? '已开启多音源兜底' : '已关闭多音源兜底', 'none', 1500)
+}
+
+const toggleFallbackSource = (id) => {
+ saveFallbackList(
+ fallbackList.value.includes(id)
+ ? fallbackList.value.filter((s) => s !== id)
+ : [...fallbackList.value, id],
+ )
+}
+
const enableApi = (api) => {
setApiSource(api.id)
currentApiId.value = api.id
@@ -250,29 +277,47 @@ const onBlurChange = (v) => {
const logsVisible = ref(false)
const logs = ref([])
+const logCount = ref(getLogCount())
let offLog = null
let logTimer = null
+let logCountTimer = null
const refreshLogs = () => {
logs.value = getLogs()
+ logCount.value = getLogCount()
}
-const onLogOpen = (open) => {
- if (open) {
- refreshLogs()
- offLog = onLogChange(() => {
- if (logTimer) return
- logTimer = setTimeout(() => {
- logTimer = null
- refreshLogs()
- }, 300)
- })
- } else if (offLog) {
- offLog()
+/**
+ * 打开/关闭日志弹窗时统一处理取数与订阅。
+ *
+ * 不能依赖 UiDialog 的 @update:visible:它只在「关闭」时派发事件(见 UiDialog
+ * requestClose),打开动作是父组件直接把 logsVisible 置 true,组件不会回抛 open。
+ * 那样挂上去的 onLogOpen 只会收到 false,refreshLogs 从未执行,弹窗里永远是
+ * 初始的空数组 —— 而「导出文件 / 复制全部」直读 logger 模块,所以 txt 里有内容。
+ * 与其依赖不对称的事件流,不如以 visible 状态为唯一真源。
+ */
+watch(logsVisible, (open) => {
+ if (logTimer) {
+ clearTimeout(logTimer)
+ logTimer = null
+ }
+ if (!open) {
+ if (offLog) offLog()
offLog = null
+ return
}
-}
+ refreshLogs()
+ if (offLog) offLog()
+ offLog = onLogChange(() => {
+ if (logTimer) return
+ // 日志产生频繁,合并 300ms 内的多次变更再整体重渲染
+ logTimer = setTimeout(() => {
+ logTimer = null
+ refreshLogs()
+ }, 300)
+ })
+})
const logTypeText = (type) => {
const map = { log: '脚本', init: '初始化', request: '请求', response: '返回', error: '错误', http: '网络' }
@@ -420,9 +465,6 @@ onBeforeUnmount(() => {
if (logTimer) clearTimeout(logTimer)
if (logCountTimer) clearInterval(logCountTimer)
})
-
-const logCount = ref(getLogCount())
-let logCountTimer = null
</script>
<template>
@@ -462,6 +504,32 @@ let logCountTimer = null
</button>
</div>
+ <div class="row">
+ <div class="row-label">
+ <span class="label">多音源兜底</span>
+ <span class="desc">当前源获取播放地址失败时,自动尝试其他音源</span>
+ </div>
+ <UiSwitch :model-value="fallbackEnabled" @update:model-value="onFallbackToggle" />
+ </div>
+
+ <div v-if="fallbackEnabled" class="row col">
+ <div class="row-label">
+ <span class="label">备用音源</span>
+ <span class="desc">按点击顺序依次尝试,全部失败时提示</span>
+ </div>
+ <div class="chips">
+ <button
+ v-for="s in fallbackSourceOptions"
+ :key="s.id"
+ class="chip"
+ :class="{ 'is-on': fallbackList.includes(s.id) }"
+ @click="toggleFallbackSource(s.id)"
+ >
+ {{ s.name }}
+ </button>
+ </div>
+ </div>
+
<div class="row">
<div class="row-label">
<span class="label">导入自定义音源</span>
@@ -743,17 +811,6 @@ let logCountTimer = null
</button>
</div>
- <div class="row">
- <div class="row-label">
- <span class="label">关于星音乐</span>
- <span class="desc">产品介绍与隐藏彩蛋</span>
- </div>
- <button class="mini-btn press" @click="go('about')">
- <Icon name="star" :size="14" />
- <span>查看</span>
- </button>
- </div>
-
<div class="row">
<div class="row-label">
<span class="label">赞助项目</span>
@@ -765,7 +822,8 @@ let logCountTimer = null
</button>
</div>
- <p class="copyright">© 2026 仰望星辰工作室 · 仅供学习交流,音乐版权归原作者所有</p>
+ <!-- 品牌介绍 / 星空寄语 / 隐藏彩蛋(原独立「关于」页整体迁入) -->
+ <AboutSection />
</section>
</div>
@@ -788,8 +846,6 @@ let logCountTimer = null
title="自定义源运行日志"
:subtitle="`共 ${logs.length} 条(仅保留本次运行)`"
:width="720"
- @update:visible="onLogOpen"
- @close="onLogOpen(false)"
>
<div class="log-list">
<p v-if="!logs.length" class="log-empty">暂无日志</p>
@@ -1320,13 +1376,6 @@ let logCountTimer = null
color: var(--text-5);
}
-.copyright {
- padding: 14px 0 18px;
- font-size: 11.5px;
- color: var(--text-5);
- text-align: center;
-}
-
/* ---------- 日志 ---------- */
.log-list {
diff --git a/wails.json b/wails.json
index 335de8d..2858984 100644
--- a/wails.json
+++ b/wails.json
@@ -13,7 +13,7 @@
"info": {
"companyName": "仰望星辰工作室",
"productName": "星音乐",
- "productVersion": "1.3.6",
+ "productVersion": "1.3.7",
"copyright": "Copyright (C) 2026 仰望星辰工作室",
"comments": "基于 Wails 的跨平台音乐播放器"
}