feat(密钥管理): 列表按用户聚合三字段列 + 代理配置服务端上报
- Java:后台列表一行一用户(货源查询密钥/外观专利密钥/代理设置),行级状态三项全通过才算通过;检测/清空改为按用户;搜索仅按用户名(去 UID);新增代理检测(经用户代理请求自家域名)与代理掩码(隐去账密) - 后台前端:三字段列改版 + 行级状态筛选 + 用户名筛选 - 桌面前端:登录加载密钥时补报本地代理(只填空缺不覆盖)、保存/清空代理实时上报
This commit is contained in:
@@ -115,6 +115,7 @@ import {
|
||||
type UserApiSecretCheckResult,
|
||||
} from '@/shared/utils/api-secret-store'
|
||||
import { getPywebviewApi, type ProxyMode, type DesktopConfigUpdate } from '@/shared/bridges/pywebview'
|
||||
import { deleteMyApiSecret, putMyApiSecret } from '@/shared/api/types/modules/user-secret'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -352,6 +353,21 @@ async function loadProxyConfig() {
|
||||
}
|
||||
}
|
||||
|
||||
/** 代理配置上报服务端(后台密钥管理观测/检测):有地址则保存、清空则删除;失败不阻断本地保存。 */
|
||||
async function syncProxyToServer(url: string) {
|
||||
if (proxyUserId() === '0') return
|
||||
try {
|
||||
if (url) {
|
||||
await putMyApiSecret('proxy', url)
|
||||
} else {
|
||||
await deleteMyApiSecret('proxy')
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('[api-secret] 代理配置上报失败(不影响本地任务):', error)
|
||||
ElMessage.warning('代理已保存到本地,但上报后台失败')
|
||||
}
|
||||
}
|
||||
|
||||
async function loadBalance() {
|
||||
balanceLoading.value = true
|
||||
try {
|
||||
@@ -404,6 +420,7 @@ async function saveAll(options: { requireAll?: boolean } = {}): Promise<boolean>
|
||||
await api.save_config(userProxyPatch(nextProxyUrl, proxyMode.value) as DesktopConfigUpdate)
|
||||
proxyUrl.value = nextProxyUrl
|
||||
proxyDirty.value = false
|
||||
await syncProxyToServer(nextProxyUrl)
|
||||
}
|
||||
|
||||
// 保存成功的模块立即自动检测,结果直接反映在卡片状态行
|
||||
|
||||
Reference in New Issue
Block a user