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