master dd7b62bf5a13 cached
9 files
11.5 KB
3.8k tokens
2 symbols
1 requests
Download .txt
Repository: mouyase/ChinaListForAdGuardHome
Branch: master
Commit: dd7b62bf5a13
Files: 9
Total size: 11.5 KB

Directory structure:
gitextract_b82yvi8e/

├── .eslintrc.js
├── .github/
│   └── workflows/
│       └── main.yml
├── .gitignore
├── .prettierrc.js
├── CNAME
├── LICENSE
├── README.MD
├── index.js
└── package.json

================================================
FILE CONTENTS
================================================

================================================
FILE: .eslintrc.js
================================================
module.exports = {
  env: {
    browser: true,
    es2021: true,
  },
  overrides: [
    {
      env: {
        node: true,
      },
      files: ['.eslintrc.{js,cjs}'],
      parserOptions: {
        sourceType: 'script',
      },
    },
  ],
  parserOptions: {
    ecmaVersion: 'latest',
    sourceType: 'module',
  },
  extends: ['eslint:recommended', 'plugin:prettier/recommended'],
  rules: {
    eqeqeq: 'error', // 必须使用全等
    'no-nested-ternary': 'error', // 禁止嵌套三元表达式
    'react-native/no-inline-styles': 'off', // 关闭行内样式检测
    'react/display-name': 'off', // 关闭display-name检测,打开会导致无法定义箭头函数组件
    curly: 'error', // 强制要求if换行
    'no-unused-vars': ['warn'],
  },
}


================================================
FILE: .github/workflows/main.yml
================================================
name: Build&Deploy

on:
    push:
        branches:
            - master
    schedule:
        - cron: '0 0 * * *'

permissions:
  contents: read
  pages: write
  id-token: write

jobs:
  build:
    runs-on: ubuntu-latest

    environment:
      name: github-pages

    steps:
    - name: Setup Node.js
      uses: actions/setup-node@v4.0.2

    - name: Checkout Project
      uses: actions/checkout@v4.1.1

    - name: Build
      run: |
        sudo npm i yarn -g
        yarn
        yarn run build

    - name: Copy Files
      run: |
        cp CNAME dist/CNAME
        cp README.MD dist/README.MD

    - name: Upload Artifact
      uses: actions/upload-pages-artifact@v3
      with:
        path: ./dist

    - name: Deploy to GitHub Pages
      uses: actions/deploy-pages@v4.0.4


================================================
FILE: .gitignore
================================================
# Created by .ignore support plugin (hsz.mobi)
### Node template
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-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

# 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 variables file
.env
.env.test

# 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

# 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.*

.idea/

================================================
FILE: .prettierrc.js
================================================
module.exports = {
  arrowParens: 'avoid', // 箭头函数是否使用括号,avoid是尽可能不用,always是全都用
  bracketSameLine: true, // >符号是否拆行放置
  jsxBracketSameLine: true, // jsx内>符号是否拆行放置
  bracketSpacing: true, // 对象内是否添加空格
  singleQuote: true, // 是否使用单引号
  jsxSingleQuote: true, // jsx中是否使用单引号
  trailingComma: 'all', // 多行时尽可能添加逗号
  endOfLine: 'auto', // 配置换行符是cr还是lf,auto是自动配置
  useTabs: false, // 是否使用tab,true使用tab,false使用空格替换tab
  tabWidth: 2, // 缩进长度
  semi: false, // 是否强制分号结尾
}


================================================
FILE: CNAME
================================================
adguard.yojigen.tech

================================================
FILE: LICENSE
================================================
MIT License

Copyright (c) 2021 某亚瑟

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.


================================================
FILE: README.MD
================================================
# ChinaListForAdGuardHome

**注意,闪存较小设备不建议使用本项目,规则文件较大,可能会爆闪存**

基于`googlehosts`和`dnsmasq-china-list`生成的`AdGuardHome`上游DNS配置

## 配置文件说明

