diff --git a/SetDNS.py b/SetDNS.py index 2dbe0b0..58e38c0 100644 --- a/SetDNS.py +++ b/SetDNS.py @@ -543,10 +543,12 @@ def main(): if confirm.lower() == "y": set_dns_servers(recommended_dns["ipv4"], recommended_dns["ipv6"]) logger.info("DNS服务器已更新") + input("\n任务执行完毕,按任意键退出!") else: logger.info("操作已取消") else: logger.warning("未找到合适的DNS服务器") + input("\n任务执行失败,按任意键退出!") def is_admin() -> bool: diff --git a/SetHosts.py b/SetHosts.py index 6110726..4ce8c35 100644 --- a/SetHosts.py +++ b/SetHosts.py @@ -229,7 +229,7 @@ async def get_best_hosts( valid_results = [result for result in results if result[1] < latency_limit] if not valid_results: - logging.warning(f"未找到延迟小于 {latency_limit}ms 的IP。") + logging.warning(f"[bold red]未找到延迟小于 {latency_limit}ms 的IP。[/bold red]") return [] ipv4_results = [r for r in valid_results if not self.is_ipv6(r[0])] @@ -349,10 +349,11 @@ async def update_hosts(self): rprint(f"\n为组内所有域名应用发现的最快IP:") for domain in group.domains: new_entries = [f"{ip}\t{domain}" for ip, latency in fastest_ips] - rprint(f" {domain}:") + rprint(f" {domain}") # for entry in new_entries: # rprint(f" {entry}") all_entries.extend(new_entries) + rprint("\n[green]---------------------------------------------------------[/green]") if all_entries: self.write_to_hosts_file(all_entries) @@ -520,6 +521,7 @@ async def main(): rprint( f"[bold]代码运行时间:[/bold] [cyan]{elapsed_time.total_seconds():.2f} 秒[/cyan]" ) + input("\n任务执行完毕,按任意键退出!") def is_admin() -> bool: