-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 64e52ab
Showing
6 changed files
with
1,018 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
# https://github.com/github/gitignore/blob/main/Node.gitignore | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
.pnpm-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Snowpack dependency directory (https://snowpack.dev/) | ||
web_modules/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional stylelint cache | ||
.stylelintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variable files | ||
.env | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.env.local | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
.parcel-cache | ||
|
||
# Next.js build output | ||
.next | ||
out | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and not Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# vuepress v2.x temp and cache directory | ||
.temp | ||
.cache | ||
|
||
# Docusaurus cache and generated files | ||
.docusaurus | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
|
||
# Stores VSCode versions used for testing VSCode extensions | ||
.vscode-test | ||
|
||
# yarn v2 | ||
.yarn/cache | ||
.yarn/unplugged | ||
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* | ||
|
||
|
||
# https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore | ||
|
||
.vscode | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
!.vscode/*.code-snippets | ||
|
||
# Local History for Visual Studio Code | ||
.history/ | ||
|
||
# Built Visual Studio Code Extensions | ||
*.vsix | ||
|
||
|
||
# #################### | ||
|
||
.idea | ||
.idea/* | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 lingbopro | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# Easy GitHub Hosts | ||
|
||
## 介绍 | ||
|
||
这是一个用 `Node.js` 制作的程序,用于自动将 **GitHub 相关域名的 IP 地址**添加到 `HOSTS` 文件中,达到**在大陆快速访问 GitHub** 的目的。 | ||
(闲的没事写的,代码好看不了一点`(ˉ▽ˉ;)...`) | ||
|
||
## 使用方法 | ||
|
||
### 1. 安装 Node.js | ||
|
||
如果你没有安装 `Node.js`,请到 [Node.js 官网](//nodejs.org/en/download) 下载 Node.js。 | ||
PS:测试时使用的是 `Node.js v20.11.1`。 | ||
|
||
### 2. 克隆存储库 | ||
|
||
在终端中使用 git 克隆存储库: | ||
|
||
```shell | ||
git clone https://github.com/lingbopro/easy-github-hosts.git | ||
``` | ||
|
||
### 3.安装依赖项 | ||
|
||
在终端中执行: | ||
|
||
```shell | ||
npm install | ||
``` | ||
|
||
### 4. 运行 | ||
|
||
在克隆的文件夹内运行: | ||
|
||
```shell | ||
node main.js | ||
``` | ||
|
||
有 3 种可选的选项,详见[选项](#选项)。 | ||
如果写入失败,请尝试以管理员运行(Windows),或者以超级用户权限执行(`sudo`,Linux/Mac) | ||
_(PS:测试的时候只测了 `Windows`,`Linux` 不保证完全可行)_ | ||
|
||
### 5. 完事! | ||
|
||
## 选项 | ||
|
||
可以在运行时在命令中增加可选的选项(见下) | ||
|
||
### --debug | ||
|
||
启用调试模式(会输出更详细的信息)。 | ||
|
||
```shell | ||
node main.js --debug | ||
``` | ||
|
||
### --noedit | ||
|
||
不编辑 HOSTS 文件,只是输出增加条目后的内容。 | ||
|
||
```shell | ||
node main.js --noedit | ||
``` | ||
|
||
### --diff | ||
|
||
不修改文件,只输出更改了的内容(必须和 [`--noedit`](#noedit) 选项一同使用)。 | ||
|
||
```shell | ||
node main.js --noedit --diff | ||
``` | ||
|
||
## TODO | ||
|
||
[ ] 完善域名列表 | ||
[ ] 将写入 `HOSTS` 文件的代码和获取 IP 的代码分离 | ||
[ ] 使其可以用于所有这样的网站 | ||
[ ] 把代码整的美观一些 | ||
|
||
## 开源说明 | ||
|
||
此项目是一个开源项目。此项目使用 [MIT 开源许可](LICENCE)。 | ||
根据许可,你可以对该项目进行传播、分发、修改以及二次发布,包括个人和商业用途,且无需标明存储库等信息。 | ||
|
||
## 贡献须知 | ||
|
||
_~~我自己写的代码都又臭又长,还要什么贡献须知(bushi~~_ | ||
就一件事,用 [Prettier](//prettier.cn) | ||
|
||
## 其它 | ||
|
||
啊? |
Oops, something went wrong.