feat: releases 版本接口 + 全站仓库链接修正

- 后端 /api/releases/latest 代理 gitea Releases(10min 缓存,无发布/不可达时回退 SUNDYNIX_FALLBACK_VERSION)
- 前端 use-release hook 就绪(下载区动态接线暂缓)
- 仓库链接统一指向 git.sundynix.cn/sundynix/sundynix-agentix,下载按钮 # 占位改为 releases 页

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Blizzard
2026-07-17 13:27:29 +08:00
parent 197f40448e
commit 85a0b44ddd
8 changed files with 213 additions and 7 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ const COLUMNS = [
title: 'RESOURCES',
links: [
{ label: '博客', href: '/blog', internal: true },
{ label: 'GitHub', href: SITE.github },
{ label: '源码仓库', href: SITE.repo },
{ label: 'RSS 订阅', href: '/rss.xml' },
],
},
+5 -4
View File
@@ -1,9 +1,10 @@
/** 站点文案与数据,改这里即可,不用动组件 */
export const SITE = {
/** 静态回退版本号;线上以 /api/releases/latest 为准 */
version: 'v0.1.2',
tagline: '事件驱动的 AI Agent 工作台',
github: 'https://github.com/sundynix/agentix',
repo: 'https://git.sundynix.cn/sundynix/sundynix-agentix',
icp: '滇ICP备2025056308号-1',
}
@@ -118,21 +119,21 @@ export const DOWNLOADS = [
os: 'macOS',
meta: 'universal · .app · v0.1.2',
action: '下载 .dmg',
href: '#',
href: `${SITE.repo}/releases`,
highlight: true,
},
{
os: 'Windows',
meta: 'x64 · .exe · v0.1.2',
action: '下载 .exe',
href: '#',
href: `${SITE.repo}/releases`,
highlight: false,
},
{
os: '自托管',
meta: 'docker compose · 全平台',
action: '部署文档',
href: '#',
href: SITE.repo,
highlight: false,
},
]
+53
View File
@@ -0,0 +1,53 @@
import { useEffect, useState } from 'react'
import { SITE } from '@/content/site'
export interface ReleaseInfo {
version: string
page_url: string
macos_url?: string
windows_url?: string
source: 'gitea' | 'fallback'
}
const STATIC_FALLBACK: ReleaseInfo = {
version: SITE.version,
page_url: `${SITE.repo}/releases`,
source: 'fallback',
}
// 模块级缓存:整个会话只请求一次,多处组件共享
let cache: ReleaseInfo | null = null
let inflight: Promise<ReleaseInfo> | null = null
function load(): Promise<ReleaseInfo> {
if (cache) return Promise.resolve(cache)
inflight ??= fetch('/api/releases/latest')
.then(async (res) => {
const body = (await res.json()) as { code: number; data: ReleaseInfo }
if (!res.ok || body.code !== 0) throw new Error('release api failed')
cache = body.data
return cache
})
.catch(() => {
cache = STATIC_FALLBACK
return cache
})
return inflight
}
/** 最新版本信息;请求完成前先给静态回退值,避免闪空 */
export function useRelease(): ReleaseInfo {
const [release, setRelease] = useState<ReleaseInfo>(cache ?? STATIC_FALLBACK)
useEffect(() => {
let cancelled = false
load().then((r) => {
if (!cancelled) setRelease(r)
})
return () => {
cancelled = true
}
}, [])
return release
}
+1 -1
View File
@@ -40,7 +40,7 @@ export function Hero() {
<Download className="size-4" />
</Link>
<a
href={SITE.github}
href={SITE.repo}
target="_blank"
rel="noreferrer"
className="inline-flex items-center rounded-lg border border-hairline-strong px-6 py-2.5 font-mono text-[14px] transition-colors hover:border-accent"
+1 -1
View File
@@ -24,7 +24,7 @@ export function Quickstart() {
<span className="text-white/35"># NATS</span>
{'\n'}
<span className="text-[#22d3ee]">$</span> git clone
https://github.com/sundynix/agentix{'\n'}
https://git.sundynix.cn/sundynix/sundynix-agentix{'\n'}
<span className="text-[#22d3ee]">$</span> make demo{'\n'}
{'\n'}
<span className="text-white/35"># </span>