feat(pages): 支持 Remote 部署源同步

新增部署源配置与运行态模型、安全下载、租约续期、原子激活和失败补偿。

接入内部任务与脱敏前端交互,并阻止数据库 Trace 和日志展开敏感查询参数。
This commit is contained in:
deqiying
2026-07-19 17:36:51 +08:00
parent 4e8ec23264
commit 38b0516937
58 changed files with 9858 additions and 1075 deletions
+335 -1
View File
@@ -2571,10 +2571,16 @@ definitions:
type: integer
project_id:
type: integer
source_label:
type: string
source_type:
type: string
status:
type: string
total_size:
type: integer
trigger_type:
type: string
upload_id:
example: "0"
type: string
@@ -2606,6 +2612,100 @@ definitions:
spa_fallback_path:
type: string
type: object
pages.SourceActionReceipt:
properties:
action:
type: string
execution_id:
type: string
task_id:
type: string
type: object
pages.SourceRevisionView:
properties:
asset_name:
type: string
label:
type: string
revision:
type: string
type: object
pages.SourceSyncInput:
properties:
confirmed_revision:
type: string
type: object
pages.SourceUpdateInput:
properties:
asset_name:
type: string
auto_update_enabled:
type: boolean
check_interval_minutes:
type: integer
release_selector:
type: string
release_tag:
type: string
remote_network_policy:
type: string
remote_url:
type: string
remote_url_set:
type: boolean
repository_url:
type: string
source_type:
type: string
type: object
pages.SourceUpdateResult:
properties:
check_task:
$ref: '#/definitions/pages.SourceActionReceipt'
source:
$ref: '#/definitions/pages.SourceView'
warning:
type: string
type: object
pages.SourceView:
properties:
asset_name:
type: string
auto_update_enabled:
type: boolean
check_interval_minutes:
type: integer
display_url:
type: string
github_repository:
type: string
has_remote_url:
type: boolean
last_applied:
$ref: '#/definitions/pages.SourceRevisionView'
last_checked_at:
type: string
last_error:
type: string
last_seen:
$ref: '#/definitions/pages.SourceRevisionView'
last_synced_at:
type: string
next_check_at:
type: string
release_selector:
type: string
release_tag:
type: string
remote_network_policy:
type: string
source_type:
type: string
sync_status:
type: string
update_available:
type: boolean
type: object
pages.UploadFromURLInput:
properties:
url:
@@ -9277,7 +9377,8 @@ paths:
post:
consumes:
- application/json
description: 从用户提供的 HTTP(S) 链接下载部署包并创建部署记录;服务端使用浏览器伪装请求头拉取,允许内网地址与不安全 TLS 证书,需要管理员权限
deprecated: true
description: 已弃用的一次性 URL 导入;使用 trusted_internal 策略兼容内网与自签名证书,不创建持久部署源
parameters:
- description: 项目 ID
in: path
@@ -9323,6 +9424,239 @@ paths:
summary: 从 URL 导入 Pages 部署包
tags:
- openflare-pages
/api/v1/d/pages/{id}/source:
get:
description: 返回脱敏后的项目部署源配置与运行状态,需要管理员权限
parameters:
- description: 项目 ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: 部署源
schema:
allOf:
- $ref: '#/definitions/response.Any'
- properties:
data:
$ref: '#/definitions/pages.SourceView'
type: object
"400":
description: 参数错误
schema:
$ref: '#/definitions/response.Any'
"401":
description: 未登录
schema:
$ref: '#/definitions/response.Any'
"404":
description: 项目或部署源不存在
schema:
$ref: '#/definitions/response.Any'
"500":
description: 内部错误
schema:
$ref: '#/definitions/response.Any'
security:
- SessionCookie: []
summary: 获取 Pages 部署源
tags:
- openflare-pages
/api/v1/d/pages/{id}/source/check:
post:
description: Remote URL 来源不支持检查更新;该端点为后续 GitHub Release 来源保留统一动作契约
parameters:
- description: 项目 ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: 任务回执
schema:
allOf:
- $ref: '#/definitions/response.Any'
- properties:
data:
$ref: '#/definitions/pages.SourceActionReceipt'
type: object
"400":
description: 当前来源不支持检查
schema:
$ref: '#/definitions/response.Any'
"401":
description: 未登录
schema:
$ref: '#/definitions/response.Any'
"404":
description: 部署源不存在
schema:
$ref: '#/definitions/response.Any'
"409":
description: 来源任务正在执行
schema:
$ref: '#/definitions/response.Any'
"500":
description: 内部错误
schema:
$ref: '#/definitions/response.Any'
security:
- SessionCookie: []
summary: 检查 Pages 部署源
tags:
- openflare-pages
/api/v1/d/pages/{id}/source/delete:
post:
description: 幂等删除持久部署源;已有部署历史与当前生产部署保持不变
parameters:
- description: 项目 ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: 手动来源视图
schema:
allOf:
- $ref: '#/definitions/response.Any'
- properties:
data:
$ref: '#/definitions/pages.SourceView'
type: object
"400":
description: 参数错误
schema:
$ref: '#/definitions/response.Any'
"401":
description: 未登录
schema:
$ref: '#/definitions/response.Any'
"404":
description: 项目不存在
schema:
$ref: '#/definitions/response.Any'
"500":
description: 内部错误
schema:
$ref: '#/definitions/response.Any'
security:
- SessionCookie: []
summary: 删除 Pages 部署源
tags:
- openflare-pages
/api/v1/d/pages/{id}/source/sync:
post:
consumes:
- application/json
description: 异步下载、校验并原子激活来源部署包;空请求体与空 JSON 对象均有效
parameters:
- description: 项目 ID
in: path
name: id
required: true
type: integer
- description: 同步参数
in: body
name: request
schema:
$ref: '#/definitions/pages.SourceSyncInput'
produces:
- application/json
responses:
"200":
description: 任务回执
schema:
allOf:
- $ref: '#/definitions/response.Any'
- properties:
data:
$ref: '#/definitions/pages.SourceActionReceipt'
type: object
"400":
description: 参数或来源类型无效
schema:
$ref: '#/definitions/response.Any'
"401":
description: 未登录
schema:
$ref: '#/definitions/response.Any'
"404":
description: 部署源不存在
schema:
$ref: '#/definitions/response.Any'
"409":
description: 来源任务正在执行
schema:
$ref: '#/definitions/response.Any'
"500":
description: 内部错误
schema:
$ref: '#/definitions/response.Any'
security:
- SessionCookie: []
summary: 同步并发布 Pages 部署源
tags:
- openflare-pages
/api/v1/d/pages/{id}/source/update:
post:
consumes:
- application/json
description: Phase 1 支持 Remote URL 来源;完整地址仅写入,不会在响应中返回
parameters:
- description: 项目 ID
in: path
name: id
required: true
type: integer
- description: 部署源配置
in: body
name: request
required: true
schema:
$ref: '#/definitions/pages.SourceUpdateInput'
produces:
- application/json
responses:
"200":
description: 更新结果
schema:
allOf:
- $ref: '#/definitions/response.Any'
- properties:
data:
$ref: '#/definitions/pages.SourceUpdateResult'
type: object
"400":
description: 配置无效
schema:
$ref: '#/definitions/response.Any'
"401":
description: 未登录
schema:
$ref: '#/definitions/response.Any'
"404":
description: 项目不存在
schema:
$ref: '#/definitions/response.Any'
"500":
description: 内部错误
schema:
$ref: '#/definitions/response.Any'
security:
- SessionCookie: []
summary: 更新 Pages 部署源
tags:
- openflare-pages
/api/v1/d/pages/{id}/update:
post:
consumes: