|
|
@@ -1,68 +1,69 @@
|
|
|
# SwitchHosts!
|
|
|
|
|
|
-Homepage: [https://oldj.github.io/SwitchHosts/](https://oldj.github.io/SwitchHosts/)
|
|
|
+ - [简体中文](README_cn.md)
|
|
|
|
|
|
+Homepage: [https://oldj.github.io/SwitchHosts/](https://oldj.github.io/SwitchHosts/)
|
|
|
|
|
|
-这是一个用于快速切换 hosts 文件的小程序,基于 [Electron](http://electron.atom.io/) 开发,同时使用了 [React](https://facebook.github.io/react/)、[Ant Design](https://ant.design) 以及 [CodeMirror](http://codemirror.net/) 等框架/库。
|
|
|
+SwitchHosts! is an App for managing hosts file, it is based on [Electron](http://electron.atom.io/), [React](https://facebook.github.io/react/), and [Ant Design](https://ant.design), [CodeMirror](http://codemirror.net/), etc.
|
|
|
|
|
|
-## 截图
|
|
|
+## Screenshot
|
|
|
|
|
|
<img src="https://raw.githubusercontent.com/oldj/SwitchHosts/master/assets/capture.png" alt="Capture" width="980" style="border:1px solid #979797;">
|
|
|
|
|
|
|
|
|
-## 功能特性
|
|
|
+## Features
|
|
|
|
|
|
- - 快速切换 hosts
|
|
|
- - hosts 文件语法高亮
|
|
|
- - 在线 hosts 方案
|
|
|
- - 系统托盘图标快速切换
|
|
|
- - macOS: 支持 [Alfred workflow](http://www.packal.org/workflow/switchhosts) 快速切换
|
|
|
+ - Switch hosts quickly
|
|
|
+ - Syntax highlight
|
|
|
+ - Remote hosts
|
|
|
+ - Switch from system tray
|
|
|
+ - macOS only: [Alfred workflow](http://www.packal.org/workflow/switchhosts) support
|
|
|
|
|
|
|
|
|
-## 安装
|
|
|
+## Install
|
|
|
|
|
|
-### 下载安装
|
|
|
+### Download
|
|
|
|
|
|
-你可以直接下载源码到本地运行或编辑,或者在下面下载可执行版本:
|
|
|
+You can download the source code and build it yourself, or download the built version from following links:
|
|
|
|
|
|
- - [SwitchHosts! 下载地址1(GitHub release)](https://github.com/oldj/SwitchHosts/releases)
|
|
|
- - [SwitchHosts! 下载地址2(百度网盘)](http://pan.baidu.com/share/link?shareid=150951&uk=3607385901)
|
|
|
+ - [SwitchHosts! Download Page 1 (GitHub release)](https://github.com/oldj/SwitchHosts/releases)
|
|
|
+ - [SwitchHosts! Download Page 2 (Baidu Yunpan)](http://pan.baidu.com/share/link?shareid=150951&uk=3607385901)
|
|
|
|
|
|
### brew
|
|
|
|
|
|
-在 macOS 上,也可以使用 `brew cast` 安装,命令如下:
|
|
|
+If you are useing macOS, you can install SwitchHosts! by `brew cast`:
|
|
|
|
|
|
```bash
|
|
|
brew cask install switchhosts
|
|
|
```
|
|
|
|
|
|
-感谢 [@gobinathm](https://github.com/gobinathm)、[@iamybj](https://github.com/iamybj) 更新 `brew cask` 版本。
|
|
|
+Thanks to [@gobinathm](https://github.com/gobinathm) and [@iamybj](https://github.com/iamybj) for updating the `brew cask` version.
|
|
|
|
|
|
|
|
|
|
|
|
-## 文件备份
|
|
|
+## Backup
|
|
|
|
|
|
-SwitchHosts! 的数据文件在 `~/.SwitchHosts` 目录下(Windows 用户为个人主目录下的 `.SwitchHosts` 目录下),其中 `~/.SwitchHosts/data.json` 是 hosts 数据文件,`~/.SwitchHosts/prefereces.json` 是配置信息。
|
|
|
+SwitchHosts! stores data at `~/.SwitchHosts` (Or folder `.SwitchHosts` under the current user's home path on Windows), the `~/.SwitchHosts/data.json` contains data, while the `~/.SwitchHosts/prefereces.json` contains preferences info.
|
|
|
|
|
|
|
|
|
-## 运行/打包方法
|
|
|
+## Run and Build
|
|
|
|
|
|
-### 环境配置
|
|
|
+### Environment
|
|
|
|
|
|
- - 安装 [Node.js](https://nodejs.org/) 环境;
|
|
|
- - 在根目录 `./` 下,运行 `npm install` 命令,安装开发依赖库;
|
|
|
- - 在 `./app` 目录下,运行 `npm install` 命令,安装 App 运行依赖库;
|
|
|
+ - Install [Node.js](https://nodejs.org/)
|
|
|
+ - Change to the folder `./`, run `npm install` to install dependented libraries
|
|
|
+ - Change to the folder `./app`, run `npm install` again
|
|
|
|
|
|
```bash
|
|
|
npm install
|
|
|
cd app && npm install && cd ..
|
|
|
```
|
|
|
|
|
|
-### 构建及运行
|
|
|
+### Build and run
|
|
|
|
|
|
- - 在 `./` 目录下,运行 `npm run dll` 命令,构建公共文件(仅需在第一次构建或公共库发生改变时执行);
|
|
|
- - 在 `./` 目录下,运行 `npm run build` 命令,构建所需文件;
|
|
|
- - 在 `./` 目录下,运行 `npm start` 命令,即可运行程序。
|
|
|
+ - Change to the folder `./`, run `npm run dll` to build common files
|
|
|
+ - Change to the folder `./`, run `npm run build`
|
|
|
+ - Change to the folder `./`, run `npm start`, the App should start
|
|
|
|
|
|
```bash
|
|
|
# create dll file
|
|
|
@@ -78,79 +79,35 @@ SwitchHosts! 的数据文件在 `~/.SwitchHosts` 目录下(Windows 用户为
|
|
|
npm run dev
|
|
|
```
|
|
|
|
|
|
-### 打包发布
|
|
|
+### Package and Zip
|
|
|
|
|
|
- - 建议使用 [electron-packager](https://github.com/electron-userland/electron-packager) 进行打包
|
|
|
+ - It is recommended to use [electron-packager](https://github.com/electron-userland/electron-packager) for packaging.
|
|
|
|
|
|
```bash
|
|
|
# install electron-packager for use from cli
|
|
|
npm install electron-packager -g
|
|
|
```
|
|
|
|
|
|
- - 在 `./` 目录下,运行 `npm run pack` 命令,打包后的文件位于 `./dist` 目录;
|
|
|
- - 首次执行此命令可能需要花费较多时间(需要下载对应的构建文件),也可先手动下载[对应的发布版本](https://github.com/electron/electron/releases)([淘宝镜像](https://npm.taobao.org/mirrors/electron/)),手动保存到 `~/.electron` 目录下。更多信息请参考 [Electron 文档](http://electron.atom.io/docs/)。
|
|
|
+ - Go to the `./` folder, run `npm run pack` . The packaged file will be the `./dist` folder.
|
|
|
+ - This command may take several minutes to finish when you run it the first time, as it needs time to download dependent files. You can download the dependencies manually [here](https://github.com/electron/electron/releases), or [Taobao mirror](https://npm.taobao.org/mirrors/electron/), then save the files to `~/.electron`. You can check the [Electron Docs](http://electron.atom.io/docs/) for more infomation.
|
|
|
|
|
|
```bash
|
|
|
# pack
|
|
|
npm run pack # the packed files will be in ./dist
|
|
|
|
|
|
- # 也可以只打包特定平台的版本,如
|
|
|
+ # or pack for a special platform
|
|
|
npm run pack-mac # pack for macOS, the packed files will be in ./dist
|
|
|
npm run pack-win # pack for Windows, the packed files will be in ./dist
|
|
|
```
|
|
|
|
|
|
- - 打包完成后,可运行以下命令将生成的程序压缩为 zip 文件。
|
|
|
+ - After packaging, you can make a zip file by run the following command.
|
|
|
|
|
|
```bash
|
|
|
# zip
|
|
|
npm run zip # the zipped files will be in ./dist
|
|
|
```
|
|
|
|
|
|
-## 更新历史
|
|
|
-
|
|
|
-### v3.3
|
|
|
-
|
|
|
- - 2017-05-30 引入 [Ant Design](https://ant.design) 重写部分 UI 组件
|
|
|
- - 2017-04-03 支持通过 Alfred 快速切换([下载 workflow](http://www.packal.org/workflow/switchhosts))
|
|
|
- - 2017-04-01 代码重构,增加「分组」功能
|
|
|
-
|
|
|
-### v3.2
|
|
|
-
|
|
|
- - 2016-09-06 使用 Electron 打包,增加 Windows 版[下载](https://github.com/oldj/SwitchHosts/releases)。
|
|
|
-
|
|
|
-### v3.1
|
|
|
-
|
|
|
- - 2016-04-29 更新自动清除 DNS 缓存功能 [#90](https://github.com/oldj/SwitchHosts/issues/90)。
|
|
|
- - 2016-01-15 搜索时增加模糊搜索支持(eg. `go*le` matches `google`)及正则支持(eg. `/go.*le` matches `google`)。
|
|
|
- - 2016-01-10 远程方案可以设置自动更新时间。
|
|
|
- - 2015-12-26 实现 Tray 菜单切换、Dock 图标隐藏、方案导入导出等功能。
|
|
|
- - 2015-12-20 从 Electron 切换至 MacGap 。
|
|
|
-
|
|
|
-### v3.0
|
|
|
-
|
|
|
- - 2015-11-30 完成 3.0 版基本功能。
|
|
|
-
|
|
|
-### v2.0
|
|
|
-
|
|
|
- - 2013-02-06 解决 Linux/Mac 下没有修改系统 hosts 文件权限的问题。
|
|
|
- - 2012-12-27 启动时检查是否为单一实例,禁止同时运行多个实例。
|
|
|
- - 2012-11-16 接受 @charlestang 网友的 pull request,同时参考了 @allenm 的修改,实现了 Common Hosts 功能。
|
|
|
- - 2012-11-09 简单优化:Common Hosts 不允许删除,不允许“切换到”,将右键菜单相关条目禁用,允许更换图标颜色。修复新增在线方案时,url 框默认禁用的小 bug。
|
|
|
- - 2012-10-09 增加 hosts 方案拖拽排序功能。
|
|
|
- - 2012-10-05 修复在中文目录下程序无法正常启动的问题。
|
|
|
- - 2012-09-30 初步完成 0.2.0 版。
|
|
|
-
|
|
|
-### v1.0
|
|
|
-
|
|
|
- - 2011-12-14 允许输入超长的 hosts 方案。
|
|
|
- - 2011-10-09 发布 0.1.6 版,修复若干 bug,增加自动检查最新版本的功能。
|
|
|
- - 2011-09-29 发布 0.1.5 版,新增 hosts 内容语法高亮。
|
|
|
- - 2011-09-28 发布 0.1.4 版,新增“添加”、“删除”按钮;hosts 内容修改后自动保存;修复若干 bug。
|
|
|
- - 2011-09-19 发布 0.1.3 版,修复若干 bug。
|
|
|
- - 2011-09-15 发布 0.1.2 版,添加主面板,可以在主面板上对 hosts 进行增加、删除、编辑、重命名等操作。
|
|
|
- - 2011-09-02 发布 0.1.0 版,完成基本功能。
|
|
|
-
|
|
|
|
|
|
-## 版权
|
|
|
+## Copyright
|
|
|
|
|
|
-本程序完全免费,并基于 MIT 协议开源。
|
|
|
+SwitchHosts! is a free and open source software based on the MIT license.
|