跳到正文

SwitchHosts 版本记录

oldj / SwitchHosts contributors · 管理并切换本地、远程和分组 hosts 配置,支持语法高亮、定时刷新、导入导出及系统托盘操作。

Cask网络 2.7万
主页
安装命令
brew install --cask switchhosts
近 30 天安装
296
App榜第 595
近一年安装
3,775
365 天累计
最新版本
5.0.3
下载大小
4.7MB
dmg
更新节奏
不定期
近 30 天 0 个版本
  1. 5.0.3

    最新补丁

    OpenNavo 编辑 Homebrew 收录

    新增批量 DoH 解析、导入预览与历史控制,并修复 macOS 托盘及 hosts 切换。

    通过批量 DNS-over-HTTPS 将域名解析为 hosts 条目,失败时回退到缓存 IP。文件或 URL 导入支持预览、选择追加或确认后替换,保留文件夹和引用。新增历史保留控制,HTTP API 端口可实时更改。macOS 可用 Cmd+单击打开注释链接。修复开关状态和内容同步、导入验证及旧的域名刷新结果覆盖问题。修复全屏应用上方托盘弹窗和 macOS 27 点击问题。

    Official release

  2. 5.0.3-beta.3

    预发布

    GitHub Release

    2026-10-05 · Changes since v5.0.3-beta.2

    New Features

    • Add batch domain resolution for remote hosts, with multiline input, per-domain results, concurrent lookups, and cached-IP fallback.
    • Add import previews for files and URLs, with selective append and full replacement options, folder structure preservation, reference remapping, and confirmation before replacement. (#295)
    • Add system hosts history controls: enable or disable recording, configure retention limits, view saved-record counts, and clear history with confirmation. (#1050)
    • Support configurable HTTP API listening ports without restarting, with service status and clear port-conflict errors. Update the Alfred workflow to support custom ports. (#767)
    • Support opening HTTP(S) links in hosts comments with Cmd-click on macOS or Ctrl-click on Windows/Linux.

    Editor and Interface

    • Highlight managed hosts section boundaries and add labels that remain visible during horizontal scrolling.
    • Refine syntax highlighting with purple accents and softer line numbers; improve selected-text and read-only colors, and unify controls with the red theme.
    • Improve sidebar action placement and simplify the trash indicator.
    • Refine the tray popup layout and calculate its initial height from visible entries.
    • Vertically center the macOS window controls.

    Bug Fixes and Reliability

    • Keep hosts toggle states consistent with applied content, including HTTP API operations, failed saves, and recovery.
    • Improve BOM, UTF-16, and legacy Windows ANSI handling. Back up original bytes before encoding conversion, restore exact bytes during rollback, preserve editor offsets, and reject invalid content before writing. (#302)
    • Restore Alt-drag column selection and correct comment toggling across multiple selections. (#1061)
    • Strengthen backup validation, preserve imported metadata, and allow retries after import failures or preview refreshes.
    • Fix history settings being rolled back during recovery failures, and improve history refresh and retry behavior.
    • Restore tray popup click handling on macOS 27.
    • Allow titlebar dragging while modal overlays are open.
    • Provide clearer errors for invalid remote URLs, TLS certificate failures, timeouts, and connection problems, while avoiding sensitive details in error messages. (#588)
    • Bound batch DNS refreshes with domain and time limits, protect refresh metadata from stale responses, and improve background failure reporting.

    Localization

    • Add Spanish, Italian, Dutch, Portuguese, Vietnamese, Russian, and Thai.
    • Redesign the language selector with a themed, responsive multi-column menu.

    Development and Maintenance

    • Upgrade frontend and Rust dependencies, update CI and release actions, and move CI/release builds to Node.js 24.
    • Add a VS Code launch configuration for Tauri development and expand regression coverage.
    • Update homepage links to switchhosts.app. (#1059)

    2026-10-05 · 自 v5.0.3-beta.2 以来的修改

    新增功能

    • 远程 hosts 支持批量域名解析,可按行输入多个域名,查看逐项解析结果,并支持并发查询和缓存 IP 回退。
    • 从文件或 URL 导入时支持预览,可选择部分配置追加导入,或替换全部配置;保留文件夹结构、重新映射引用关系,并在替换前要求确认。 (#295)
    • 新增系统 hosts 历史记录管理:支持开启或关闭记录、设置保留数量、查看已保存记录数,以及确认后清空历史记录。 (#1050)
    • HTTP API 支持自定义监听端口,保存后无需重启,并显示运行状态及明确的端口冲突提示;Alfred 工作流同步支持自定义端口。 (#767)
    • 支持打开 hosts 注释中的 HTTP(S) 链接:macOS 使用 Cmd + 单击,Windows/Linux 使用 Ctrl + 单击。

    编辑器与界面

    • 高亮显示托管 hosts 内容的起止边界,并添加横向滚动时仍保持可见的标签。
    • 优化语法高亮,采用紫色强调色并降低行号的视觉干扰;改善选中文本和只读内容的配色,统一控件与红色主题的表现。
    • 调整侧边栏操作入口的位置,简化回收站提示标记。
    • 优化托盘弹窗布局,根据可见条目数量计算初始高度。
    • 修正 macOS 窗口控制按钮的垂直居中位置。

    问题修复与可靠性

    • 修复 hosts 开关状态与实际生效内容不一致的问题,完善 HTTP API 切换、保存失败和恢复流程中的状态同步。
    • 改善 BOM、UTF-16 和 Windows 传统 ANSI 编码的处理;转换编码前备份原始字节,回滚时精确恢复,保留编辑器文本偏移,并在写入前拒绝无效内容。 (#302)
    • 恢复 Alt + 拖动列选择,修正多选区下的注释切换行为。 (#1061)
    • 加强备份文件校验,保留导入元数据,并支持在导入失败或刷新预览后重试。
    • 修复恢复失败时历史记录设置被回退的问题,完善历史记录刷新和重试机制。
    • 修复 macOS 27 上托盘弹窗无法响应点击的问题。
    • 修复弹出模态窗口后无法通过标题栏拖动主窗口的问题。
    • 为无效远程 URL、TLS 证书错误、请求超时和连接失败提供更明确的提示,并避免在错误信息中暴露敏感细节。 (#588)
    • 为批量 DNS 刷新增加域名数量和执行时间限制,防止过期响应覆盖刷新元数据,并完善后台刷新失败的记录。

    多语言支持

    • 新增西班牙语、意大利语、荷兰语、葡萄牙语、越南语、俄语和泰语。
    • 重新设计语言选择菜单,支持主题适配和响应式多列布局。

    开发与维护

    • 升级前端及 Rust 依赖,更新 CI 和发布工作流中的 Actions,并将 CI 与发布构建环境升级至 Node.js 24。
    • 新增用于 Tauri 开发的 VS Code 启动配置,并扩展回归测试覆盖。
    • 将项目主页链接更新为 switchhosts.app。 (#1059)

    Full Changelog: https://github.com/oldj/SwitchHosts/compare/v5.0.3-beta.2...v5.0.3-beta.3

  3. 5.0.3-beta.2

    预发布

    GitHub Release

    What's Changed

    New Contributors

    Full Changelog: https://github.com/oldj/SwitchHosts/compare/v5.0.3-beta.1...v5.0.3-beta.2

  4. 5.0.3-beta.1

    展开

    GitHub Release

    What's Changed

    New Contributors

    Full Changelog: https://github.com/oldj/SwitchHosts/compare/v5.0.1...v5.0.3-beta.1

  5. 5.0.2

    展开

    OpenNavo 编辑 Homebrew 收录

    将 react-router 更新至 7.15.1、Vite 更新至 8.0.16,并将 undici 更新至 7.28.0。

    变更
    react-router 更新至 7.15.1,Vite 更新至 8.0.16,undici 更新至 7.28.0。

    变更内容

    完整变更记录:https://github.com/oldj/SwitchHosts/compare/v5.0.1...v5.0.2

    官方来源:https://github.com/oldj/SwitchHosts/releases/tag/v5.0.2 Homebrew 版本证据:https://github.com/Homebrew/homebrew-cask/commit/851fd28122cd3d674308f99a0893fec38d612b74

  6. 5.0.1

    展开

    OpenNavo 编辑 Homebrew 收录

    新增轻量模式、自定义数据存储和 macOS 特权辅助程序;改进托盘生命周期,并修复启动时的可见性、数据恢复和发布工作流程问题。

    变更
    新增轻量模式、自定义数据存储和 macOS 特权辅助程序;改...

    新功能

    • 新增“轻量模式”:关闭主窗口后可释放 WebView 内存,适合希望降低后台资源占用的用户。
    • 恢复自定义数据存储位置功能:可选择数据目录、迁移现有数据,并重置为默认位置。
    • 在 macOS 上新增具有特权的后台 Helper,减少写入 /etc/hosts 时反复提示输入管理员密码的次数。(如果 Helper 出现问题,可直接打开 macOS“登录项”设置,批准或重新启用它。)
    • 新增“关闭主窗口时退出应用”选项,更符合 Windows 用户的使用习惯。

    体验改进

    • 优化托盘窗口的创建和销毁,降低后台运行时的资源占用。
    • 较长的更新日志现在可滚动查看,不再被截断。
    • 为导入 URL 对话框添加标题;所有模态框标题统一加粗,提高可读性。
    • 为数据目录恢复对话框添加默认路径提示,帮助避免误操作。
    • 调整常规设置中的项目顺序,并改进多语言文案。

    问题修复

    • 修复 Windows/Linux 标题栏关闭按钮未能正确触发轻量模式内存释放的问题。
    • 修复 Windows/Linux 上托盘迷你窗口可能在打开后立即关闭的问题。
    • 修复 macOS 上即使启用“启动时隐藏”,登录时主窗口仍可能出现的问题。
    • 加强自定义数据目录损坏、丢失或指针无效时的恢复流程。
    • 修复数据目录恢复过程中可能短暂显示默认数据的问题。
    • 修复发布工作流中的竞态条件,避免多个构建任务同时创建发布草稿。

    依赖与内部改进

    • 更新多项前端、后端和 Rust 依赖,包括 Electron、Vite、Hono、Axios、Lodash、React、Mantine、Vitest、Sass 等。
    • 更新与安全相关的间接依赖,包括 picomatch、@xmldom/xmldom、follow-redirects、rustls-webpki、tar 等。
    • 增加窗口生命周期、轻量模式、托盘行为、数据目录恢复及配置更新失败路径的测试覆盖。
    • 改进 macOS Helper 诊断日志,便于通过系统日志排查后台组件问题。

    完整更新日志: https://github.com/oldj/SwitchHosts/compare/v5.0.0...v5.0.1

    官方来源: https://github.com/oldj/SwitchHosts/releases/tag/v5.0.1 Homebrew 版本依据: https://github.com/Homebrew/homebrew-cask/commit/bc57d821269a4911dc94d71c886952ee64f93f14

  7. 5.0.1-beta.8

    展开

    GitHub Release

    v5.0.1-beta.8

    Added

    • Restored custom data storage location support, with options to change or reset the data directory in Advanced settings.
    • Added an option to copy existing data when changing the data directory, with a warning if the target already contains data.
    • Added a startup recovery dialog when the custom data directory is missing, unavailable, or has a damaged location record.

    Improved

    • Update dialog changelogs now scroll instead of being truncated.
    • Added a title to the import-from-URL dialog and improved modal title styling.

    Fixed

    • Fixed cases where SwitchHosts could accidentally fall back to the default data directory when the custom location was unavailable.
    • Blocked data writes, remote refresh, HTTP API, tray mini window, and related actions from bypassing the recovery flow.
    • Added stronger validation before switching data directories to avoid restarting into an unusable location.

    Dependencies

    • Updated Rust dependency tar from 0.4.45 to 0.4.46.

    v5.0.1-beta.8

    新增

    • 恢复自定义数据存储位置功能,可在高级设置中更改或重置数据目录。
    • 更改数据目录时支持复制现有数据,并在目标目录已有数据时提示覆盖风险。
    • 当自定义数据目录丢失、不可用或记录损坏时,启动时会显示恢复对话框。

    优化

    • 更新弹窗的 changelog 支持滚动显示,避免长内容被截断。
    • 导入 URL 弹窗新增标题,弹窗标题样式更清晰。

    修复

    • 修复自定义数据目录异常时可能误用默认目录的问题。
    • 恢复状态下会阻止数据写入、远程刷新、HTTP API、托盘迷你窗口等操作绕过恢复流程。
    • 增强数据目录切换前的可用性检查,避免保存无效目录后启动失败。

    依赖

    • 升级 Rust 依赖 tar:0.4.45 → 0.4.46。

    Full Changelog: https://github.com/oldj/SwitchHosts/compare/v5.0.1-beta.7...v5.0.1-beta.8

  8. 5.0.1-beta.7

    展开

    GitHub Release

    Changelog

    Added

    • Added a macOS background helper that can write to /etc/hosts silently after one-time authorization, reducing repeated password prompts during automatic remote hosts updates.
    • Added background helper management in General settings, including status, install, reinstall, and remove actions.
    • Added an “Open System Settings” button to help users approve the helper in macOS Login Items.

    Improved

    • macOS hosts applying now tries the background helper first, then automatically falls back to the existing system authorization flow if the helper is unsupported, unavailable, or fails.
    • Added safety checks to the helper write flow and restricted privileged writes to /etc/hosts only.
    • Improved macOS login startup behavior to avoid unexpectedly showing a previously hidden main window.

    Fixed

    • Fixed background helper XPC signature validation failures on macOS 26.
    • Fixed possible concurrent helper unregister/register operations when repeatedly triggering helper repair.
    • Fixed macOS universal builds failing to package the background helper binary correctly.

    修改日志

    新增

    • 新增 macOS 后台助手,可在一次授权后静默写入系统 /etc/hosts,减少自动更新远程 hosts 时反复输入密码的情况。
    • 在通用设置中新增后台助手管理入口,支持查看状态、安装、重新安装、移除。
    • 新增“打开系统设置”按钮,方便用户前往 macOS“登录项”中批准后台助手。

    改进

    • macOS 应用 hosts 时优先使用后台助手;当后台助手不可用、不受支持或写入失败时,自动回退到原有系统授权流程。
    • 后台助手写入流程增加安全校验,并固定只允许写入 /etc/hosts。
    • 优化 macOS 登录启动行为,避免登录恢复时意外显示已隐藏的主窗口。

    修复

    • 修复 macOS 26 下后台助手 XPC 签名校验失败导致无法连接的问题。
    • 修复重复点击后台助手修复操作时可能触发并发注册/注销的问题。
    • 修复 macOS universal 构建中后台助手二进制未正确打包的问题。

    Full Changelog: https://github.com/oldj/SwitchHosts/compare/v5.0.1-beta.4...v5.0.1-beta.7

  9. 5.0

    展开

    OpenNavo 编辑 Homebrew 收录

    从 Electron 迁移至 Tauri 2,新增分层数据存储和 CodeMirror 6,重建更新与原生权限处理,并重新设计界面和偏好设置。

    更新
    从 Electron 迁移至 Tauri 2,新增分层数据存储和 CodeM...

    更新列表

    • 核心架构迁移至 Tauri 2:从 Electron 主进程迁移至 Rust/Tauri 后端,新增完整的 src-tauri 实现,并移除旧版 Electron 主进程代码、打包脚本和 electron-builder 工作流。
    • 全新的 v5 数据结构:数据现在分层存储于 manifest.json、entries/、trashcan.json、internal/config.json 和 internal/histories/。相应更新了 README 中的备份说明。
    • 兼容迁移、导入和导出:支持首次运行时从旧版 PotDb 数据迁移;手动导入现支持 v3、v4 和 v5 备份;导出现在采用 v5 备份 JSON 格式,并使用带时间戳的文件名。
    • 重构系统 Hosts 写入方式:改用系统原生权限流程:macOS 使用 Security.framework,Linux 使用 pkexec,Windows 使用 UAC 自我提权。移除了应用内 sudo 密码输入。
    • 新增并重构自动更新系统:集成 Tauri updater,支持后台检查更新、手动下载和安装、更新请求代理,以及生成和发布 latest.json。
    • 重建 CI 和发布流水线:新增 GitHub Actions CI 和 Release 工作流。发布前现在会运行完整测试套件,并支持 macOS universal/arm64/x64、Windows x64/x86/arm64 及 Linux x64/arm64 的签名和验证构建。
    • 编辑器升级至 CodeMirror 6:提升大文件性能、语法高亮、行号、只读模式、历史快照渲染,以及光标和显示稳定性。
    • 增强远程 Hosts 刷新:新增启动时刷新支持、响应大小限制,以及 CRLF/LF 规范化。
    • 改进系统托盘行为:修复 macOS 焦点处理、多显示器定位、圆角和交互问题。
    • 主界面重大改版:新增左侧活动栏、Hosts/垃圾箱视图切换、可调整大小的左右面板、右侧详情面板、居中标题栏、无边框窗口和跨平台窗口控件。
    • 右侧详情面板:显示当前 Hosts 类型、规则数量、远程 URL、刷新间隔、上次刷新时间、分组内容和文件夹选择模式;可在面板中恢复或永久删除垃圾箱项目。
    • 统一垃圾箱体验:将垃圾箱入口移至左侧边栏,并支持显示项目数量、恢复、永久删除、清空和详情面板操作。
    • 重构偏好设置:将偏好设置拆分为常规、命令、代理和高级选项卡。常规和高级设置会自动保存,命令和代理则保留手动保存状态提示。
    • 新增偏好设置选项:新增默认使用系统主题、登录时启动,以及启动时刷新远程 Hosts。
    • 增强代理支持:新增 socks5 代理协议支持,远程 Hosts 刷新和应用更新现在都可使用代理设置。
    • 保留并迁移本地 HTTP API:使用 Rust/Axum 重新实现 50761 API,支持 /api/list 和 /api/toggle;端口绑定失败时会回滚设置并通知用户。
    • 本地化和文案更新:整理并排序语言区域键,修复语言偏好回退显示,本地化菜单和查找窗口文本,并更新多语言 README 截图及 v5 文档。
    • 稳定性修复:修复并发配置写入、HTTP API 启动失败状态、隐藏 Dock 图标后窗口不可见、拖动后悬停状态卡住、标题栏与托盘切换不同步、长标题截断、加载界面卡住等问题。
    • 扩展测试覆盖:新增 Playwright e2e 测试、Rust 测试,以及前端组件和模型单元测试,覆盖偏好设置、导入/导出、远程 Hosts、本地 Hosts、垃圾箱、标题栏、树操作、查找/替换等。
    • 工具链升级:升级至 Vite 8、TypeScript 6、Mantine 9、Vitest 4 和 Tauri 2.11,并引入 ESLint 10 及命名规范规则。
    • 开发和构建命令变更:开发现在使用 npm run tauri:dev;生产构建使用 npm run tauri:build;构建产物现在位于 src-tauri/target/release/bundle/ 下。
    • 移除旧版 Electron 内容:移除 src/main/*、Electron updater、旧的上传和打包脚本、旧主进程测试,以及 vite.main.config.mts。

    完整更新日志:https://github.com/oldj/SwitchHosts/compare/v4.3.0...v5.0.0

    官方来源:https://github.com/oldj/SwitchHosts/releases/tag/v5.0.0 Homebrew 版本依据:https://github.com/Homebrew/homebrew-cask/commit/4b137508c58b95be554ed631b6e90cf96b51c515

  10. 4.3.0-prerelease

    展开

    GitHub Release

    SwitchHosts v4.3.0

    What's Changed

    • Updated dependencies
    • Migrated UI components from Chakra UI to Mantine
    • Switched to CodeJar for hosts content editing
    • Replaced Express with Hono.js for API implementation
    • Miscellaneous improvements and fixes

    New Contributors

    Full Changelog: https://github.com/oldj/SwitchHosts/compare/v4.2.0...v4.3.0

  11. 4.2.0.6119
  12. 4.2.0

    展开

    GitHub Release

    What's Changed

    New Contributors

    Full Changelog: https://github.com/oldj/SwitchHosts/compare/v4.1.2...v4.2.0

  13. 4.2.0-beta

    展开

    GitHub Release

    What's Changed

    New Contributors

    Full Changelog: https://github.com/oldj/SwitchHosts/compare/v4.1.2...v4.2.0-beta

  14. 4.1.2

    展开

    GitHub Release

    What's Changed

    New Contributors

    Full Changelog: https://github.com/oldj/SwitchHosts/compare/v4.1.1...v4.1.2

  15. 4.1.2-beta

    展开

    GitHub Release

    What's Changed

    New Contributors

    Full Changelog: https://github.com/oldj/SwitchHosts/compare/v4.1.1...v4.1.2-beta