Merge pull request #125 from thsrite/main

This commit is contained in:
jxxghp 2023-08-15 17:46:55 +08:00 committed by GitHub
commit ce62355197
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -158,7 +158,6 @@ class CloudflareSpeedTest(_PluginBase):
else:
# 替换优选ip
err_hosts = customHosts.get("err_hosts")
enable = customHosts.get("enable")
# 处理ip
new_hosts = []
@ -166,16 +165,16 @@ class CloudflareSpeedTest(_PluginBase):
if host and host != '\n':
host_arr = str(host).split()
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:
new_hosts.append(host)
new_hosts.append(host.replace("\n", "") + "\n")
# 更新自定义Hosts
self.update_config(
{
"hosts": new_hosts,
"hosts": ''.join(new_hosts),
"err_hosts": err_hosts,
"enable": enable
"enabled": True
}, "CustomHosts"
)