feat: 检测软件更新地址需要传入变量

This commit is contained in:
hzm
2026-02-25 09:50:56 +08:00
parent 43206e816f
commit d73a9ef9fa
8 changed files with 23 additions and 3 deletions

View File

@@ -432,7 +432,10 @@ export const fetchShanghaiIndexDate = async () => {
};
export const fetchLatestRelease = async () => {
const res = await fetch('https://api.github.com/repos/hzm0321/real-time-fund/releases/latest');
const url = process.env.NEXT_PUBLIC_GITHUB_LATEST_RELEASE_URL;
if (!url) return null;
const res = await fetch(url);
if (!res.ok) return null;
const data = await res.json();
return {

View File

@@ -460,6 +460,9 @@ export default function HomePage() {
const [isSyncing, setIsSyncing] = useState(false);
useEffect(() => {
// 未配置 GitHub 最新版本接口地址时,不进行更新检查
if (!process.env.NEXT_PUBLIC_GITHUB_LATEST_RELEASE_URL) return;
const checkUpdate = async () => {
try {
const data = await fetchLatestRelease();