feat: add sensitive info mask (#10865)

This commit is contained in:
KOMATA 2025-11-05 09:38:42 +08:00 committed by GitHub
parent 902d329e78
commit cfe9e94e16
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -173,6 +173,12 @@
<el-carousel-item key="systemInfo"> <el-carousel-item key="systemInfo">
<CardWithHeader :header="$t('home.systemInfo')"> <CardWithHeader :header="$t('home.systemInfo')">
<template #header-r> <template #header-r>
<el-button
class="h-button-setting"
@click="toggleSensitiveInfo"
link
:icon="showSensitiveInfo ? 'View' : 'Hide'"
/>
<el-button class="h-button-setting" @click="handleCopy" link icon="CopyDocument" /> <el-button class="h-button-setting" @click="handleCopy" link icon="CopyDocument" />
</template> </template>
<template #body> <template #body>
@ -185,7 +191,7 @@
<template #label> <template #label>
<span class="system-label">{{ $t('home.hostname') }}</span> <span class="system-label">{{ $t('home.hostname') }}</span>
</template> </template>
{{ baseInfo.hostname }} {{ showSensitiveInfo ? baseInfo.hostname : '****' }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item <el-descriptions-item
class-name="system-content" class-name="system-content"
@ -225,7 +231,7 @@
<template #label> <template #label>
<span class="system-label">{{ $t('home.ip') }}</span> <span class="system-label">{{ $t('home.ip') }}</span>
</template> </template>
{{ baseInfo.ipV4Addr }} {{ showSensitiveInfo ? baseInfo.ipV4Addr : '****' }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item <el-descriptions-item
v-if="baseInfo.httpProxy && baseInfo.httpProxy !== 'noProxy'" v-if="baseInfo.httpProxy && baseInfo.httpProxy !== 'noProxy'"
@ -346,6 +352,8 @@ let isStatusInit = ref<boolean>(true);
let isActive = ref(true); let isActive = ref(true);
let isCurrentActive = ref(true); let isCurrentActive = ref(true);
const showSensitiveInfo = ref(true);
const ioReadBytes = ref<Array<number>>([]); const ioReadBytes = ref<Array<number>>([]);
const ioWriteBytes = ref<Array<number>>([]); const ioWriteBytes = ref<Array<number>>([]);
const netBytesSents = ref<Array<number>>([]); const netBytesSents = ref<Array<number>>([]);
@ -510,6 +518,10 @@ const showSimpleNode = () => {
return globalStore.isMasterProductPro && simpleNodes.value?.length !== 0; return globalStore.isMasterProductPro && simpleNodes.value?.length !== 0;
}; };
const toggleSensitiveInfo = () => {
showSensitiveInfo.value = !showSensitiveInfo.value;
};
const jumpPanel = (row: any) => { const jumpPanel = (row: any) => {
let entrance = row.securityEntrance.startsWith('/') ? row.securityEntrance.slice(1) : row.securityEntrance; let entrance = row.securityEntrance.startsWith('/') ? row.securityEntrance.slice(1) : row.securityEntrance;
entrance = entrance ? '/' + entrance : ''; entrance = entrance ? '/' + entrance : '';