### ChinaList

基于`dnsmasq-china-list`,使用`腾讯云`的`DoH`解析的配置

### GoogleHostsList

基于`googlehosts`,使用`Cloudflare`的`DoH`解析的配置

### ChinaWhiteList

在融合了前二者的基础上,添加了
 - `Quad9`
 - `Quad101`
 - `OpenDNS`
 - `Google`
 - `Cloudflare`
的`DoH`作为基础解析的配置,如果需要`除大陆白名单以外全部使用国外DNS`,则可以选择此方案

### ChinaBlackList

在融合了前二者的基础上,添加了
 - `阿里云`
 - `腾讯云`
 - `rubyfish`
的`DoH`作为基础解析的配置,如果需要`除GoogleHosts以外全部使用大陆DNS`,则可以选择此方案

## 去广告规则
### HalfLifeList
[https://github.com/o0HalfLife0o/list](https://github.com/o0HalfLife0o/list)
> 合并自乘风视频广告过滤规则、EasylistChina、EasylistLite、CJX'sAnnoyance,以及补充的一些规则

### AntiAD

[https://github.com/privacy-protection-tools/anti-AD](https://github.com/privacy-protection-tools/anti-AD)
> 致力于成为中文区命中率最高的广告过滤列表,实现精确的广告屏蔽和隐私保护。anti-AD现已支持AdGuardHome,dnsmasq, Surge,Pi-Hole,smartdns等网络组件。完全兼容常见的广告过滤工具所支持的各种广告过滤列表格式

### AdRulesDNSList
[https://github.com/Cats-Team/AdRules](https://github.com/Cats-Team/AdRules)

> List for blocking ads in the Chinese region


## 使用方式
将文件内容复制到`DNS 设置 / 上游 DNS 服务器`中,保存即可

[HalfLifeList.txt](#HalfLifeList)与[AntiAD](#AntiAD)是目前两个比较适合大陆的广告屏蔽表,推荐大家使用

[AdRulesDNSList](#AdRulesDNSList)是更加激进一些的广告屏蔽表,可能会导致误杀,建议大家酌情使用

### 配置文件地址

| 配置文件               | 地址                                                                                                   |
|--------------------|------------------------------------------------------------------------------------------------------|
| ChinaList          | [https://adguard.yojigen.tech/ChinaList.txt](https://adguard.yojigen.tech/ChinaList.txt)             |
| GoogleHostsList    | [https://adguard.yojigen.tech/GoogleHostsList.txt](https://adguard.yojigen.tech/GoogleHostsList.txt) |
| ChinaWhiteList     | [https://adguard.yojigen.tech/ChinaWhiteList.txt](https://adguard.yojigen.tech/ChinaWhiteList.txt)   |
| ChinaBlackList     | [https://adguard.yojigen.tech/ChinaBlackList.txt](https://adguard.yojigen.tech/ChinaBlackList.txt)   |

### 去广告规则地址

| 去广告规则              | 地址                                                                                                   |
|--------------------|------------------------------------------------------------------------------------------------------|
| HalfLifeList.txt   | [https://adguard.yojigen.tech/HalfLifeList.txt](https://adguard.yojigen.tech/HalfLifeList.txt)       |
| AntiAD.txt         | [https://adguard.yojigen.tech/AntiAD.txt](https://adguard.yojigen.tech/AntiAD.txt)                   |
| AdRulesDNSList.txt | [https://adguard.yojigen.tech/AdRulesDNSList.txt](https://adguard.yojigen.tech/AdRulesDNSList.txt)   |


================================================
FILE: index.js
================================================
#!/usr/bin/env node
import fs from 'node:fs'

const DIST_PATH = 'dist/'

const DNSPOD = 'https://1.12.12.12/dns-query'
const AliDNS = 'https://223.5.5.5/dns-query'
const RubyFish = 'https://dns.rubyfish.cn/dns-query'

const Quad9 = 'https://dns10.quad9.net/dns-query'
const Cloudflare = 'https://1.0.0.1/dns-query'
const Google = 'https://dns.google/dns-query'
const Quad101 = 'https://dns.twnic.tw/dns-query'
const OpenDNS = 'https://doh.opendns.com/dns-query'

const ChinaDNS = DNSPOD
const GlobalDNS = Cloudflare

const makeDist = async () => {
  try {
    fs.mkdirSync(DIST_PATH)
    return Promise.resolve()
  } catch (e) {
    console.error('dist目录创建失败')
    console.error(e)
    return Promise.resolve()
  }
}

const getChinaList = async () => {
  let chinaListResponse = await fetch(
    'https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf',
  )
  let chinaList = await chinaListResponse.text()
  chinaList = chinaList.replace(/#.+/g, '')
  chinaList = chinaList.replace(
    /server=\/(.+)\/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/g,
    `[/$1/]${ChinaDNS}`,
  )
  chinaList = chinaList.replace(/(\s)\s*/g, '$1')
  chinaList = chinaList.trim()
  fs.writeFileSync(DIST_PATH + 'ChinaList.txt', chinaList, 'UTF-8')
  let googleHostsListResponse = await fetch(
    'https://raw.githubusercontent.com/googlehosts/hosts/master/hosts-files/dnsmasq.conf',
  )
  let googleHostsList = await googleHostsListResponse.text()
  googleHostsList = googleHostsList.replace(/#.+/g, '')
  googleHostsList = googleHostsList.replace(
    /address=\/(.+)\/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/g,
    `[/$1/]${GlobalDNS}`,
  )
  googleHostsList = googleHostsList.replace(`[/localhost/]${GlobalDNS}`, '')
  googleHostsList = googleHostsList.replace(/(\s)\s*/g, '$1')
  googleHostsList = googleHostsList.trim()
  fs.writeFileSync(DIST_PATH + 'GoogleHostsList.txt', googleHostsList, 'UTF-8')
  const chinaWhiteList = `${chinaList}
  ${googleHostsList}
  ${Quad9}
  ${Quad101}
  ${Google}
  ${Cloudflare}
  ${OpenDNS}
  `
  fs.writeFileSync(DIST_PATH + 'ChinaWhiteList.txt', chinaWhiteList, 'UTF-8')
  const chinaBlackList = `${chinaList}
  ${googleHostsList}
  ${AliDNS}
  ${DNSPOD}
  ${RubyFish}
  `
  fs.writeFileSync(DIST_PATH + 'ChinaBlackList.txt', chinaBlackList, 'UTF-8')
}

const getHalfLifeList = async () => {
  let halfLifeListResponse = await fetch(
    'https://raw.githubusercontent.com/o0HalfLife0o/list/master/ad.txt',
  )
  let halfLifeList = await halfLifeListResponse.text()
  halfLifeList = halfLifeList.replace(/! Checksum: (.+)/, '')
  halfLifeList = halfLifeList.replace(/! Title: (.+)/, '! Title: HalfLifeList')
  halfLifeList = halfLifeList.trim()
  fs.writeFileSync(DIST_PATH + 'HalfLifeList.txt', halfLifeList, 'UTF-8')
}

const getAntiAD = async () => {
  let antiADResponse = await fetch('https://anti-ad.net/easylist.txt')
  let antiAD = await antiADResponse.text()
  antiAD = antiAD.replace(/!Title: (.+)/, '!Title: AntiAD')
  antiAD = antiAD.trim()
  fs.writeFileSync(DIST_PATH + 'AntiAD.txt', antiAD, 'UTF-8')
}

const getAdRulesDNSList = async () => {
  let adRulesDNSListResponse = await fetch('https://adrules.top/dns.txt')
  let adRulesDNSList = await adRulesDNSListResponse.text()
  adRulesDNSList = adRulesDNSList.replace(
    /!Title: (.+)/,
    '!Title: AdRulesDNSList',
  )
  adRulesDNSList = adRulesDNSList.trim()
  fs.writeFileSync(DIST_PATH + 'AdRulesDNSList.txt', adRulesDNSList, 'UTF-8')
}

const main = async () => {
  await makeDist()
  await getChinaList()
  await getHalfLifeList()
  await getAntiAD()
  await getAdRulesDNSList()
}

main()
  .then(() => {
    console.log('规则创建完成')
  })
  .catch(reason => {
    console.error('规则创建错误', reason)
  })


================================================
FILE: package.json
================================================
{
  "name": "ChinaListForAdGuardHome",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "scripts": {
    "build": "node index.js",
    "lint": "eslint \"**/*.{js,ts,jsx,tsx}\""
  },
  "type": "module",
  "dependencies": {
    "node-fetch": "^3.3.2"
  },
  "devDependencies": {
    "eslint": "^8.0.1",
    "eslint-config-prettier": "^9.1.0",
    "eslint-plugin-prettier": "^5.1.3",
    "prettier": "^3.2.5"
  }
}
Download .txt
gitextract_b82yvi8e/

├── .eslintrc.js
├── .github/
│   └── workflows/
│       └── main.yml
├── .gitignore
├── .prettierrc.js
├── CNAME
├── LICENSE
├── README.MD
├── index.js
└── package.json
Download .txt
SYMBOL INDEX (2 symbols across 1 files)

FILE: index.js
  constant DIST_PATH (line 4) | const DIST_PATH = 'dist/'
  constant DNSPOD (line 6) | const DNSPOD = 'https://1.12.12.12/dns-query'
Condensed preview — 9 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (14K chars).
[
  {
    "path": ".eslintrc.js",
    "chars": 672,
    "preview": "module.exports = {\n  env: {\n    browser: true,\n    es2021: true,\n  },\n  overrides: [\n    {\n      env: {\n        node: tr"
  },
  {
    "path": ".github/workflows/main.yml",
    "chars": 786,
    "preview": "name: Build&Deploy\n\non:\n    push:\n        branches:\n            - master\n    schedule:\n        - cron: '0 0 * * *'\n\nperm"
  },
  {
    "path": ".gitignore",
    "chars": 1889,
    "preview": "# Created by .ignore support plugin (hsz.mobi)\n### Node template\n# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-e"
  },
  {
    "path": ".prettierrc.js",
    "chars": 462,
    "preview": "module.exports = {\n  arrowParens: 'avoid', // 箭头函数是否使用括号,avoid是尽可能不用,always是全都用\n  bracketSameLine: true, // >符号是否拆行放置\n  "
  },
  {
    "path": "CNAME",
    "chars": 20,
    "preview": "adguard.yojigen.tech"
  },
  {
    "path": "LICENSE",
    "chars": 1060,
    "preview": "MIT License\n\nCopyright (c) 2021 某亚瑟\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof thi"
  },
  {
    "path": "README.MD",
    "chars": 2695,
    "preview": "# ChinaListForAdGuardHome\n\n**注意,闪存较小设备不建议使用本项目,规则文件较大,可能会爆闪存**\n\n基于`googlehosts`和`dnsmasq-china-list`生成的`AdGuardHome`上游DN"
  },
  {
    "path": "index.js",
    "chars": 3721,
    "preview": "#!/usr/bin/env node\nimport fs from 'node:fs'\n\nconst DIST_PATH = 'dist/'\n\nconst DNSPOD = 'https://1.12.12.12/dns-query'\nc"
  },
  {
    "path": "package.json",
    "chars": 429,
    "preview": "{\n  \"name\": \"ChinaListForAdGuardHome\",\n  \"version\": \"1.0.0\",\n  \"main\": \"index.js\",\n  \"license\": \"MIT\",\n  \"scripts\": {\n  "
  }
]

About this extraction

This page contains the full source code of the mouyase/ChinaListForAdGuardHome GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 9 files (11.5 KB), approximately 3.8k tokens, and a symbol index with 2 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!