Skip to content

Commit

Permalink
Merge branch 'master' into fixes-to-adguard-dns-api
Browse files Browse the repository at this point in the history
  • Loading branch information
el-termikael authored Dec 16, 2024
2 parents 895fa02 + 92c8f8e commit b44b6d7
Show file tree
Hide file tree
Showing 1,306 changed files with 60,753 additions and 20,702 deletions.
66 changes: 53 additions & 13 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
name: Build and deploy

env:
BASE_DOMAIN: kb-dns.pages.dev
BASE_PATH: /
PAGES_PROJECT: kb-dns

on:
push:
branches:
Expand All @@ -13,22 +18,57 @@ on:
jobs:
build:
runs-on: ubuntu-latest
container:
image: node:20
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v1
- uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
node-version: 18.x
version: 9

- name: Install dependencies
run: pnpm install

- name: Determine branch for deploy
id: get-branch
run: |
if [ "${{ github.ref_name }}" = "master" ]; then
echo "BRANCH_NAME=main" >> $GITHUB_ENV
elif [ "${{ github.event_name }}" = "pull_request" ]; then
PR_NUMBER=${{ github.event.number }}
echo "BRANCH_NAME=pull-request-${PR_NUMBER}" >> $GITHUB_ENV
else
echo "BRANCH_NAME=${{ github.ref_name }}" >> $GITHUB_ENV
fi
- name: Run build
run: |
URL=https://${{ env.BASE_DOMAIN }} BASE_URL=${{ env.BASE_PATH }} pnpm build
# Disable crawlers for preview builds.
echo "User-Agent: *\nDisallow: /" > build/robots.txt
- name: yarn install
run: yarn install
- name: Install Wrangler
if: github.event.pull_request.head.repo.fork == false
run: npm install -g wrangler

- name: yarn build
run: yarn build
- name: Deploy to Cloudflare Pages
if: github.event.pull_request.head.repo.fork == false
run: npx wrangler pages deploy ./build --project-name="${{ env.PAGES_PROJECT }}" --branch ${{ env.BRANCH_NAME }}
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_WORKERS_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_WORKERS_ACCOUNT_ID }}

- name: deploy
if: github.ref == 'refs/heads/master'
uses: JamesIves/github-[email protected]
- name: Add comment to Pull Request
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false
uses: actions/github-script@v6
with:
branch: gh-pages
folder: build
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Preview was deployed to: https://${{ env.BRANCH_NAME }}.${{ env.BASE_DOMAIN }}${{ env.BASE_PATH }}`
})
23 changes: 13 additions & 10 deletions .github/workflows/crowdin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,26 @@ on:
jobs:
build:
runs-on: ubuntu-latest
container:
image: node:20
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v1
- uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
node-version: 18.x
version: 9

- name: yarn install
run: yarn install
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: sync translations
- name: Sync translations
env:
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
run: yarn run crowdin:sync
run: pnpm run crowdin:sync

- name: create pull request
uses: peter-evans/create-pull-request@v4
- name: Create pull request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.BOT_GITHUB_TOKEN }}
commit-message: automatically update translations
Expand Down
25 changes: 16 additions & 9 deletions .github/workflows/markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
name: Lint Markdown

on:
push
push:
branches:
- "*"
pull_request:
types: [opened, reopened, synchronize]

jobs:
build:
runs-on: ubuntu-latest
container:
image: node:20
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
- uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
node-version: 18.x
version: 9

- name: yarn install
run: yarn install
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: yarn lint:md
run: yarn lint:md
- name: pnpm lint:md
run: pnpm lint:md
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.

`main` branch is published automatically to [https://adguardteam.github.io/KnowledgeBaseDNS/](https://adguardteam.github.io/KnowledgeBaseDNS/).
`master` branch is published automatically to https://kb-dns.pages.dev/.

## How to contribute

Expand All @@ -15,7 +15,7 @@ You can help by contributing to the Knowledge Base, all details are in [this art
First of all, you need to install the following:

- [git](https://github.com/git-guides/install-git)
- [yarn](https://classic.yarnpkg.com/lang/en/docs/install/)
- [pnpm](https://pnpm.io/installation)

Second, clone this repo to your local computer:

Expand All @@ -25,31 +25,31 @@ Alternatively, you can use the [Github app](https://desktop.github.com/) to do t

Then you should open Terminal on your computer and navigate to the directory where you cloned this repo and run this command to install the local dependencies:

- `yarn install`
- `pnpm install`

### Lint markdown

This command lints the markdown and outputs any errors to the console:

- `yarn lint:md`
- `pnpm lint:md`

Some of errors can be fixed automatically:

- `yarn lint:md --fix`
- `pnpm lint:md --fix`

VSCode users can install the [markdownlint extension][vscode-markdownlint] to see the errors in the editor.

### Run it locally

- `yarn start`
- `pnpm start`

This command [lints markdown syntax](#lint-markdown),
and if there is no markdownlint errors starts a local development server and opens up a browser window.
Most changes are reflected live without having to restart the server.

## How to build

- `yarn build`
- `pnpm build`

This command generates static content into the `build` directory and can be served using any static contents hosting service.

Expand All @@ -59,8 +59,8 @@ Translations are not pushed to the repo and prepared on-the-fly (`i18n` folder i

Here's how you can debug translations locally.

1. Download translations: `CROWDIN_PERSONAL_TOKEN="YOURTOKEN" yarn run crowdin download`
2. Run Docusaurus with the language of your choice: `yarn run start -- --locale de`
1. Download translations: `CROWDIN_PERSONAL_TOKEN="YOURTOKEN" pnpm run crowdin download`
2. Run Docusaurus with the language of your choice: `pnpm run start -- --locale de`

## How to generate DNS stamps

Expand Down
2 changes: 2 additions & 0 deletions crowdin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ files:
- source: /i18n/en/**/*
translation: /i18n/%two_letters_code%/**/%original_file_name%
languages_mapping: *languages_mapping
update_option: 'update_as_unapproved'
- source: /docs/**/*
translation: /i18n/%two_letters_code%/docusaurus-plugin-content-docs/current/**/%original_file_name%
languages_mapping: *languages_mapping
update_option: 'update_as_unapproved'
ignore:
- "/**/_category_.json"
2 changes: 2 additions & 0 deletions docs/general/dns-filtering-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ The `dnsrewrite` response modifier allows replacing the content of the response

**Rules with the `dnsrewrite` response modifier have higher priority than other rules in AdGuard Home.**

Responses to all requests for a host matching a `dnsrewrite` rule will be replaced. The answer section of the replacement response will only contain RRs that match the request's query type and, possibly, CNAME RRs. Note that this means that responses to some requests may become empty (`NODATA`) if the host matches a `dnsrewrite` rule.

The shorthand syntax is:

```none
Expand Down
Loading

0 comments on commit b44b6d7

Please sign in to comment.