Repository navigation
This release adds batch domain resolution, import previews, and history management, improves the editor and localization, and fixes issues with hosts switching, data handling, and macOS compatibility.
New Features
- Domain resolution: Resolve domains into hosts entries via DNS over HTTPS (DoH), with batch input, concurrent lookups, per-domain results, and cached-IP fallback when resolution fails.
- Import previews: Preview configurations imported from files or URLs, then selectively append entries or replace all configurations. Folder structures and configuration references are preserved, and replacement requires confirmation.
- History management: Enable or disable system hosts history, configure retention limits, view saved-record counts, and clear history.
- Custom API ports: Change the HTTP API listening port without restarting. Service status and port-conflict messages are now available, and the Alfred workflow also supports custom ports.
- Links in comments: Open HTTP(S) links in hosts comments with
Cmd + Clickon macOS orCtrl + Clickon Windows/Linux.
Editor and Interface
- Highlight the boundaries of content managed by SwitchHosts, with labels that remain visible during horizontal scrolling.
- Refine syntax highlighting and colors for line numbers, selected text, and read-only content, and improve visual consistency across themes and controls.
- Adjust sidebar action placement and simplify the trash indicator.
- Improve the tray popup layout and adjust its initial height based on visible entries.
- Improve the language selector with theme support and a multi-column layout.
Bug Fixes and Stability
- Fix inconsistencies between hosts toggle states and applied content, and improve state synchronization during HTTP API switching, failed saves, and recovery.
- Fix sibling folders unexpectedly collapsing when interacting with folders.
- Restore
Alt + Dragcolumn selection and correct comment toggling across multiple selections. - Improve handling of BOM, UTF-16, and legacy Windows ANSI encodings; back up original content before conversion, restore it accurately during rollback, and validate content before writing.
- Strengthen backup and import validation, preserve imported metadata, and improve retries after import failures.
- Fix errors not being properly reported when loading the configuration index or trash fails.
- Fix history settings being reverted after recovery failures, and improve history refresh and retry behavior.
- Improve error messages for invalid remote URLs, certificate errors, request timeouts, and connection failures.
- Improve batch domain refresh stability, limit the size and duration of each refresh, and prevent stale responses from overwriting the latest state.
macOS and Window Behavior
- Fix tray popups not displaying properly over full-screen applications.
- Fix tray popups not responding to clicks on macOS 27.
- Adjust the vertical alignment of macOS window controls.
- Fix titlebar dragging being unavailable while a dialog is open.
Localization
- Add Spanish, Italian, Dutch, Portuguese, Vietnamese, Russian, and Thai.
- Refine Traditional Chinese UI text.
Development and Maintenance
- Update frontend, Rust, and build dependencies.
- Update CI and release workflows, and upgrade the build environment to Node.js 24.
- Add a Tauri development debugging configuration and expand regression test coverage.
- Update the project homepage to switchhosts.app.
Acknowledgements
Thanks to everyone who contributed code, testing, translations, and issue reports! Welcome to our first-time code contributors: @beyond-infra, @nrps9909, @ziji-wu, @cuishuang, and @Jarvis636431.
Full Changelog: v5.0.2 → v5.0.3
本次更新新增批量域名解析、导入预览和历史记录管理,改进编辑器与多语言体验,并修复多项配置切换、数据读写和 macOS 兼容性问题。
新增功能
- 域名解析:支持通过 DNS over HTTPS(DoH)将域名解析为 hosts 条目;支持批量输入、并发查询、逐项查看结果,以及解析失败时回退使用缓存 IP。
- 导入预览:从文件或 URL 导入配置时,可先预览内容,再选择部分配置追加导入或替换全部配置;保留文件夹结构及配置引用关系,替换前需确认。
- 历史记录管理:支持开启或关闭系统 hosts 历史记录、设置保留数量、查看记录数及清空历史记录。
- 自定义 API 端口:HTTP API 支持修改监听端口并即时生效,无需重启;新增服务状态和端口冲突提示,Alfred 工作流同步支持自定义端口。
- 注释链接跳转:支持打开 hosts 注释中的 HTTP(S) 链接,macOS 使用
Cmd + 单击,Windows/Linux 使用Ctrl + 单击。
编辑器与界面
- 高亮显示 SwitchHosts 管理内容的起止边界,边界标签在横向滚动时保持可见。
- 优化语法高亮、行号、选中文本及只读内容的配色,改善主题与控件的视觉一致性。
- 调整侧边栏操作入口,简化回收站标记。
- 优化托盘弹窗布局,根据可见条目数量调整初始高度。
- 改善语言选择菜单,支持主题适配及多列布局。
问题修复与稳定性
- 修复 hosts 开关状态与实际生效内容不一致的问题,改善 HTTP API 切换、保存失败及恢复时的状态同步。
- 修复操作文件夹时,同级文件夹意外折叠的问题。
- 恢复
Alt + 拖动列选择,修正多选区下的注释切换行为。 - 改善 BOM、UTF-16 和 Windows 传统 ANSI 编码的处理;转换前备份原始内容,回滚时准确恢复,并在写入前校验内容。
- 加强备份与导入校验,保留导入元数据,改善导入失败后的重试流程。
- 修复配置索引或回收站读取失败时错误未正确上报的问题。
- 修复恢复失败导致历史记录设置被回退的问题,改善历史记录刷新与重试。
- 改善远程 URL 无效、证书错误、请求超时及连接失败时的提示。
- 提升批量域名刷新稳定性,限制单次刷新规模与耗时,避免过期响应覆盖最新状态。
macOS 与窗口体验
- 修复使用全屏应用时托盘弹窗无法正常显示的问题。
- 修复 macOS 27 上托盘弹窗无法响应点击的问题。
- 调整 macOS 窗口控制按钮的垂直对齐。
- 修复弹出对话框后无法通过标题栏拖动主窗口的问题。
多语言支持
- 新增西班牙语、意大利语、荷兰语、葡萄牙语、越南语、俄语和泰语。
- 优化繁体中文界面文案。
开发与维护
- 更新前端、Rust 及构建相关依赖。
- 更新持续集成与发布流程,构建环境升级至 Node.js 24。
- 新增 Tauri 开发调试配置,扩展回归测试覆盖。
- 项目主页更新为 switchhosts.app。
致谢
感谢所有参与开发、测试、翻译和问题反馈的贡献者!欢迎首次贡献代码的 @beyond-infra、@nrps9909、@ziji-wu、@cuishuang 和 @Jarvis636431。
What's Changed
- fix(tree): stale closure in React.memo causing sibling folder collapse by @beyond-infra in #1015
- Add acknowledgements for synsa and beyond-infra by @oldj in #1016
- chore(deps): bump serde_with from 3.18.0 to 3.21.0 in /src-tauri by @dependabot[bot] in #1022
- chore(deps-dev): bump brace-expansion from 5.0.6 to 5.0.7 by @dependabot[bot] in #1024
- chore(deps): bump immutable from 5.1.5 to 5.1.9 by @dependabot[bot] in #1027
- chore(deps): bump postcss from 8.5.15 to 8.5.23 by @dependabot[bot] in #1028
- chore(deps-dev): bump react-router from 7.17.0 to 8.3.0 by @dependabot[bot] in #1029
- chore(deps): bump quinn-proto from 0.11.14 to 0.11.16 in /src-tauri by @dependabot[bot] in #1030
- chore(deps): bump undici from 7.28.0 to 7.29.0 by @dependabot[bot] in #1034
- fix(i18n): polish Traditional Chinese UI copy by @nrps9909 in #1036
- chore(deps-dev): bump browserslist from 4.28.2 to 4.28.8 by @dependabot[bot] in #1042
- feat: resolve bare domains into hosts entries via DoH by @ziji-wu in #1040
- chore(deps): bump @vitest/mocker and vitest by @dependabot[bot] in #1047
- fix(storage): propagate manifest and trashcan load errors in mutating commands by @cuishuang in #1045
- fix(macOS): show tray window over full-screen apps by @Jarvis636431 in #1051
- chore(deps): bump undici from 7.29.0 to 7.30.0 by @dependabot[bot] in #1055
- chore(deps-dev): bump brace-expansion from 5.0.7 to 5.0.12 by @dependabot[bot] in #1056
- chore(deps-dev): bump @babel/core from 7.29.0 to 7.29.7 by @dependabot[bot] in #1057
- chore(deps): bump source-map-js from 1.2.1 to 1.2.2 by @dependabot[bot] in #1062
New Contributors
- @beyond-infra made their first contribution in #1015
- @nrps9909 made their first contribution in #1036
- @ziji-wu made their first contribution in #1040
- @cuishuang made their first contribution in #1045
- @Jarvis636431 made their first contribution in #1051
Full Changelog: v5.0.2...v5.0.3