This commit is contained in:
@@ -2,6 +2,20 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## [v1.6.9] - 2026-09-28
|
||||||
|
|
||||||
|
### 修复
|
||||||
|
|
||||||
|
- **测试连接未使用当前输入的 Account ID**:测试连接原先只读取数据库中已保存的 Account ID,未保存直接点测试会误报「请先填写 Account ID」。现在前端会把输入框里的 Account ID 与 API Token 一起提交,后端优先使用输入值,留空时才回退到已保存配置
|
||||||
|
|
||||||
|
### 变更
|
||||||
|
|
||||||
|
- 版本号提升到 1.6.9;`AgentVersion` 保持 **0.14.1**
|
||||||
|
|
||||||
|
### 测试
|
||||||
|
|
||||||
|
- `go test ./...`、`go vet ./...`、`npm run typecheck`、`npm test`、`npm run build` 通过
|
||||||
|
|
||||||
## [v1.6.8] - 2026-09-28
|
## [v1.6.8] - 2026-09-28
|
||||||
|
|
||||||
### 变更
|
### 变更
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
# Fonu 文档索引
|
# Fonu 文档索引
|
||||||
|
|
||||||
> 维护约定:新增方案 / 审查文档时在下方登记;方案落地后在「状态」列标注实施结果,并给已被推翻的描述加时效说明。
|
> 维护约定:新增方案 / 审查文档时在下方登记;方案落地后在「状态」列标注实施结果,并给已被推翻的描述加时效说明。
|
||||||
> 最近更新:2026-09-28(v1.6.8)
|
> 最近更新:2026-09-28(v1.6.9)
|
||||||
|
|
||||||
## 方案与设计(本目录)
|
## 方案与设计(本目录)
|
||||||
|
|
||||||
|
|||||||
@@ -238,16 +238,16 @@ FONU_VERSION=<旧版本> docker compose up -d --no-deps --force-recreate fonu
|
|||||||
|
|
||||||
## 10. 在线升级验证
|
## 10. 在线升级验证
|
||||||
|
|
||||||
示例页面用于验证升级结果。v1.6.8 的验证流程:
|
示例页面用于验证升级结果。v1.6.9 的验证流程:
|
||||||
|
|
||||||
1. 确认当前线上实例为 v1.3.0,且 `fonu-updater` sidecar 已运行。
|
1. 确认当前线上实例为 v1.3.0,且 `fonu-updater` sidecar 已运行。
|
||||||
2. 确认远端 `main` 分支的 `VERSION` 为 `1.6.8`。
|
2. 确认远端 `main` 分支的 `VERSION` 为 `1.6.9`。
|
||||||
3. 在侧栏看到「一键升级」后点击并确认。
|
3. 在侧栏看到「一键升级」后点击并确认。
|
||||||
4. 等待升级弹窗显示成功,页面自动刷新。
|
4. 等待升级弹窗显示成功,页面自动刷新。
|
||||||
5. 打开侧栏「示例页面」,确认:
|
5. 打开侧栏「示例页面」,确认:
|
||||||
- 页面路由为 `/example`;
|
- 页面路由为 `/example`;
|
||||||
- 页面显示的版本为 `1.6.8`;
|
- 页面显示的版本为 `1.6.9`;
|
||||||
- 页面显示验证标识 `v1.6.8-example-page`;
|
- 页面显示验证标识 `v1.6.9-example-page`;
|
||||||
- 页面显示独立的「本次升级验证」区块;
|
- 页面显示独立的「本次升级验证」区块;
|
||||||
- 「升级验证」显示为「通过」。
|
- 「升级验证」显示为「通过」。
|
||||||
|
|
||||||
|
|||||||
@@ -191,6 +191,7 @@ func (h *CloudflareHandler) SaveAppSettings(w http.ResponseWriter, r *http.Reque
|
|||||||
|
|
||||||
func (h *CloudflareHandler) TestToken(w http.ResponseWriter, r *http.Request) {
|
func (h *CloudflareHandler) TestToken(w http.ResponseWriter, r *http.Request) {
|
||||||
var request struct {
|
var request struct {
|
||||||
|
AccountID string `json:"account_id"`
|
||||||
Token string `json:"token"`
|
Token string `json:"token"`
|
||||||
Kind string `json:"kind"`
|
Kind string `json:"kind"`
|
||||||
}
|
}
|
||||||
@@ -198,7 +199,7 @@ func (h *CloudflareHandler) TestToken(w http.ResponseWriter, r *http.Request) {
|
|||||||
writeError(r, w, http.StatusBadRequest, "请求格式无效")
|
writeError(r, w, http.StatusBadRequest, "请求格式无效")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
message, err := h.svc.TestToken(r.Context(), request.Token, request.Kind)
|
message, err := h.svc.TestToken(r.Context(), request.AccountID, request.Token, request.Kind)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
writeError(r, w, http.StatusBadGateway, err.Error())
|
writeError(r, w, http.StatusBadGateway, err.Error())
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -297,12 +297,16 @@ func (s *Service) cloudflareAPI(ctx context.Context) (*CloudflareAPI, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// VerifyAPIToken 用 Account ID + API Token 调用 Cloudflare 账号级 tokens/verify 接口。
|
// VerifyAPIToken 用 Account ID + API Token 调用 Cloudflare 账号级 tokens/verify 接口。
|
||||||
func (s *Service) VerifyAPIToken(ctx context.Context, input string) (string, error) {
|
// accountID / input 为空时回退到应用配置中已保存的值。
|
||||||
|
func (s *Service) VerifyAPIToken(ctx context.Context, accountID, input string) (string, error) {
|
||||||
row, err := s.store.GetSettingsRaw(ctx)
|
row, err := s.store.GetSettingsRaw(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
accountID := strings.TrimSpace(row.AccountID)
|
accountID = strings.TrimSpace(accountID)
|
||||||
|
if accountID == "" {
|
||||||
|
accountID = strings.TrimSpace(row.AccountID)
|
||||||
|
}
|
||||||
if accountID == "" {
|
if accountID == "" {
|
||||||
return "", fmt.Errorf("请先填写 Account ID")
|
return "", fmt.Errorf("请先填写 Account ID")
|
||||||
}
|
}
|
||||||
@@ -320,8 +324,8 @@ func (s *Service) VerifyAPIToken(ctx context.Context, input string) (string, err
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TestToken 验证 Account ID + API Token 是否可用。
|
// TestToken 验证 Account ID + API Token 是否可用。
|
||||||
func (s *Service) TestToken(ctx context.Context, input, _ string) (string, error) {
|
func (s *Service) TestToken(ctx context.Context, accountID, input, _ string) (string, error) {
|
||||||
return s.VerifyAPIToken(ctx, input)
|
return s.VerifyAPIToken(ctx, accountID, input)
|
||||||
}
|
}
|
||||||
|
|
||||||
// attachConfig 从 config.yml 回填域名与回源 service,供编辑弹窗使用。
|
// attachConfig 从 config.yml 回填域名与回源 service,供编辑弹窗使用。
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "fonu-web",
|
"name": "fonu-web",
|
||||||
"version": "1.6.8",
|
"version": "1.6.9",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "fonu-web",
|
"name": "fonu-web",
|
||||||
"version": "1.6.8",
|
"version": "1.6.9",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@codemirror/commands": "^6.11.1",
|
"@codemirror/commands": "^6.11.1",
|
||||||
"@codemirror/lang-javascript": "^6.2.5",
|
"@codemirror/lang-javascript": "^6.2.5",
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "fonu-web",
|
"name": "fonu-web",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.6.8",
|
"version": "1.6.9",
|
||||||
"packageManager": "npm@10.9.4",
|
"packageManager": "npm@10.9.4",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -512,9 +512,9 @@ export const api = {
|
|||||||
getCfSettings: () => request<CfAppSettings>('/api/cloudflare/settings'),
|
getCfSettings: () => request<CfAppSettings>('/api/cloudflare/settings'),
|
||||||
saveCfSettings: (payload: CfAppSettingsInput) =>
|
saveCfSettings: (payload: CfAppSettingsInput) =>
|
||||||
request<CfAppSettings>('/api/cloudflare/settings', { method: 'PUT', body: JSON.stringify(payload) }),
|
request<CfAppSettings>('/api/cloudflare/settings', { method: 'PUT', body: JSON.stringify(payload) }),
|
||||||
testCfToken: (token: string, kind: 'tunnel' | 'api') =>
|
testCfToken: (accountId: string, token: string, kind: 'tunnel' | 'api') =>
|
||||||
request<{ ok: boolean; message: string }>('/api/cloudflare/settings/test', {
|
request<{ ok: boolean; message: string }>('/api/cloudflare/settings/test', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({ token, kind }),
|
body: JSON.stringify({ account_id: accountId, token, kind }),
|
||||||
}, 60_000),
|
}, 60_000),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -416,7 +416,11 @@ async function testToken() {
|
|||||||
tokenTesting.value = true
|
tokenTesting.value = true
|
||||||
tokenTestResult.value = ''
|
tokenTestResult.value = ''
|
||||||
try {
|
try {
|
||||||
const result = await api.testCfToken((settingsForm.value.api_token || '').trim(), 'api')
|
const result = await api.testCfToken(
|
||||||
|
(settingsForm.value.account_id || '').trim(),
|
||||||
|
(settingsForm.value.api_token || '').trim(),
|
||||||
|
'api',
|
||||||
|
)
|
||||||
tokenTestOk.value = true
|
tokenTestOk.value = true
|
||||||
tokenTestResult.value = result.message || '连接成功'
|
tokenTestResult.value = result.message || '连接成功'
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</PageHeader>
|
</PageHeader>
|
||||||
|
|
||||||
<n-alert type="success" :bordered="false" class="example-alert" title="v1.6.8 示例页面验证标识已生效">
|
<n-alert type="success" :bordered="false" class="example-alert" title="v1.6.9 示例页面验证标识已生效">
|
||||||
当前页面由 v{{ version }} 提供,验证标识为 <span class="mono">{{ verificationMarker }}</span>。
|
当前页面由 v{{ version }} 提供,验证标识为 <span class="mono">{{ verificationMarker }}</span>。
|
||||||
如果你是在升级后首次看到这行内容,说明前端构建、镜像重建和服务重启均已成功。
|
如果你是在升级后首次看到这行内容,说明前端构建、镜像重建和服务重启均已成功。
|
||||||
</n-alert>
|
</n-alert>
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
<strong class="example-proof__value">{{ verificationRound }}</strong>
|
<strong class="example-proof__value">{{ verificationRound }}</strong>
|
||||||
</div>
|
</div>
|
||||||
<div class="example-proof__hint">
|
<div class="example-proof__hint">
|
||||||
看到这个新区块,说明前端资源已经从旧版本切换到 v1.6.8。
|
看到这个新区块,说明前端资源已经从旧版本切换到 v1.6.9。
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -33,16 +33,16 @@
|
|||||||
<StatCard label="本次验证标识" :value="verificationMarker" sub="用于区分升级前后的前端资源" tone="blue" value-small>
|
<StatCard label="本次验证标识" :value="verificationMarker" sub="用于区分升级前后的前端资源" tone="blue" value-small>
|
||||||
<template #icon><n-icon :component="FlashOutline" /></template>
|
<template #icon><n-icon :component="FlashOutline" /></template>
|
||||||
</StatCard>
|
</StatCard>
|
||||||
<StatCard label="页面状态" value="已更新" sub="v1.6.8 前端资源已加载" tone="teal">
|
<StatCard label="页面状态" value="已更新" sub="v1.6.9 前端资源已加载" tone="teal">
|
||||||
<template #icon><n-icon :component="CheckmarkCircleOutline" /></template>
|
<template #icon><n-icon :component="CheckmarkCircleOutline" /></template>
|
||||||
</StatCard>
|
</StatCard>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<FonuCard title="本次示例页变化" subtitle="用于确认升级后的页面内容确实发生变化">
|
<FonuCard title="本次示例页变化" subtitle="用于确认升级后的页面内容确实发生变化">
|
||||||
<ul class="example-changes">
|
<ul class="example-changes">
|
||||||
<li>页面版本提示更新为 v1.6.8。</li>
|
<li>页面版本提示更新为 v1.6.9。</li>
|
||||||
<li>「本次升级验证」区块和页面状态同步更新为 v1.6.8。</li>
|
<li>「本次升级验证」区块和页面状态同步更新为 v1.6.9。</li>
|
||||||
<li>验证标识更新为 <span class="mono">v1.6.8-example-page</span>。</li>
|
<li>验证标识更新为 <span class="mono">v1.6.9-example-page</span>。</li>
|
||||||
</ul>
|
</ul>
|
||||||
</FonuCard>
|
</FonuCard>
|
||||||
|
|
||||||
@@ -87,8 +87,8 @@ const message = useMessage()
|
|||||||
const version = ref(__APP_VERSION__)
|
const version = ref(__APP_VERSION__)
|
||||||
const checkedAt = ref('')
|
const checkedAt = ref('')
|
||||||
const refreshing = ref(false)
|
const refreshing = ref(false)
|
||||||
const verificationRound = 'v1.6.8'
|
const verificationRound = 'v1.6.9'
|
||||||
const verificationMarker = 'v1.6.8-example-page'
|
const verificationMarker = 'v1.6.9-example-page'
|
||||||
|
|
||||||
async function refreshVersion() {
|
async function refreshVersion() {
|
||||||
refreshing.value = true
|
refreshing.value = true
|
||||||
|
|||||||
Reference in New Issue
Block a user