瀏覽代碼

Merge pull request #105 from Abeautifulsnow/main

Fix bug: 新旧host比对内容不对
pull/116/head
削微寒 2 年之前
committed by GitHub
父節點
當前提交
182edd51c6
沒有發現已知的金鑰在資料庫的簽署中 GPG Key ID: 4AEE18F83AFDEB23
共有 1 個文件被更改,包括 9 次插入7 次删除
  1. +9
    -7
      fetch_ips.py

+ 9
- 7
fetch_ips.py 查看文件

@ -68,13 +68,15 @@ def write_file(hosts_content: str, update_time: str):
template_path = os.path.join(os.path.dirname(__file__),
"README_template.md")
write_host_file(hosts_content)
with open(output_doc_file_path, "r") as old_readme_fb:
old_content = old_readme_fb.read()
old_hosts = old_content.split("```bash")[1].split("```")[0].strip()
old_hosts = old_hosts.split("# Update time:")[0]
if old_hosts == hosts_content:
print("host not change")
return False
if os.path.exists(output_doc_file_path):
with open(output_doc_file_path, "r") as old_readme_fb:
old_content = old_readme_fb.read()
old_hosts = old_content.split("```bash")[1].split("```")[0].strip()
old_hosts = old_hosts.split("# Update time:")[0].strip()
hosts_content_hosts = hosts_content.split("# Update time:")[0].strip()
if old_hosts == hosts_content_hosts:
print("host not change")
return False
with open(template_path, "r") as temp_fb:
template_str = temp_fb.read()

Loading…
取消
儲存