fix: 解决工具箱 Hosts 解析失败的问题 (#3501)

Refs #3497
This commit is contained in:
ssongliu 2024-01-02 17:22:12 +08:00 committed by GitHub
parent e9f876853b
commit a8e10d0d71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 1 deletions

View File

@ -353,7 +353,7 @@ func loadHosts() []dto.HostHelper {
lines := strings.Split(string(hostConf), "\n")
for _, line := range lines {
parts := strings.Fields(line)
if len(parts) < 2 {
if len(parts) < 2 || strings.HasPrefix(strings.TrimPrefix(line, " "), "#") {
continue
}
list = append(list, dto.HostHelper{IP: parts[0], Host: strings.Join(parts[1:], " ")})

View File

@ -926,6 +926,7 @@ const message = {
'When there are multiple DNS entries, they should be displayed on new lines. e.g.\n114.114.114.114\n8.8.8.8',
hostsHelper: 'Hostname Resolution',
hosts: 'Domain',
hostAlert: 'Hidden commented records, please click the All configuration button to view or set',
toolbox: 'Quick Setup',
hostname: 'Hostname',
passwd: 'System Password',

View File

@ -881,6 +881,7 @@ const message = {
dnsHelper1: '當存在多個DNS時需換行顯示\n114.114.114.114\n8.8.8.8',
hostsHelper: '主機名解析',
hosts: '域名',
hostAlert: '隱藏了已註釋的記錄請點擊 全部配置 按鈕以查看或設置',
toolbox: '快速設置',
hostname: '主機名',
passwd: '系統密碼',

View File

@ -882,6 +882,7 @@ const message = {
dnsHelper1: '当存在多个 DNS 需换行显示\n114.114.114.114\n8.8.8.8',
hostsHelper: '主机名解析',
hosts: '域名',
hostAlert: '隐藏了已注释的记录请点击 全部配置 按钮以查看或设置',
toolbox: '快速设置',
hostname: '主机名',
passwd: '系统密码',

View File

@ -7,6 +7,12 @@
<el-row type="flex" justify="center" v-loading="loading">
<el-col :span="22">
<el-alert
:title="$t('toolbox.device.timeZoneHelper')"
class="common-prompt"
:closable="false"
type="warning"
/>
<el-radio-group v-model="confShowType" @change="changeMode">
<el-radio-button label="base">{{ $t('database.baseConf') }}</el-radio-button>
<el-radio-button label="all">{{ $t('database.allConf') }}</el-radio-button>