3825859da6
build / build (push) Successful in 2m20s
PP 增加受控凭据更新、真实登录与目录检查,待验证修改不会替换生效配置;扫描与取件共享生效修订。 钉钉来源向导、校验与登记共用 DWS 授权,支持中途恢复与换账号保护,取消旧扫码自动回落。 认证审计复用已有来源审计页,配置响应不回传密码;补齐运行镜像脚本与权限。 验证:make verify 退出 0;PP/DWS/httpapi 目标 race 回归通过;隔离 HTTP 服务验证 PP 协议及扫描/取件消费者。 尚未部署;真实 PP 凭据与目录可用性在测试站部署后验证。
53 lines
1.7 KiB
TypeScript
53 lines
1.7 KiB
TypeScript
export type SourceAuditItem = {
|
|
id: string
|
|
connection_id: string
|
|
source_name: string
|
|
action: string
|
|
actor: string
|
|
created_at: string
|
|
detail: string
|
|
}
|
|
export type SourceAuditPage = { items: SourceAuditItem[]; total: number; limit: number; offset: number }
|
|
export async function fetchSourceAudit(offset = 0, signal?: AbortSignal): Promise<SourceAuditPage> {
|
|
const response = await fetch(`/api/v1/source-connections/audit?limit=100&offset=${offset}`, {
|
|
signal,
|
|
headers: { Accept: 'application/json' },
|
|
})
|
|
if (!response.ok) throw new Error('无法读取数据源操作记录,请重试')
|
|
const { data } = await response.json()
|
|
if (
|
|
!data ||
|
|
!Array.isArray(data.items) ||
|
|
!Number.isInteger(data.total) ||
|
|
data.total < 0 ||
|
|
data.offset !== offset ||
|
|
!Number.isInteger(data.limit) ||
|
|
data.limit < 1
|
|
)
|
|
throw new Error('数据源操作记录格式无效')
|
|
for (const item of data.items) {
|
|
if (
|
|
!item ||
|
|
['id', 'connection_id', 'source_name', 'action', 'actor', 'created_at', 'detail'].some(
|
|
(key) => typeof item[key] !== 'string'
|
|
) ||
|
|
!Number.isFinite(Date.parse(item.created_at))
|
|
)
|
|
throw new Error('数据源操作记录格式无效')
|
|
}
|
|
return data
|
|
}
|
|
export const sourceAuditActions: Record<string, string> = {
|
|
credential_configured: '更新认证配置',
|
|
credential_rejected: '认证配置校验失败',
|
|
credential_test: '测试连接',
|
|
dws_authorization: '钉钉授权',
|
|
created: '添加连接',
|
|
settings_updated: '修改配置',
|
|
paused: '暂停自动刷新',
|
|
resumed: '恢复自动刷新',
|
|
archived: '移除连接',
|
|
restored: '恢复连接',
|
|
historical_settings: '历史设置记录',
|
|
}
|