移除返回旧版入口和相关代码

This commit is contained in:
eafonyang
2026-08-17 14:56:42 +08:00
parent 8ca8128e2b
commit fac0dc0c19
8 changed files with 30 additions and 18 deletions
+24 -10
View File
@@ -36,7 +36,6 @@ import {
Sliders,
Activity,
Gauge,
Undo2,
Bluetooth,
SkipBack,
SkipForward,
@@ -195,12 +194,35 @@ export default function Home() {
const [volumeConfirm, setVolumeConfirm] = useState<null | "min" | "max">(null);
const [easterEggActive, setEasterEggActive] = useState(false);
const [vuHeights, setVuHeights] = useState<number[]>(idleVuBarHeights);
/** 更新说明入口展示的最新版本号(取自 changelog.md 首个 "## v..." 标题) */
const [changelogVersion, setChangelogVersion] = useState<string | null>(null);
const jackProgressRef = useRef(0);
const jackResetTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
const eggRafRef = useRef<number | null>(null);
/** 下次三连击成功时播放的律动:1=旋律,2=海浪(各需单独三连击触发) */
const jackEggNextRef = useRef<1 | 2>(1);
// 拉取更新说明首个版本号,静默降级(失败则入口不显示版本)
useEffect(() => {
let cancelled = false;
fetch(`${import.meta.env.BASE_URL}changelog.md`)
.then((res) => {
if (!res.ok) throw new Error(`HTTP ${res.status}`);
return res.text();
})
.then((text) => {
if (cancelled) return;
const m = text.match(/^##\s+(v[^\s#]+)\s*$/m);
if (m) setChangelogVersion(m[1]);
})
.catch(() => {
/* 静默:入口不显示版本号 */
});
return () => {
cancelled = true;
};
}, []);
const homeText = useMemo((): HomeLocale => {
if (!deviceState) return {} as HomeLocale;
const loc =
@@ -956,18 +978,10 @@ export default function Home() {
thumbnail={`${import.meta.env.BASE_URL}images/vu/vu${(ds.vu ?? 0) + 1}.png`}
onClick={() => setLocation("/vu")}
/>
<ListRow
icon={<Undo2 size={18} />}
label={homeText.backToLegacy ?? "返回旧版"}
onClick={() => {
const target = ip.trim();
if (!target) return;
window.location.href = `https://am.luxsinaudio.com/i.html?ip=${encodeURIComponent(target)}`;
}}
/>
<ListRow
icon={<BookOpenCheck size={18} />}
label={homeText.changelog ?? "更新说明"}
value={changelogVersion ?? undefined}
onClick={() => setLocation("/changelog")}
/>
</div>