Merge pull request #125 from thsrite/main
This commit is contained in:
commit
ce62355197
@ -158,7 +158,6 @@ class CloudflareSpeedTest(_PluginBase):
|
|||||||
else:
|
else:
|
||||||
# 替换优选ip
|
# 替换优选ip
|
||||||
err_hosts = customHosts.get("err_hosts")
|
err_hosts = customHosts.get("err_hosts")
|
||||||
enable = customHosts.get("enable")
|
|
||||||
|
|
||||||
# 处理ip
|
# 处理ip
|
||||||
new_hosts = []
|
new_hosts = []
|
||||||
@ -166,16 +165,16 @@ class CloudflareSpeedTest(_PluginBase):
|
|||||||
if host and host != '\n':
|
if host and host != '\n':
|
||||||
host_arr = str(host).split()
|
host_arr = str(host).split()
|
||||||
if host_arr[0] == self._cf_ip:
|
if host_arr[0] == self._cf_ip:
|
||||||
new_hosts.append(host.replace(self._cf_ip, best_ip))
|
new_hosts.append(host.replace(self._cf_ip, best_ip).replace("\n", "") + "\n")
|
||||||
else:
|
else:
|
||||||
new_hosts.append(host)
|
new_hosts.append(host.replace("\n", "") + "\n")
|
||||||
|
|
||||||
# 更新自定义Hosts
|
# 更新自定义Hosts
|
||||||
self.update_config(
|
self.update_config(
|
||||||
{
|
{
|
||||||
"hosts": new_hosts,
|
"hosts": ''.join(new_hosts),
|
||||||
"err_hosts": err_hosts,
|
"err_hosts": err_hosts,
|
||||||
"enable": enable
|
"enabled": True
|
||||||
}, "CustomHosts"
|
}, "CustomHosts"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user