security: 隐藏 MongoDB 连接串与库名,health 不再返回 uri/db 并对错误脱敏

This commit is contained in:
ice-a
2026-10-16 19:08:06 +08:00
parent e1572e1327
commit 090a7254e0
7 changed files with 16 additions and 13 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ onMounted(() => {
const mongoPill = computed(() => {
if (!health.value) return { cls: '', text: 'MONGO ?' }
return health.value.mongo.ok
? { cls: 'on', text: `MONGO · ${health.value.mongo.db}` }
? { cls: 'on', text: 'MONGO' }
: { cls: 'off', text: 'MONGO 未连接' }
})
</script>
+1 -2
View File
@@ -153,8 +153,7 @@ function previewLink(item: TorrentView) {
</section>
<div v-if="health && !health.mongo.ok" class="note warn mt rise rise-2">
MongoDB 未连接,搜索记录与种子缓存不会被保存(其余功能可用)。在 .env 配置正确的 MONGODB_URI(云端实例请填真实密码)后刷新即可:
<span class="mono">{{ health.mongo.uri }}</span>
MongoDB 未连接,搜索记录与种子缓存不会被保存(其余功能可用)。在 .env 配置正确的 MONGODB_URI 后刷新即可。
</div>
<div class="tabs rise rise-2">
-1
View File
@@ -321,7 +321,6 @@ onMounted(load)
<dt>MongoDB</dt>
<dd>
<span :class="health?.mongo.ok ? 'ok' : 'err'">{{ health?.mongo.ok ? '已连接' : '未连接' }}</span>
<span class="mono small dim"> · {{ health?.mongo.uri }} / {{ health?.mongo.db }}</span>
<div v-if="health?.mongo.error" class="small err mono break">{{ health.mongo.error }}</div>
</dd>
<dt>磁力解析</dt>
+1 -1
View File
@@ -95,7 +95,7 @@ export interface ClientsResponse {
export interface HealthResponse {
ok: boolean
time: string
mongo: { ok: boolean; uri: string; db: string; error: string | null }
mongo: { ok: boolean; error: string | null }
webTorrent: boolean
providers: { id: string; label: string; homepage: string }[]
enabledProviders: string[]
+1 -1
View File
@@ -225,7 +225,7 @@ export const zh2en: Record<string, string> = {
'点击关键词直接搜索': 'Click a keyword to search',
'已写入 MongoDB': 'Saved to MongoDB',
'MongoDB 未连接,未记录': 'MongoDB not connected, not recorded',
'MongoDB 未连接,搜索记录与种子缓存不会被保存(其余功能可用)。在 .env 配置正确的 MONGODB_URI(云端实例请填真实密码)后刷新即可:': 'MongoDB not connected; search history and torrent cache will not be saved (other features still work). Set a valid MONGODB_URI in .env (use the real password for cloud instances) and refresh:'
'MongoDB 未连接,搜索记录与种子缓存不会被保存(其余功能可用)。在 .env 配置正确的 MONGODB_URI 后刷新即可。': 'MongoDB not connected; search history and torrent cache will not be saved (other features still work). Set a valid MONGODB_URI in .env and refresh.'
}
export const en2zh: Record<string, string> = Object.fromEntries(