fix 自定义hosts

This commit is contained in:
thsrite 2023-08-05 20:08:06 +08:00
parent 0412eeafc9
commit ffd579715c

View File

@ -54,7 +54,7 @@ class CustomHosts(_PluginBase):
# 更新错误Hosts
self.update_config({
"hosts": self._hosts,
"hosts": ''.join(self._hosts),
"err_hosts": error_hosts,
"enabled": self._enabled
})
@ -74,82 +74,82 @@ class CustomHosts(_PluginBase):
拼装插件配置页面需要返回两块数据1页面配置2数据结构
"""
return [
{
'component': 'VForm',
'content': [
{
'component': 'VRow',
'content': [
{
'component': 'VCol',
'props': {
'cols': 12,
'md': 6
},
'content': [
{
'component': 'VSwitch',
'props': {
'model': 'enabled',
'label': '启用插件',
}
}
]
}
]
},
{
'component': 'VRow',
'content': [
{
'component': 'VCol',
'props': {
'cols': 12
},
'content': [
{
'component': 'VTextarea',
'props': {
'model': 'hosts',
'label': '自定义hosts',
'rows': 10,
'placeholder': '每行一个配置格式为ip host1 host2 ...'
}
}
]
}
]
},
{
'component': 'VRow',
'content': [
{
'component': 'VCol',
'props': {
'cols': 12
},
'content': [
{
'component': 'VTextarea',
'props': {
'model': 'err_hosts',
'readonly': True,
'label': '错误hosts',
'rows': 2,
'placeholder': '错误的hosts配置会展示在此处请修改上方hosts重新提交错误的hosts不会写入系统hosts文件'
}
}
]
}
]
}
]
}
], {
"enabled": False,
"hosts": "",
"err_hosts": ""
}
{
'component': 'VForm',
'content': [
{
'component': 'VRow',
'content': [
{
'component': 'VCol',
'props': {
'cols': 12,
'md': 6
},
'content': [
{
'component': 'VSwitch',
'props': {
'model': 'enabled',
'label': '启用插件',
}
}
]
}
]
},
{
'component': 'VRow',
'content': [
{
'component': 'VCol',
'props': {
'cols': 12
},
'content': [
{
'component': 'VTextarea',
'props': {
'model': 'hosts',
'label': '自定义hosts',
'rows': 10,
'placeholder': '每行一个配置格式为ip host1 host2 ...'
}
}
]
}
]
},
{
'component': 'VRow',
'content': [
{
'component': 'VCol',
'props': {
'cols': 12
},
'content': [
{
'component': 'VTextarea',
'props': {
'model': 'err_hosts',
'readonly': True,
'label': '错误hosts',
'rows': 2,
'placeholder': '错误的hosts配置会展示在此处请修改上方hosts重新提交错误的hosts不会写入系统hosts文件'
}
}
]
}
]
}
]
}
], {
"enabled": False,
"hosts": "",
"err_hosts": ""
}
def get_page(self) -> List[dict]:
pass