Compare commits

...

151 Commits

Author SHA1 Message Date
Eugene Burkov
6fe227646b Pull request: 2574 external tests vol.2
Merge in DNS/adguard-home from 2574-external-tests-2 to master

Updates #2574.

Squashed commit of the following:

commit 8a514facc33cb727ef842fc3048f72cc12efbbf1
Merge: 41c7374f 28b9abf1
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Feb 2 14:43:55 2021 +0300

    Merge branch 'master' into 2574-external-tests-2

commit 41c7374f88a292961c0217a6702e65c693691bf5
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Feb 2 14:42:33 2021 +0300

    dnsfilter: imp error messages

commit 1402a987ccec3f84d2e863d9dea6e47ac1c0249f
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Feb 2 14:07:11 2021 +0300

    dnsfilter: imp tests
2021-02-02 15:13:12 +03:00
Ainar Garipov
28b9abf1dd Pull request: dnsforward: don't redirect doh queries
Merge in DNS/adguard-home from 2628-no-redirect to master

Updates #2628.

Squashed commit of the following:

commit 686f3254bed1c84fe79aa203c1da4db243f301e3
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Feb 2 13:51:16 2021 +0300

    dnsforward: don't redirect doh queries
2021-02-02 14:15:13 +03:00
Ainar Garipov
f5c47b6193 Pull request: dnsforward: fix infinite loop
Merge in DNS/adguard-home from 2619-infinite-loop to master

Updates #2619.

Squashed commit of the following:

commit 425fde3f476349571036b9b95c9d0a33703270ee
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Feb 2 13:08:52 2021 +0300

    dnsforward: fix infinite loop
2021-02-02 13:35:23 +03:00
Ainar Garipov
39f6689b39 Pull request: dnsforward: add a crutch against einval for ipset
Merge in DNS/adguard-home from fix-ipset to master

Squashed commit of the following:

commit 18538b0276a0896ad7d99bd0edd1604af80e790f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Feb 1 20:30:13 2021 +0300

    dnsforward: add a crutch against einval for ipset
2021-02-01 20:44:15 +03:00
Ainar Garipov
8fdd021ed7 Pull request: dnsforward: fix closing of uninitialized ipset ctx
Merge in DNS/adguard-home from fix-close to master

Squashed commit of the following:

commit 43b55105cc669e2740ef178808c81a22c8f53cc1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Feb 1 19:19:12 2021 +0300

    dnsforward: fix closing of uninitialized ipset ctx
2021-02-01 19:33:45 +03:00
Ainar Garipov
3e0238aa99 Pull request: dnsforward: imp ipset caching, logging, and eperm handling
Merge in DNS/adguard-home from ipset-fix to master

Updates #2619.

Squashed commit of the following:

commit 6939c823598b1e74cb3d991aad1b928547fd26a9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Feb 1 16:55:14 2021 +0300

    dnsforward: imp code

commit 99e3a7c30b79d7929ddd9b700d7dd3d2683ec6d2
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Feb 1 15:52:12 2021 +0300

    dnsforward: imp ipset caching, logging, and eperm handling
2021-02-01 17:06:09 +03:00
Ainar Garipov
adb76aa9b8 Pull request: openapi: fix naming in filter object
Merge in DNS/adguard-home from fix-openapi-filter to master

Squashed commit of the following:

commit 12c431b656804a27d00c9e016d290a1e90bf48ef
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Feb 1 15:43:33 2021 +0300

    openapi: fix naming in filter object
2021-02-01 16:01:33 +03:00
Ainar Garipov
6f155f78b6 Pull request: scripts: make sure wd is set when inistalling
Merge in DNS/adguard-home from 2614-install-wd to master

Updates #2614.

Squashed commit of the following:

commit 8e59fa29138654326a66dbf5d165fa49a5aec46e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Feb 1 13:24:22 2021 +0300

    scripts: fix removing

commit d199998e4bc0c2d8f1facac5fed30011cae1166e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Feb 1 13:15:51 2021 +0300

    scripts: make sure wd is set when inistalling
2021-02-01 14:12:57 +03:00
Ildar Kamalov
a83c3cf2ea Merge: - client: fix server name validation
Closes #2617

Squashed commit of the following:

commit be7fa5a37ab86dd0855dbb456415642d70817cbb
Author: Ildar Kamalov <ik@adguard.com>
Date:   Mon Feb 1 11:19:08 2021 +0300

    - client: fix server name validation
2021-02-01 12:53:19 +03:00
Andrey Meshkov
3f050a750d Added check for Mac M1 2021-02-01 00:49:04 +03:00
Andrey Meshkov
a32f8118b1 Added arm64 support to the install script 2021-02-01 00:33:17 +03:00
Andrey Meshkov
7042811ee6 Install AGH to /Applications on MacOS 2021-02-01 00:14:47 +03:00
Andrey Meshkov
cd88137333 Don't fail init when ipset is not initialized 2021-01-31 00:07:09 +03:00
Ainar Garipov
4aa6f77a61 Pull request: all: imp tests, docs
Merge in DNS/adguard-home from imp-tests to master

Squashed commit of the following:

commit 15e1bd4ac38e95aa7dce716679d9a6bea43c5964
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Jan 29 19:41:03 2021 +0300

    scripts: imp docs

commit bc54ce4e703dd4b2956636e0bd554073c9aa12c6
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Jan 29 19:39:26 2021 +0300

    all: imp tests, docs
2021-01-29 20:00:11 +03:00
Ainar Garipov
510573a904 Pull request: 2179 ipset subdomains
Merge in DNS/adguard-home from 2179-ipset-subdomains to master

Closes #2179.

Squashed commit of the following:

commit de17caac4c2ea2bc7931f162c6dfa7822a71554f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Jan 29 18:34:46 2021 +0300

    dnsforward: imp code, docs

commit e5ab957560bcfba80feac4b72f9b22535ecd4c7d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Jan 26 20:43:31 2021 +0300

    dnsforward: imp code

commit 2b84d27b752832885e4896d0e75de2576e2b965b
Author: David Sheets <sheets@alum.mit.edu>
Date:   Tue Oct 6 16:34:06 2020 +0100

    dnsforward: support subdomain matching in ipset

    This is a squash of all commits in #2179.
2021-01-29 18:53:39 +03:00
Eugene Burkov
0d0a419bd3 Pull request: 2574 external tests vol.1
Merge in DNS/adguard-home from 2574-external-tests to master

Updates #2574.

Squashed commit of the following:

commit cb7017aa7fc1c81c014c1fa7e0972b06748aff29
Merge: 2a073431 eeeb0383
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Jan 29 15:43:41 2021 +0300

    Merge branch 'master' into 2574-external-tests

commit 2a0734311c5a6ddd2d9c3f56a4494a20b4197955
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Jan 29 15:16:40 2021 +0300

    dnsfilter: imp docs

commit 49aff871282e2739d27fcbceefdf1bd005c21174
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Jan 29 14:10:56 2021 +0300

    dnsfilter: imp docs

commit 11be89a5378c0e451f1b88dc48a2e8827ba38358
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Jan 28 21:20:55 2021 +0300

    dnsfilter: fix go version trouble

commit 1ba4afd95bd739c18818ab0bea0ae70d59b880dc
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Jan 28 17:42:29 2021 +0300

    dnsfilter: imp tests
2021-01-29 16:09:31 +03:00
Ainar Garipov
eeeb03839a Pull request: all: fix client id handling in querylog
Merge in DNS/adguard-home from 2607-querylog-client-id to master

Closes #2607.

Squashed commit of the following:

commit 95367a82469af3b042489fb650b962b48cb73236
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Jan 28 19:02:02 2021 +0300

    all: fix client, imp docs

commit b652a7ef2373a75f7e897d29f5c9e36b0e076f8e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Jan 28 18:36:17 2021 +0300

    all: fix client id handling in querylog
2021-01-28 19:39:33 +03:00
Ainar Garipov
3af079a81b Pull request: querylog: make answer actually a string
Merge in DNS/adguard-home from 2609-dns-answer-string to master

Updates #2609.

Squashed commit of the following:

commit 1922f90c50f47735d8025d862fbf60bcf707140f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Jan 28 15:19:11 2021 +0300

    querylog: stricter typing

commit 6ef73a45d822f77cfda44d8c093f272704d5afb6
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Jan 28 15:04:06 2021 +0300

    querylog: make answer actually a string
2021-01-28 16:00:29 +03:00
Ainar Garipov
154c9c1c26 Pull request: scripts: imp client linting
Merge in DNS/adguard-home from imp-hook to master

Squashed commit of the following:

commit f09a3ea2c0299b3ecb39b62d83b65919e425e591
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Jan 28 13:49:03 2021 +0300

    scripts: imp client linting
2021-01-28 14:02:38 +03:00
Ainar Garipov
a76fb2cd52 Pull request: scrips: make go-lint show output even when command fails
Merge in DNS/adguard-home from imp-go-lint to master

Squashed commit of the following:

commit 4ac92d95071b747e01e30713030e72396f1c353f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Jan 27 20:35:35 2021 +0300

    scrips: make go-lint show output even when command fails
2021-01-27 20:45:00 +03:00
Ainar Garipov
fc9ddcf941 Pull request: all: client id support
Merge in DNS/adguard-home from 1383-client-id to master

Updates #1383.

Squashed commit of the following:

commit ebe2678bfa9bf651a2cb1e64499b38edcf19a7ad
Author: Ildar Kamalov <ik@adguard.com>
Date:   Wed Jan 27 17:51:59 2021 +0300

    - client: check if IP is valid

commit 0c330585a170ea149ee75e43dfa65211e057299c
Author: Ildar Kamalov <ik@adguard.com>
Date:   Wed Jan 27 17:07:50 2021 +0300

    - client: find clients by client_id

commit 71c9593ee35d996846f061e114b7867c3aa3c978
Merge: 9104f161 3e9edd9e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Jan 27 16:09:45 2021 +0300

    Merge branch 'master' into 1383-client-id

commit 9104f1615d2d462606c52017df25a422df872cea
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Jan 27 13:28:50 2021 +0300

    dnsforward: imp tests

commit ed47f26e611ade625a2cc2c2f71a291b796bbf8f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Jan 27 12:39:52 2021 +0300

    dnsforward: fix address

commit 98b222ba69a5d265f620c180c960d01c84a1fb3b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Jan 26 19:50:31 2021 +0300

    home: imp code

commit 4f3966548a2d8437d0b68207dd108dd1a6cb7d20
Merge: 199fdc05 c215b820
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Jan 26 19:45:13 2021 +0300

    Merge branch 'master' into 1383-client-id

commit 199fdc056f8a8be5500584f3aaee32865188aedc
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Jan 26 19:20:37 2021 +0300

    all: imp tests, logging, etc

commit 35ff14f4d534251aecb2ea60baba225f3eed8a3e
Author: Ildar Kamalov <ik@adguard.com>
Date:   Tue Jan 26 18:55:19 2021 +0300

    + client: remove block button from clients with client_id

commit 32991a0b4c56583a02fb5e00bba95d96000bce20
Author: Ildar Kamalov <ik@adguard.com>
Date:   Tue Jan 26 18:54:25 2021 +0300

    + client: add requests count for client_id

commit 2d68df4d2eac4a296d7469923e601dad4575c1a1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Jan 26 15:49:50 2021 +0300

    stats: handle client ids

commit 4e14ab3590328f93a8cd6e9cbe1665baf74f220b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Jan 26 13:45:25 2021 +0300

    openapi: fix example

commit ca9cf3f744fe197cace2c28ddc5bc68f71dad1f3
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Jan 26 13:37:10 2021 +0300

    openapi: improve clients find api docs

commit f79876e550c424558b704bc316a4cd04f25db011
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Jan 26 13:18:52 2021 +0300

    home: accept ids in clients find

commit 5b72595122aa0bd64debadfd753ed8a0e0840629
Merge: 607e241f abf8f65f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Jan 25 18:34:56 2021 +0300

    Merge branch 'master' into 1383-client-id

commit 607e241f1c339dd6397218f70b8301e3de6a1ee0
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Jan 25 18:30:39 2021 +0300

    dnsforward: fix quic

commit f046352fef93e46234c2bbe8ae316d21034260e5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Jan 25 16:53:09 2021 +0300

    all: remove wildcard requirement

commit 3b679489bae82c54177372be453fe184d8f0bab6
Author: Andrey Meshkov <am@adguard.com>
Date:   Mon Jan 25 16:02:28 2021 +0300

    workDir now supports symlinks

commit 0647ab4f113de2223f6949df001f42ecab05c995
Author: Ildar Kamalov <ik@adguard.com>
Date:   Mon Jan 25 14:59:46 2021 +0300

    - client: remove wildcard from domain validation

commit b1aec04a4ecadc9d65648ed6d284188fecce01c3
Author: Ildar Kamalov <ik@adguard.com>
Date:   Mon Jan 25 14:55:39 2021 +0300

    + client: add form to download mobileconfig

... and 12 more commits
2021-01-27 18:32:13 +03:00
Andrey Meshkov
3e9edd9eac Pull request: Minor code improvement - added tests for safebrowsing and parental control services
Merge in DNS/adguard-home from sbpctests to master

Squashed commit of the following:

commit 56df4dac20fcdba319543e8b15d9420ec247b68d
Merge: 0dcec1d8 1c1a7683
Author: Andrey Meshkov <am@adguard.com>
Date:   Wed Jan 27 15:06:53 2021 +0300

    Merge branch 'master' into sbpctests

commit 0dcec1d85362142b51443ab2ae0de0b4fd2a9676
Author: Andrey Meshkov <am@adguard.com>
Date:   Wed Jan 27 14:13:18 2021 +0300

    applied suggestion

commit 166b659458a68e0c395028aa3dea580c5118544c
Merge: e15e5cf6 dde5d798
Author: Andrey Meshkov <am@adguard.com>
Date:   Wed Jan 27 14:02:47 2021 +0300

    merge

commit e15e5cf6a7a9cbf4ffdb24197fc7062e931bdf34
Author: Andrey Meshkov <am@adguard.com>
Date:   Wed Jan 27 14:00:27 2021 +0300

    Fix review comments

commit dde5d798faa0f20b41f9252acfd4a83f9b8b19e3
Author: Andrey Meshkov <am@adguard.com>
Date:   Wed Jan 27 13:10:03 2021 +0300

    fixed comment style

commit 3a77bc89cc0d1994d7a9de450b2796b6c27bd3dc
Author: Andrey Meshkov <am@adguard.com>
Date:   Wed Jan 27 12:57:11 2021 +0300

    Minor code improvement - added tests for safebrowsing and parental control services
2021-01-27 15:21:39 +03:00
Ainar Garipov
1c1a7683ef Pull request: all: imp github issue template
Merge in DNS/adguard-home from imp-issue-tmpl to master

Squashed commit of the following:

commit bc918f70367d2b1f0e9531068f0a60b4dc123807
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Jan 27 14:12:06 2021 +0300

    all: imp github issue template
2021-01-27 14:24:41 +03:00
Eugene Burkov
c215b82004 Pull request: 2552 rm context.TODO() instances
Merge in DNS/adguard-home from 2552-context to master

Closes #2552.

Squashed commit of the following:

commit 3d1cef33da529f4611869c4a0f2f294a3c8afcaf
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Jan 26 19:28:23 2021 +0300

    all: fix docs

commit d08c78cf4b96419b928e73c497768f40c9e47bc2
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Jan 26 19:22:00 2021 +0300

    all: doc changes

commit c2814f4d0025be74f38299e7e66e7c0193b6c15f
Merge: 100a1a09 44c7221a
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Jan 26 19:12:55 2021 +0300

    Merge branch 'master' into 2552-context

commit 100a1a0957bc22bfaccb1693e6b9b1c5cb53ed13
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Jan 26 19:10:03 2021 +0300

    home: imp docs, fix naming

commit 22717abe6c0e4c1016a53ff2fac1689d0762c462
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Jan 26 18:14:07 2021 +0300

    home: improve code quality

commit 5c96f77a2b315e2c1ad4a11cc7a64f61bdba52a3
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Jan 25 20:28:51 2021 +0300

    home: add docs

commit 323fc013a57a5c06ec391003133b12f4eb2721cd
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Jan 25 14:50:11 2021 +0300

    home: rm context.TODO() instances
2021-01-26 19:44:19 +03:00
Ainar Garipov
44c7221ae9 Pull request: all: rm ignored test, outdated tag
Merge in DNS/adguard-home from rm-outdated to master

Squashed commit of the following:

commit 38669542f98a8267b06197518078a8c06de670b7
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Jan 26 18:04:08 2021 +0300

    all: rm ignored test, outdated tag
2021-01-26 18:35:51 +03:00
Ainar Garipov
abf8f65f05 Pull request: Remove Docker VOLUME instruction for more flexibility
Merge in DNS/adguard-home from 2589-docker-volumes to master

Squashed commit of the following:

commit 5bff6ffa3138e9c09b786e4ff26fe286daa78c05
Merge: f0e9a74c e71019a1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Jan 25 14:45:15 2021 +0300

    Merge branch 'master' into 2589-docker-volumes

commit f0e9a74cc3d8baecaac68730b684e65ec3178886
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Jan 25 14:44:07 2021 +0300

    all: doc changes

commit 76e538ca5f
Author: Alex Povel <alex.povel@tuhh.de>
Date:   Thu Jan 21 15:07:11 2021 +0100

    Remove Docker VOLUME instruction for more flexibility

    Inheriting from the base image is made easier without
    the VOLUME instruction, since it cannot be reverted.
    All guides contain `--volume` explanations/usage
    examples anyway, so the VOLUME instructions in the
    Dockerfile aren't necessary.

    See also https://stackoverflow.com/a/62068396/11477374 for more
    examples for why that instruction can be harmful.
2021-01-25 18:07:49 +03:00
Ainar Garipov
e71019a1f3 Pull request: all: imp dev version handling
Merge in DNS/adguard-home from fix-version to master

Squashed commit of the following:

commit ecef63315fb49ae33b4c3f13c0e0be0668340e2b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Jan 22 18:59:17 2021 +0300

    updater: imp tests

commit f5243918567430e467c44a48e45169db4560b58b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Jan 22 18:48:10 2021 +0300

    all: imp dev version handling
2021-01-25 14:09:29 +03:00
Eugene Burkov
fb9acf4cbd Pull request: 2509 type-safety logs
Merge in DNS/adguard-home from 2509-type-safety-log to master

Updates #2509.

* commit '684017a75f918aa0dcd76792c34aecd35fa01b01':
  all: log changes
2021-01-22 18:29:58 +03:00
Eugene Burkov
684017a75f all: log changes 2021-01-22 17:58:46 +03:00
Ainar Garipov
5dffef53cd Pull request: scripts: add doq, dnscrypt, and beta client ports to docker
Merge in DNS/adguard-home from docker-ports to master

Squashed commit of the following:

commit 8f4f7cbd321d415634880fc1c23f50c488be907b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Jan 22 16:05:29 2021 +0300

    scripts: add more ports, imp docs

commit 758a95a20cfecdaa098589b95f2a938f8610c7d4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Jan 22 15:17:21 2021 +0300

    scripts: add doq, dnscrypt, and beta client ports to docker
2021-01-22 17:30:08 +03:00
Eugene Burkov
ecd9ef47b0 Pull request: 2509 type-safety vol.3
Merge in DNS/adguard-home from 2509-type-safety-vol2-1 to master

Squashed commit of the following:

commit d58efb32396328247e1bb044f2b01145530cd84c
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Jan 22 14:27:54 2021 +0300

    home: imp JSON encoding
2021-01-22 15:00:45 +03:00
Eugene Burkov
d9482b7588 Pull request: 2509 type-safety vol.2
Merge in DNS/adguard-home from 2509-type-safety-vol2 to master

Updates #2509.

Squashed commit of the following:

commit c944e4e0a9949fc894c90b4bc1f739148a67fd9d
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Jan 21 19:36:20 2021 +0300

    all: imp docs

commit e8ac1815c492b0a9434596e35a48755cac2b9f3b
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Jan 20 12:38:48 2021 +0300

    all: imp JSON encoding, decoding
2021-01-21 19:55:41 +03:00
Eugene Burkov
7fab31beae Pull request: 2508 ip conversion vol.2
Merge in DNS/adguard-home from 2508-ip-conversion-vol2 to master

Closes #2508.

Squashed commit of the following:

commit 5b9d33f9cd352756831f63e34c4aea48674628c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Jan 20 17:15:17 2021 +0300

    util: replace net.IPNet with pointer

commit 680126de7d59464077f9edf1bbaa925dd3fcee19
Merge: d3ba6a6c 5a50efad
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Jan 20 17:02:41 2021 +0300

    Merge branch 'master' into 2508-ip-conversion-vol2

commit d3ba6a6cdd01c0aa736418fdb86ed40120169fe9
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Jan 19 18:29:54 2021 +0300

    all: remove last conversion

commit 88b63f11a6c3f8705d7fa0c448c50dd646cc9214
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Jan 19 14:12:45 2021 +0300

    all: improve code quality

commit 71af60c70a0dbaf55e2221023d6d2e4993c9e9a7
Merge: 98af3784 9f75725d
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Jan 18 17:13:27 2021 +0300

    Merge branch 'master' into 2508-ip-conversion-vol2

commit 98af3784ce44d0993d171653c13d6e83bb8d1e6a
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Jan 18 16:32:53 2021 +0300

    all: log changes

commit e99595a172bae1e844019d344544be84ddd65e4e
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Jan 18 16:06:49 2021 +0300

    all: fix or remove remaining net.IP <-> string conversions

commit 7fd0634ce945f7e4c9b856684c5199f8a84a543e
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Jan 15 15:36:17 2021 +0300

    all: remove redundant net.IP <-> string converions

commit 5df8af030421237d41b67ed659f83526cc258199
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Jan 14 16:35:25 2021 +0300

    stats: remove redundant net.IP <-> string conversion

commit fbe4e3fc015e6898063543a90c04401d76dbb18f
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Jan 14 16:20:35 2021 +0300

    querylog: remove redundant net.IP <-> string conversion
2021-01-20 17:27:53 +03:00
Eugene Burkov
5a50efadb2 Pull request: 2509 type-safety vol.1
Merge in DNS/adguard-home from 2509-type-safety to master

Updates #2509.

Squashed commit of the following:

commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Jan 20 15:06:16 2021 +0300

    dhcpd: fix comments

commit dc79b80381fe7a8ecec6f9659fd23710c9229f59
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Jan 20 14:08:10 2021 +0300

    all: improve docs

commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Jan 19 17:08:15 2021 +0300

    all: improve JSON encoding and decoding
2021-01-20 15:59:24 +03:00
Ainar Garipov
715df4cd92 Pull request: all: don't close recurrent issues as stale
Merge in DNS/adguard-home from fix-stale to master

Updates #2275.

Squashed commit of the following:

commit 01cc5b85c2cb4905bb964d6b3e949e33f56d4763
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Jan 20 13:21:14 2021 +0300

    all: don't close recurrent issues as stale
2021-01-20 13:35:09 +03:00
Ildar Kamalov
9f75725dfa Merge: client: fix mobile layout for install page
Squashed commit of the following:

commit 5e620f2d8576b08ebfee08e9781cd4927c4dcf2a
Merge: d82d5a902 679bbcdc2
Author: Ildar Kamalov <ik@adguard.com>
Date:   Mon Jan 18 14:57:00 2021 +0300

    Merge branch 'master' into 2554-mobile-install

commit d82d5a9028be0be72e612fc4c375d2be81c6c8c3
Author: Ildar Kamalov <ik@adguard.com>
Date:   Mon Jan 18 14:09:25 2021 +0300

    client: fix mobile layout for install page
2021-01-18 15:09:04 +03:00
Ainar Garipov
679bbcdc26 Pull request: home: don't miss blocked clients in client search api
Merge in DNS/adguard-home from 2428-blocked-runtime-fix to master

Updates #2428.

Squashed commit of the following:

commit 8aaa3e22a894f0335ced93339655771989846c94
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Jan 15 16:32:53 2021 +0300

    home: don't miss blocked clients in client search api
2021-01-15 20:30:48 +03:00
Ainar Garipov
56cb8a4dde Pull request: dnsforward: add dnsrewrite tests
Merge in DNS/adguard-home from 2102-dnsrewrite-tests to master

Updates #2102.

Squashed commit of the following:

commit 894ff4baf8378d6e3386e09c416d55241a01f79e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Jan 14 14:49:28 2021 +0300

    dnsforward: add dnsrewrite tests
2021-01-14 15:30:39 +03:00
Ainar Garipov
f2c6e1c682 Pull request: openapi: fix more docs issues
Merge in DNS/adguard-home from fix-openapi to master

Squashed commit of the following:

commit bd95a502666372443b937cbcb690e307cd943342
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Jan 14 13:23:37 2021 +0300

    openapi: fix more docs issues
2021-01-14 13:48:52 +03:00
Ainar Garipov
4474e9fcf9 Pull request: all: imp http handlers, imp docs
Merge in DNS/adguard-home from fix-openapi to master

Squashed commit of the following:

commit 0e7530472fb566e5cab73d178c8ec16e5ef11dcb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Jan 13 17:02:06 2021 +0300

    all: imp http handlers, imp docs
2021-01-13 17:26:57 +03:00
Eugene Burkov
e8c1f5c8d3 Pull request: 2508 ip conversion vol.1
Merge in DNS/adguard-home from 2508-ip-conversion to master

Updates #2508.

Squashed commit of the following:

commit 3f64709fbc73ef74c11b910997be1e9bc337193c
Merge: 5ac7faaaa 0d67aa251
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Jan 13 16:21:34 2021 +0300

    Merge branch 'master' into 2508-ip-conversion

commit 5ac7faaaa9dda570fdb872acad5d13d078f46b64
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Jan 13 12:00:11 2021 +0300

    all: replace conditions with appropriate functions in tests

commit 9e3fa9a115ed23024c57dd5192d5173477ddbf71
Merge: db992a42a bba74859e
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Jan 13 10:47:10 2021 +0300

    Merge branch 'master' into 2508-ip-conversion

commit db992a42a2c6f315421e78a6a0492e2bfb3ce89d
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Jan 12 18:55:53 2021 +0300

    sysutil: fix linux tests

commit f629b15d62349323ce2da05e68dc9cc0b5f6e194
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Jan 12 18:41:20 2021 +0300

    all: improve code quality

commit 3bf03a75524040738562298bd1de6db536af130f
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Jan 12 17:33:26 2021 +0300

    sysutil: fix linux net.IP conversion

commit 5d5b6994916923636e635588631b63b7e7b74e5f
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Jan 12 14:57:26 2021 +0300

    dnsforward: remove redundant net.IP <-> string conversion

commit 0b955d99b7fad40942f21d1dd8734adb99126195
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Jan 11 18:04:25 2021 +0300

    dhcpd: remove net.IP <-> string conversion
2021-01-13 16:56:05 +03:00
Ainar Garipov
0d67aa251d Pull request: 2546 updater fix
Merge in DNS/adguard-home from 2546-updater-fix to master

Closes #2546.

Squashed commit of the following:

commit af243c9fad710efe099506fda281e628c3e5ec30
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Jan 13 14:33:37 2021 +0300

    updater: fix go 1.14 compat

commit 742fba24b300ce51c04acb586996c3c75e56ea20
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Jan 13 13:58:27 2021 +0300

    util: imp error check

commit c2bdbce8af657a7f4b7e05c018cfacba86e06753
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Jan 11 18:51:26 2021 +0300

    all: fix and refactor update checking
2021-01-13 16:18:51 +03:00
Ainar Garipov
bba74859e2 Pull request: openapi: fix incorrect parameter name
Merge in DNS/adguard-home from fix-openapi to master

Squashed commit of the following:

commit a448b80a57851d44634c00f0fd986f58b35dae80
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Jan 12 17:27:32 2021 +0300

    openapi: fix incorrect parameter name
2021-01-12 17:45:19 +03:00
Ainar Garipov
18097edee1 Pull request: scripts: ignore unchecked errors in generated code
Merge in DNS/adguard-home from fix-errcheck to master

Squashed commit of the following:

commit 1cc4e12c1d49612046ce6f0a1b56920ffcad2526
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Jan 11 15:28:42 2021 +0300

    scripts: ignore unchecked errors in generated code
2021-01-11 15:59:42 +03:00
Eugene Burkov
18be0ad80b Pull request: beta client on development channel
Merge in DNS/adguard-home from beta-client-channels to master

Squashed commit of the following:

commit c65611c1743aedd14779c95ed587330aff611b1d
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Jan 11 14:09:21 2021 +0300

    home: activate beta client on development channel by default
2021-01-11 15:06:54 +03:00
Eugene Burkov
89915e35bd Pull request: fix beta client bug
Merge in DNS/adguard-home from beta-client-bug to master

Squashed commit of the following:

commit 641f8b5eb3827e1fd9b15e60773e365206dc1f49
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Jan 11 11:54:17 2021 +0300

    home: fix beta client bug
2021-01-11 13:17:22 +03:00
Andrey Meshkov
ce55625d70 Fix #2519 2021-01-06 12:41:53 +03:00
Andrey Meshkov
d1434408e5 Merge branch 'Wuodan-patch-1' 2021-01-06 12:02:29 +03:00
Stefan Kuhn
76d9560292 Fix typo in README.md 2021-01-05 18:49:28 +01:00
Ainar Garipov
2298a9ed09 Pull request: scripts: zip output dir recursively
Merge in DNS/adguard-home from 2276-fix-zip to master

Updates #2276.
Updates #2507.

Squashed commit of the following:

commit 9bd2c53d0aea98fd735655315c33336546f86ccb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Dec 31 17:12:53 2020 +0300

    scripts: zip output dir recursively
2020-12-31 17:37:19 +03:00
Ainar Garipov
933ca2af2a Pull request: scripts: don't use features not guaranteed by posix
Merge in DNS/adguard-home from 2276-fix-portability to master

Updates #2276.

Squashed commit of the following:

commit 3019099f2498923495575873daf372598aa72478
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Dec 31 14:31:02 2020 +0300

    scripts: don't use features not guaranteed by posix
2020-12-31 15:12:46 +03:00
Ainar Garipov
cfd492cf7c Pull request: scripts: fix build-release
Merge in DNS/adguard-home from 2276-fix-release-3 to master

Updates #2276.
Updates #2507.

Squashed commit of the following:

commit 1f756975922b403e06dca3e9d44d9ed2edccb97c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Dec 31 13:45:25 2020 +0300

    scripts: fix build-release
2020-12-31 13:55:39 +03:00
Ainar Garipov
3706f559c1 Pull request: scripts: fix Dockerfile, build-release.sh
Merge in DNS/adguard-home from 2276-fix-release-2 to master

Updates #2276.

Squashed commit of the following:

commit cc7edffca6862579a745600b4008428d4c9a73d9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Dec 30 22:56:01 2020 +0300

    scripts: fix Dockerfile, build-release.sh
2020-12-30 23:18:15 +03:00
Ainar Garipov
e20e94ddd4 Pull request: all: fix gpg_key, release
Merge in DNS/adguard-home from 2276-fix-release to master

Updates #2276.

Squashed commit of the following:

commit d7b4af6aa867159c5ced8b421a20606f5ee11fd6
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Dec 30 20:26:33 2020 +0300

    all: remove comment

commit cd779699159c4efee4b64184b331add94a7ba57e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Dec 30 20:25:24 2020 +0300

    all: fix gpg_key, release
2020-12-30 20:36:57 +03:00
Ainar Garipov
0e84962fde Pull request: all: add a new Makefile and scripts, remove goreleaaser
Merge in DNS/adguard-home from 2276-releases to master

Updates #2276.

Squashed commit of the following:

commit 84961947c51477aae53606ec6e2e0cce0bdfc139
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Dec 30 14:36:13 2020 +0300

    all: fix github build

commit 54af2adbf2f433e80393fb142e66ba6b3a78b13e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Dec 30 14:34:02 2020 +0300

    all: remove old Dockerfile, improve build scripts

commit 99bb2f2ba1458d32074ac0911b5c02ce6669e43e
Merge: 2292b677a 5e20ac7ed
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Dec 30 13:47:19 2020 +0300

    Merge branch 'master' into WIP-2276-releases

commit 2292b677a20ce8e93d9e6e2bb042cd468606fec3
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Dec 30 13:30:10 2020 +0300

    all: improve docker build

commit 0bcc97c41f105ee4a4363f20fa4775c7643bf0cc
Merge: c7d3f12ef aef4659e9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Dec 29 17:47:45 2020 +0300

    Merge branch 'master' into WIP-2276-releases

commit c7d3f12ef2b63ddfa2acf46e3129fcbc56fb0a90
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Dec 29 16:28:25 2020 +0300

    all: improve build scripts

commit 55de1e5d7ef0fbdbd1a76cfb71362d16ca0a1966
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Dec 29 15:36:47 2020 +0300

    all: fix Makefile

commit d11b1fe28d0fde1efeaf6160a614951b19d0ef94
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Dec 29 14:16:19 2020 +0300

    scripts: fix build-release

commit ecc0577e2451afa86c37da7283a63a9d26fb37ba
Merge: dde64ed8e 483f02c92
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Dec 29 13:59:32 2020 +0300

    Merge branch 'master' into WIP-2276-releases

commit dde64ed8e456f73559f21c2ca549dc3b46724add
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Dec 25 18:04:46 2020 +0300

    all: imp docs, other improvements

commit be8574408db79901bb15c1d31916db3ca352a35f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Dec 25 14:48:30 2020 +0300

    all: imp docker build

commit fc1876f34b93d667bf166226f4bc666d394f10c7
Merge: fa5a304c8 955b735c8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Dec 25 13:54:29 2020 +0300

    Merge branch 'master' into WIP-2276-releases

commit fa5a304c83d86145796a2de4141de6d18f7c56bf
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Dec 24 19:10:51 2020 +0300

    all: improve scripts

commit 3f32e3fd5e658d058d5c5172519384efc6cfef83
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Dec 24 18:50:01 2020 +0300

    all: improve scripts

commit 2d38b81421acab4b90a7a19da7598c75063e8e93
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Dec 24 18:25:21 2020 +0300

    all: fix shell for windows, improve go-lint.sh

commit d695285cd6dc476c0d972cfe0c49bbeea5f5a049
Merge: 313b020e9 9fb6bf82c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Dec 24 18:14:38 2020 +0300

    Merge branch 'master' into WIP-2276-releases

commit 313b020e9dfcdab736670cee72b2171eac8c32b7
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Dec 24 18:13:31 2020 +0300

    Makefile: use npm ci again

commit 5acee9d6a6c8cd2a7dd04b173a73929650882bad
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Dec 24 17:57:54 2020 +0300

    all: try fixing windows build

commit c63a2a54641ac8cd032a3306bb35e49b9ae74728
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Dec 24 17:39:30 2020 +0300

    all: imp scripts, try another goproxy and direct

commit 423229e8b63ee73caeee8e84c23f67d145aff9df
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Dec 24 17:25:29 2020 +0300

    all: imp HACKING.md, try a new proxy

... and 1 more commit
2020-12-30 18:26:25 +03:00
Eugene Burkov
5e20ac7ed5 Pull request: beta client squashed
Merge in DNS/adguard-home from beta-client-2 to master

Squashed commit of the following:

commit b2640cc49a6c5484d730b534dcf5a8013d7fa478
Merge: 659def862 aef4659e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Dec 29 19:23:09 2020 +0300

    Merge branch 'master' into beta-client-2

commit 659def8626467949c35b7a6a0c99ffafb07b4385
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Dec 29 17:25:14 2020 +0300

    all: upgrade github actions node version

commit b4b8cf8dd75672e9155da5d111ac66e8f5ba1535
Author: Vladislav Abdulmyanov <v.abdulmyanov@adguard.com>
Date:   Tue Dec 29 16:57:14 2020 +0300

    all: beta client squashed
2020-12-29 19:53:56 +03:00
Artem Baskal
aef4659e93 2487 Fix the remaining stylint issues
* commit 'fa96d49dcb690131d4a559ab16b27453c147a4c9':
  Fix the remaining stylint issues
2020-12-29 17:07:45 +03:00
Artem Baskal
455efd60f4 2469 allow zoom
* commit '18b5f6e5e468548b9006f163b3ebf0ba237688a0':
  Allow scroll
  Allow users to zoom
2020-12-29 17:07:26 +03:00
jvoisin
fa96d49dcb Fix the remaining stylint issues 2020-12-29 12:22:02 +03:00
Eugene Burkov
483f02c92a Pull request: doc the Question[0] inspection
Merge in DNS/adguard-home from 2465-question-0 to master

Closes #2465.

Squashed commit of the following:

commit 0dbcaf7eea4f582cedc31f37d1b20162fe1c38df
Merge: 0d7c22cd0 8a1d86aa7
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Dec 28 19:09:25 2020 +0300

    Merge branch 'master' into 2465-question-0

commit 0d7c22cd0eb930bd301a4bb7b8f23e9fd78a2ccd
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Dec 23 14:17:13 2020 +0300

    dnsforward: doc the Question[0] inspection
2020-12-28 19:26:37 +03:00
Eugene Burkov
8a1d86aa7d Pull request: data race
Merge in DNS/adguard-home from 2489-data-race to master

Closes #2489.

Squashed commit of the following:

commit 7745b79f0489970f3ba1bb11bb757b998fa6369c
Merge: d070cfd53 93ffed780
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Dec 28 19:00:07 2020 +0300

    Merge branch 'master' into 2489-data-race

commit d070cfd53e72b609f305cd8d79d747fbf47dc5f4
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Dec 25 20:31:21 2020 +0300

    util: fix ignoring write events bug

commit 725850bdbd96eaf65fb3228fcaeba51a3ec95905
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Dec 25 17:38:29 2020 +0300

    util: simpl hosts upd algo
2020-12-28 19:07:29 +03:00
Ainar Garipov
93ffed7809 Pull request: dnsfilter: improve cname rewrite validation
Merge in DNS/adguard-home from 2492-dnsrw-host to master

Closes #2492.

Squashed commit of the following:

commit 7128ed15de86c926ea4cff9fd8d3d3821657254f
Merge: e678c64e6 338209f32
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 28 18:42:25 2020 +0300

    Merge branch 'master' into 2492-dnsrw-host

commit e678c64e656ccf69c6818e9165ff1451f7c8fde6
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 28 18:04:52 2020 +0300

    dnsfilter: improve cname rewrite validation
2020-12-28 18:49:36 +03:00
Ainar Garipov
338209f32b Pull request: all: improve dnsrewrite handling
Merge in DNS/adguard-home from 2491-dnsrewrite-log to master

Closes #2491.

Squashed commit of the following:

commit bfe3cb599ed0a921285fb1a6ea27aaefdcc0d093
Merge: 95c5ffe43 15d8f979b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 28 18:33:32 2020 +0300

    Merge branch 'master' into 2491-dnsrewrite-log

commit 95c5ffe4360b732556455f24b844dad27047e64b
Author: Artem Baskal <a.baskal@adguard.com>
Date:   Mon Dec 28 18:11:01 2020 +0300

    Add RewriteRule for client

commit b9096c8789009dac1838b542d3409fef54b59aa5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 28 17:22:44 2020 +0300

    all: imp naming, docs

commit 4e00de0d613e4740451e4c8eb5a1de35a70a5896
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 28 17:16:35 2020 +0300

    all: imp naming, add todo

commit 67e4045f627a9569f382309705963640dcf3454a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 28 16:53:00 2020 +0300

    all: improve dnsrewrite handling
2020-12-28 18:41:50 +03:00
Artem Baskal
15d8f979b1 client: 2451 Remove empty rules label
Close #2451

* commit '67ad07d69ad3d8805c3d42f836b0759bc0b95a4e':
  client: 2451 Remove empty rules label
2020-12-28 16:53:36 +03:00
Artem Baskal
67ad07d69a client: 2451 Remove empty rules label 2020-12-28 16:39:15 +03:00
Andrey Meshkov
ace7c1c892 fixed comparison 2020-12-28 12:28:47 +03:00
Andrey Meshkov
e5780fa308 Merge branch 'master' of ssh://bit.adguard.com:7999/dns/adguard-home 2020-12-28 12:25:27 +03:00
Artem Baskal
644a9b5565 client: 2451 Support multiple matched rules in the UI
Close #2451

Squashed commit of the following:

commit f6d0a8fe4fa575dff67b2d2f4c9f6aaf6a6414d3
Merge: 3b13e529d 955b735c8
Author: Artem Baskal <a.baskal@adguard.com>
Date:   Fri Dec 25 14:53:16 2020 +0300

    Merge branch 'master' into feature/2451

commit 3b13e529da01823cbc674d81be065b68cd08bbd3
Author: Artem Baskal <a.baskal@adguard.com>
Date:   Thu Dec 24 12:53:13 2020 +0300

    Update JSXElement in jsdocs

commit f0749cd0466ef69d964b1c2575dffacb33f71b31
Author: Artem Baskal <a.baskal@adguard.com>
Date:   Mon Dec 21 13:23:48 2020 +0300

    minor

commit bd014b00e762a1895c132bc962c06f107c50fe17
Author: Artem Baskal <a.baskal@adguard.com>
Date:   Mon Dec 21 12:49:29 2020 +0300

    Minor helper update

commit 260a66b7b78eb80596b88fec14f409838727e4bb
Author: Artem Baskal <a.baskal@adguard.com>
Date:   Mon Dec 21 12:31:08 2020 +0300

    Rule locale update

commit c960cf9f658e52cb587676dceb97506880a9db94
Author: Artem Baskal <a.baskal@adguard.com>
Date:   Mon Dec 21 12:27:50 2020 +0300

    Add styles for filters list

commit 6f3b2176fd52598cddb147ad7828adb95abf08f0
Author: Artem Baskal <a.baskal@adguard.com>
Date:   Fri Dec 18 18:34:17 2020 +0300

    client: 2451 Support multiple matched rules in the UI
2020-12-25 15:03:37 +03:00
Ainar Garipov
955b735c8b Pull request: all: add depracation section to CHANGELOG.md, imp HACKING.md
Merge in DNS/adguard-home from doc-deprecated to master

Squashed commit of the following:

commit c189404164af25786eea83fcee635c497f0cfe00
Merge: 108097cda 1191a9acb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Dec 25 13:40:11 2020 +0300

    Merge branch 'master' into doc-deprecated

commit 108097cda62866ea78a55b9ddbbba1fdc68cef09
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Dec 25 13:05:03 2020 +0300

    all: imp markup and wording

commit 05a630da77b9b8491ba07cd647d9379c63b9c64e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Dec 24 20:57:43 2020 +0300

    all: add depracation section to CHANGELOG.md, imp HACKING.md
2020-12-25 13:50:52 +03:00
Ainar Garipov
1191a9acb7 Pull request: 2473 update backoff
Merge in DNS/adguard-home from 2473-update-backoff to master

Updates #2473.

* commit 'cbdf80727f3cfb7f7908393c194cf8d5f0fb90c5':
  home: imp naming
  home: improve error handling
  Use a simple backoff for retrying the update
2020-12-25 13:38:26 +03:00
Ainar Garipov
cbdf80727f Merge branch 'master' into 2473-update-backoff 2020-12-25 12:57:44 +03:00
Ainar Garipov
0801c89234 Pull request: 2472 readme pihole
Merge in DNS/adguard-home from 2472-readme-pihole to master

Updates #2472.

Squashed commit of the following:

commit 0a609eff90c6e5097d79562560aff52c6f752669
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Dec 24 21:07:18 2020 +0300

    all: imp table in README.md

commit c544a43b74e81c4404a20f2ff69cb5b8a0787226
Author: jvoisin <julien.voisin@dustri.org>
Date:   Tue Dec 22 11:44:21 2020 +0100

    Update the comparison with the Pi-Hole

    - AGH is written in Go, which is memory-safe, instead of using dnsmasq which
      has a terrible security record.
    - AGH is able to run without root privileges, while the Pi-Hole isn't.
2020-12-25 12:56:03 +03:00
Ainar Garipov
4bc1337cc9 home: imp naming 2020-12-25 12:54:22 +03:00
Ainar Garipov
664ef85c6c home: improve error handling 2020-12-24 21:45:15 +03:00
jvoisin
39268c754a Use a simple backoff for retrying the update
- Not sleeping might be too fast for the DNS server to restart
- Fix the link to the issue
2020-12-24 21:45:15 +03:00
Artem Baskal
18b5f6e5e4 Allow scroll 2020-12-24 19:06:44 +03:00
Ainar Garipov
9fb6bf82c7 Pull request: all: improve prerelease version selection
Merge in DNS/adguard-home from fix-prereleases to master

Squashed commit of the following:

commit 34424e41a0d4f1e22a0dede91e0de1b463d08a0a
Merge: 02e832fc0 6f50a4c96
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Dec 24 17:46:43 2020 +0300

    Merge branch 'master' into fix-prereleases

commit 02e832fc02dc197e40997bf566081b6d8f54420e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Dec 23 17:27:37 2020 +0300

    all: improve prerelease version selection
2020-12-24 18:02:56 +03:00
jvoisin
8e793261e6 Allow users to zoom
This is useful for users with bad eyes, since it
allows them to zoom on the page.
2020-12-24 15:42:27 +03:00
Artem Baskal
6f50a4c964 2485 Fix a couple of stylelint violations
* commit '334b3fc636025657ac6af2df0b90ec01332c8187':
  Fix a couple of stylelint violations
2020-12-24 15:38:40 +03:00
Artem Baskal
6a5bd99eed 2475 Inline a handler for consistency's sake
* commit '4cc68341865f5ccae294ec63103911cb032be3a0':
  Inline a handler for consistency's sake
2020-12-24 15:38:05 +03:00
Artem Baskal
ab1cefca4b 2474 fix typing problems
* commit 'bc9be8d9eebdc8ab19607b8547d81736b32ba58c':
  Update type definition
  Fix some typing problems
2020-12-24 15:37:37 +03:00
Artem Baskal
5b3dfe3274 2468 Use a meaningful alt for adguard home's logo
* commit 'a8677c082b4661552a5619a86f9a52b0822ab3d7':
  Use a meaningful alt for adguard home's logo
2020-12-24 15:37:03 +03:00
Artem Baskal
fa1056b424 2467 button title
* commit '1f649b9799a67588b771ec61658ff5e8ac83f57c':
  Change button title translation key
  Add a title to the refresh buttons
2020-12-24 15:36:34 +03:00
Artem Baskal
a560dafa37 2466 Remove a superfluous argument
* commit 'e393acf5eb08251cd38073a181f5ddce08264af5':
  Remove a superfluous argument
2020-12-24 15:35:44 +03:00
Artem Baskal
bc9be8d9ee Update type definition 2020-12-24 12:34:38 +03:00
jvoisin
334b3fc636 Fix a couple of stylelint violations 2020-12-23 18:14:42 +01:00
Artem Baskal
1f649b9799 Change button title translation key 2020-12-23 19:03:46 +03:00
Ainar Garipov
e829e7a064 Pull request: 2471 defer
Merge in DNS/adguard-home from 2471-defer to master

Updates #2471.

* commit '1c754788f9139ed9741cf01c6d94bcced6909b8c':
  home: improve getCurrentUser
  home: improve checkSession
  Use a couple of defer in internal/home/auth.go
2020-12-23 13:16:44 +03:00
Ainar Garipov
fc79e2e8f8 Pull request: all: support more $dnsrewrite rr types
Merge in DNS/adguard-home from 2102-dnsrewrite-2 to master

Updates #2102.
Updates #2452.

Squashed commit of the following:

commit b41e57731b4f276e97202e172fa400067174653d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Dec 22 20:40:56 2020 +0300

    dnsforward: improve naming

commit 70b832ce969d8cdcf4224d221e5e1e2057fba6ee
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Dec 22 19:36:21 2020 +0300

    all: support more $dnsrewrite rr types
2020-12-23 12:35:07 +03:00
Ainar Garipov
1c754788f9 home: improve getCurrentUser 2020-12-22 21:09:53 +03:00
Ainar Garipov
925c5df801 home: improve checkSession 2020-12-22 21:05:12 +03:00
jvoisin
4cc6834186 Inline a handler for consistency's sake 2020-12-22 13:30:25 +01:00
jvoisin
07497beb78 Fix some typing problems
- Using '' as default value is confusing when the function expects a number
  as parameter
- `validateRequiredValue` can take a number as well as a string as first
  parameter
2020-12-22 13:18:14 +01:00
jvoisin
7eb3e00b35 Use a couple of defer in internal/home/auth.go 2020-12-21 19:39:39 +01:00
Andrey Meshkov
c62dd03921 Merge branch 'master' of ssh://bit.adguard.com:7999/dns/adguard-home 2020-12-21 19:34:23 +03:00
Andrey Meshkov
ab63b6e131 Added links to README 2020-12-21 19:34:19 +03:00
jvoisin
a8677c082b Use a meaningful alt for adguard home's logo 2020-12-21 17:07:53 +01:00
jvoisin
026cc2ecbf Add a title to the refresh buttons
This increases a bit the accessibility.
2020-12-21 17:01:09 +01:00
Ainar Garipov
bdff46ec1d Pull request: all: add $dnsrewrite handling
Merge in DNS/adguard-home from 2102-dnsrewrite to master

Updates #2102.

Squashed commit of the following:

commit 8490fc18179d38c4b162ff9b257fea1f8535afbd
Merge: d9448ddca e7f7799b3
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 21 16:44:00 2020 +0300

    Merge branch 'master' into 2102-dnsrewrite

commit d9448ddca6d4ef3635d767e3e496e44c35d3fc6e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 21 15:44:54 2020 +0300

    querylog: support dnsrewrite rules

commit 40aa5d30acddf29fb90d249d8806941c6e1915a4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Dec 18 19:27:40 2020 +0300

    all: improve documentation

commit f776a0cd63b1640ba1e5210d9301e2a2801fd824
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Dec 18 19:09:08 2020 +0300

    dnsfilter: prevent panics, improve docs

commit e14073b7500d9ed827a151c5b8fb863c980c10e8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Dec 4 15:51:02 2020 +0300

    all: add $dnsrewrite handling
2020-12-21 17:48:07 +03:00
jvoisin
e393acf5eb Remove a superfluous argument 2020-12-21 14:51:48 +01:00
Artem Baskal
e7f7799b3e client: Remove a superfluous condition
* commit '61691fdedbe1002699f773892fff687ed7b31204':
  Remove a superfluous condition
2020-12-21 16:25:37 +03:00
Artem Baskal
da9e92ad6d client: Remove an unused function
* commit '2f265f249e5bc4d20a7a35ab10274c84baa9eba3':
  Remove an unused function
2020-12-21 16:25:14 +03:00
jvoisin
61691fdedb Remove a superfluous condition
`value` is always evaluated to true, due to the
check on the previous line
2020-12-21 13:53:19 +01:00
jvoisin
2f265f249e Remove an unused function 2020-12-21 13:51:08 +01:00
Eugene Burkov
f165fd91c0 Pull request: fix dns cache ttl check
Merge in DNS/adguard-home from 2459-dns-ttl to master

Updates #2459.

Squashed commit of the following:

commit 27e74e30b202ab5163ebdbc2c00622099b11a1ff
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Dec 21 15:00:46 2020 +0300

    all: log changes

commit e476fa5c4b8fd3896fa401f4dc546a5d937746eb
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Dec 21 14:55:30 2020 +0300

    dnsforward: fix dns cache ttl check
2020-12-21 15:43:27 +03:00
Eugene Burkov
49c55e356f Pull request: install check
Merge in DNS/adguard-home from 2453-install-check to master

Closes #2453.

Squashed commit of the following:

commit b3123d7171ff5d1e00d8bcbb5cbe7fcf7a142a3c
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Dec 18 14:00:26 2020 +0300

    all: fix quotes

commit 27e17f9543250d912dd559c9ba2e01e35636551f
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Dec 18 13:34:00 2020 +0300

    all: improve install script

commit e9a927ffabc04dcd223bfc0b3b2541c7d5b96b61
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Dec 18 13:22:05 2020 +0300

    all: add directory emptiness check
2020-12-18 14:19:42 +03:00
Ainar Garipov
5f84cb1afe Pull request: all: update dnsproxy
Merge in DNS/adguard-home from update-dnsproxy to master

Squashed commit of the following:

commit 2d6e80975eeef9e3851b705df592f651a9127c22
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Dec 17 18:09:20 2020 +0300

    all: update dnsproxy
2020-12-17 18:20:34 +03:00
Eugene Burkov
66d593bb0c Pull request: fix docs
Merge in DNS/adguard-home from fix-docs to master

Squashed commit of the following:

commit 81d3ada1917816752ee55f93d478d324a7c7e2f4
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Dec 17 17:35:23 2020 +0300

    all: correct the wording

commit a69a63be6218ef8d9211f753e13cb5e469d7a704
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Dec 17 17:30:49 2020 +0300

    all: log changes
2020-12-17 17:47:14 +03:00
Eugene Burkov
fd7b061dd6 Pull request: 2225 daily freeze fix
Merge in DNS/adguard-home from 2225-fix-freezes to master

Updates #2225.

Squashed commit of the following:

commit 02a472120e9b4a0bc13129adb85eed5d9fd810a2
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Dec 17 14:10:20 2020 +0300

    all: go mod tidy

commit 6cfc23b780cf5da58719620ea5cd1fd3980c631e
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Dec 17 14:06:28 2020 +0300

    all: upd dnsproxy dependency
2020-12-17 14:18:29 +03:00
Ainar Garipov
2e8352d31c Pull request #886: all: allow multiple rules in dns filter results
Merge in DNS/adguard-home from 2102-rules-result to master

Updates #2102.

Squashed commit of the following:

commit 47b2aa94c56b37be492c3c01e8111054612d9722
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Dec 17 13:12:27 2020 +0300

    querylog: remove pre-v0.99.3 compatibility code

commit 2af0ee43c2444a7d842fcff057f2ba02f300244b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Dec 17 13:00:27 2020 +0300

    all: improve documentation

commit 3add300a42f0aa67bb315a448e294636c85d0b3b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Dec 16 18:30:01 2020 +0300

    all: improve changelog

commit e04ef701fc2de7f4453729e617641c47e0883679
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Dec 16 17:56:53 2020 +0300

    all: improve code and documentation

commit 4f04845ae275ae4291869e00c62e4ff81b01eaa3
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Dec 16 17:01:08 2020 +0300

    all: document changes, improve api

commit bc59b7656a402d0c65f13bd74a71d8dda6a8a65d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Dec 15 18:22:01 2020 +0300

    all: allow multiple rules in dns filter results
2020-12-17 13:32:46 +03:00
Ainar Garipov
2c56a68597 Pull request: all: update dnsproxy
Merge in DNS/adguard-home from 2394-update-dnsproxy to master

Updates #2394.

Squashed commit of the following:

commit 57526d188055af7d63b8d2fa0cc339612ff4c098
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Dec 16 14:43:29 2020 +0300

    all: document changes

commit acdfd6c219b0570770faf291fadc69ec1855baf4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Dec 16 14:28:23 2020 +0300

    all: update dnsproxy
2020-12-16 16:35:57 +03:00
Ainar Garipov
a2d39c810a Pull request: dnsfilter: restore enum value
Merge in DNS/adguard-home from fix-filter-names to master

Squashed commit of the following:

commit 620d80df12878a1b236abb26cd2a331df998a3d5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 14 20:02:41 2020 +0300

    dnsfilter: restore enum value
2020-12-14 20:12:57 +03:00
Ainar Garipov
0cddf4c11d Pull request: Update quic-go to v0.19.3
Merge in DNS/adguard-home from 2417-update-quic-go to master

* commit '2c2a359d0ad26748b672c1b99aac92c5a4823039':
  Update quic-go to v0.19.3
2020-12-14 16:38:21 +03:00
Aaron Bieber
2c2a359d0a Update quic-go to v0.19.3
quic-go at version 0.19.1 has a bug that prevents it from building on systems
that don't have IP_RECVTOS.

Version 0.19.3 contains a fix:
 https://github.com/lucas-clemente/quic-go/pull/2886
2020-12-11 08:20:45 -07:00
Ainar Garipov
e2738fdf3f Pull request: all: fix snapshot release version length
Merge in DNS/adguard-home from 2410-fix-snapshot to master

Updates #2410.
Updates #2412.

Squashed commit of the following:

commit 6718e018533abbd02ccefdb5a0030655d5e8012a
Merge: ba5fc4c58 e02308dd4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Dec 10 14:36:19 2020 +0300

    Merge branch 'master' into 2410-fix-snapshot

commit ba5fc4c58b1f2be0b3e6fbbeea04f70b506633f2
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Dec 10 13:12:12 2020 +0300

    all: fix snapshot release version length
2020-12-10 14:49:11 +03:00
Ainar Garipov
e02308dd42 Pull request: scripts: improve go-lint
Merge in DNS/adguard-home from imp-lint-script to master

Squashed commit of the following:

commit 89a6e8343f9f0c7ea257899b5daac014bfb6b6df
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Dec 10 13:36:38 2020 +0300

    script: make go-lint more in line with HACKING.md

commit dc4e1519d25877a074f667fec696578c80d7baf3
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Dec 10 13:35:03 2020 +0300

    scripts: improve go-lint
2020-12-10 14:35:07 +03:00
Ainar Garipov
ef178610d6 Pull request: all: cleanup
Merge in DNS/adguard-home from cleanup to master

Squashed commit of the following:

commit a62e28cd35fefe45e228d1762aa2c148204c3065
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Dec 9 12:24:34 2020 +0300

    all: more cleanup

commit 04dc2220483fa3216b138b7b848b818dcc2a393a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Dec 8 20:52:28 2020 +0300

    all: cleanup
2020-12-09 12:39:20 +03:00
Artem Baskal
5c7b6bbf5c Use external links
Squashed commit of the following:

commit 5617cde490beea6f09e1beef1ff8b8e151e26244
Merge: 0a6500e75 7f9a3a73b
Author: Artem Baskal <a.baskal@adguard.com>
Date:   Tue Dec 8 18:34:19 2020 +0300

    Merge branch 'master' into use-external-links

commit 0a6500e75fbaa354a938c818f02f0b2419bd0d8e
Merge: 9d2ff3bb5 73c30590e
Author: Artem Baskal <a.baskal@adguard.com>
Date:   Tue Dec 8 18:15:57 2020 +0300

    Merge branch 'master' into use-external-links

commit 9d2ff3bb5b3f5d5f08f26f54552ac07dd1724de5
Author: Artem Baskal <a.baskal@adguard.com>
Date:   Tue Dec 8 18:04:09 2020 +0300

    client: open external links in new tab

commit 57d0ed09a8
Author: Zhijie He <hezhijie0327@hotmail.com>
Date:   Tue Nov 24 09:53:37 2020 +0800

    Encryption: use rel="noopener noreferrer"

commit 0554590059
Author: Zhijie He <hezhijie0327@hotmail.com>
Date:   Tue Nov 24 09:51:19 2020 +0800

    Clients: use rel="noopener noreferrer"
2020-12-08 18:47:47 +03:00
Ainar Garipov
7f9a3a73b4 Pull request: 2276 no golangci
Merge in DNS/adguard-home from 2276-no-golangci to master

Updates #2276.

Squashed commit of the following:

commit 81a5a62716b8c57e8575cf149938cd941660b6f5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Dec 8 16:59:19 2020 +0300

    all: fix Makefile

commit a8f2546803a3986f1292b45921c27409366bc04a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Dec 8 16:11:09 2020 +0300

    all: remove golangci-yaml, add new linters
2020-12-08 18:23:35 +03:00
Ainar Garipov
73c30590e0 Pull request: all: fix lint and naming issues vol. 4
Merge in DNS/adguard-home from 2276-fix-lint-4 to master

Updates #2276.

Squashed commit of the following:

commit 15d49184cd8ce1f8701bf3221e69418ca1778b36
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Dec 8 15:51:34 2020 +0300

    util: fix naming

commit 3b9a86a0feb8c6e0b167e6e23105e8137b0dda76
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Dec 8 15:41:10 2020 +0300

    all: fix lint and naming issues vol. 4
2020-12-08 16:01:13 +03:00
Artem Baskal
b7bf7f78df client: 2353 sort ip in dns rewrites
Close #2353

Squashed commit of the following:

commit 1072b124c68ff09c6d718acb3aea625fd7b38c4f
Merge: 77e9a6f10 6aacb2105
Author: Artem Baskal <a.baskal@adguard.com>
Date:   Tue Dec 8 14:27:06 2020 +0300

    Merge branch 'master' into 2353-fix-sort-ip

commit 77e9a6f1013e200346b0dc332fd6b7e9e88c8ade
Author: Artem Baskal <a.baskal@adguard.com>
Date:   Mon Dec 7 17:38:24 2020 +0300

    client: 2353 sort ip in dns rewrites
2020-12-08 15:31:20 +03:00
Artem Baskal
6aacb2105c client: 2368 Allow to enable DHCP even if there's another DHCP found on the network
Squashed commit of the following:

commit 2411b36b07b263c9a752f17f676bae93c15e430d
Merge: 8b8740fd3 88d44b437
Author: Artem Baskal <a.baskal@adguard.com>
Date:   Tue Dec 8 14:11:15 2020 +0300

    Merge branch 'master' into fix/2368

commit 8b8740fd3f379ed1b17c3da27c748df9238efc77
Author: Artem Baskal <a.baskal@adguard.com>
Date:   Mon Dec 7 16:51:45 2020 +0300

    + client: 2368 Allow to enable DHCP even if there's another DHCP found on the network
2020-12-08 14:26:44 +03:00
Artem Baskal
88d44b4370 client: 2367 Show SSL Certificate Expire Banner in 5 Days
Squashed commit of the following:

commit 290b3fbc5e18a2cc8694fb2d5f777952d971dfd6
Merge: fe5c67e62 2313eda12
Author: Artem Baskal <a.baskal@adguard.com>
Date:   Tue Dec 8 13:57:38 2020 +0300

    Merge branch 'master' into fix/2367

commit fe5c67e624280d7fc08192ed3e953a09ca10a9ee
Author: Artem Baskal <a.baskal@adguard.com>
Date:   Mon Dec 7 16:44:41 2020 +0300

    - client: 2367 Show SSL Certificate Expire Banner in 5 Days
2020-12-08 14:08:39 +03:00
Eugene Burkov
2313eda123 Pull request: 2302 static ip
Merge in DNS/adguard-home from 2302-static-ip to master

Closes #2302.

Squashed commit of the following:

commit e62b7b033861f1c55f0d06811ca005b3934ddc5b
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Dec 7 19:38:15 2020 +0300

    all: format changelog

commit 4127aa7630674ddcfe84f712e6c7c8d06b1cab9a
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Dec 7 19:24:53 2020 +0300

    all: fix changelog typo

commit f8a432056d3682facae0cdec99d7d80a5c2bd9b5
Merge: b809a866e e4383189a
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Dec 7 19:22:27 2020 +0300

    Merge branch 'master' into 2302-static-ip

commit b809a866e49147354f9c6952b2f958b6b56ad873
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Dec 7 19:20:05 2020 +0300

    all: log changes

commit 248c35ba411af731d6eae755a901cdbc77980628
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Dec 7 18:57:15 2020 +0300

    sysutil: use bufio.Scanner

commit 0dc19dd5c232fbe9552a2b0d846e048274d73a74
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Dec 7 17:26:18 2020 +0300

    sysutil: fix linux tests

commit 91202d6763595cff187040516dd1db10a20762b7
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Dec 7 17:15:29 2020 +0300

    sysutil: fix linux files

commit 40fbdbb95876322ebaeef1cbdaa8e3299b83ca7e
Merge: d9a43ffb6 9b963fc77
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Dec 7 16:52:35 2020 +0300

    Merge branch 'master' into 2302-static-ip

commit d9a43ffb68a2ddbbcf185b69fc75aed139cd6919
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Dec 7 16:49:22 2020 +0300

    sysutil: add main test

commit bfef89186035ab0423d23246d46511584c26534c
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Dec 7 16:21:59 2020 +0300

    sysutil: improve code quality

commit a5f57a373f736971fdeb0c03371da7c8138b3a82
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Dec 4 14:14:08 2020 +0300

    all: move system functionality from dhcpd package to sysutil.

commit 020b51864f85a39ca80e2b4e06faeb47cf318e11
Merge: 967e111a6 ab8defdb0
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Dec 2 14:53:43 2020 +0300

    Merge branch 'master' into 2302-static-ip

commit 967e111a663c18b5f4a87f3ae38d076f3ab6c200
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Dec 2 13:52:17 2020 +0300

    all: improve code quality
2020-12-07 19:48:24 +03:00
Ainar Garipov
e4383189a5 Pull request: all: fix github action result reporting
Merge in DNS/adguard-home from fix-gh-action-on-fail to master

Squashed commit of the following:

commit e8d48ee022772e0741de56dd955103efa27db0f6
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 7 18:54:14 2020 +0300

    all: remove tests

commit ecdcea9c3a2ee3adda3aca57c761963678547cb2
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 7 18:44:47 2020 +0300

    all: fix github action result reporting
2020-12-07 19:00:52 +03:00
Ainar Garipov
09b6eba7d9 Pull request: all: add dnscrypt support
Merge in DNS/adguard-home from 1361-dnscrypt to master

Closes #1361.

Squashed commit of the following:

commit 31b780c16cc6b68336b95275f62381cee2e822a2
Merge: c2ce98aaf 9b963fc77
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 7 17:48:41 2020 +0300

    Merge branch 'master' into 1361-dnscrypt

commit c2ce98aaf24bd5ed5b5cd7da86aae093866ab34e
Merge: 3bf3d7b96 63e513e33
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Dec 4 19:32:40 2020 +0300

    Merge branch 'master' into 1361-dnscrypt

commit 3bf3d7b96530c86b54545462390562ebedc616b2
Merge: 5de451996 4134220c5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Dec 3 17:31:59 2020 +0300

    Merge branch 'master' into 1361-dnscrypt

commit 5de451996d48ab3792ce78291068f72785303494
Merge: 60d7976f7 ab8defdb0
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Dec 2 19:07:56 2020 +0300

    Merge branch 'master' into 1361-dnscrypt

commit 60d7976f7c7ad0316751b92477a31f882c1e3134
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Nov 30 19:11:14 2020 +0300

    all: add dnscrypt support
2020-12-07 17:58:33 +03:00
Ainar Garipov
9b963fc777 Pull request: all: fix lint and naming issues vol. 3
Merge in DNS/adguard-home from 2276-fix-lint-3 to master

Updates #2276.

Squashed commit of the following:

commit 6ee94cc6ed2a9762b70ef395b58b496434244b80
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 7 15:55:45 2020 +0300

    all: fix lint and naming issues vol. 3
2020-12-07 16:04:53 +03:00
Ainar Garipov
7f29d4e546 Pull request: all: fix lint and naming issues vol. 2
Merge in DNS/adguard-home from 2276-fix-lint-2 to master

Updates #2276.

Squashed commit of the following:

commit 24760b9586bb31be134ef9518dbece485560b1a0
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 7 14:39:50 2020 +0300

    all: fix lint and naming issues vol. 2
2020-12-07 15:38:05 +03:00
Ainar Garipov
a572876775 Pull request: all: fix lint and naming issues
Merge in DNS/adguard-home from 2276-fix-lint to master

Updates #2276.

Squashed commit of the following:

commit 433f44cc7b674a20ed60a9d29466ba888b3ef66e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 7 14:14:28 2020 +0300

    querylog: improve code and documentation

commit 851df97d2a87de5e7180a502055ee6f1a6defdca
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Dec 4 20:36:32 2020 +0300

    all: fix lint and naming issues
2020-12-07 14:32:06 +03:00
Ainar Garipov
63e513e33e Pull request: Add security to openapi spec
Merge in DNS/adguard-home from 2392-docs to master

Closes #2392.

* commit 'a86172fda426ab24dc5e82c84b380fe110f169fc':
  Add security to openapi spec
2020-12-04 19:30:11 +03:00
Ainar Garipov
dfd28b45ab Pull request: all: improve changelog
Merge in DNS/adguard-home from doc-fix to master

Squashed commit of the following:

commit 266940fce08a3694d771ab0a4643757ee1fa9c5f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Dec 1 16:29:15 2020 +0300

    all: improve changelog
2020-12-04 19:16:01 +03:00
shopeonarope
a86172fda4 Add security to openapi spec 2020-12-04 09:15:48 -07:00
Eugene Burkov
8501a85292 Pull request: fix binding capability defining
Merge in DNS/adguard-home from 2391-updating-bug to master

Updates #2391.
Updates #2231.

Squashed commit of the following:

commit b321884e6ade04375dad3b981c2920500ff6f645
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Dec 4 16:54:20 2020 +0300

    all: log changes

commit 5aa0202a6f6d2abdfc37daee4b0d64f8cee8a62c
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Dec 4 14:42:10 2020 +0300

    sysutil: fix binding capability defining
2020-12-04 17:06:19 +03:00
Ainar Garipov
4134220c54 Pull request: all: try using a different plug for snap
Merge in DNS/adguard-home from 2228-different-plug to master

Squashed commit of the following:

commit 4b4da208e90fb00088a51c9abf599e6634c1ca1f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Dec 2 20:24:03 2020 +0300

    all: try using a different plug for snap
2020-12-02 20:34:03 +03:00
Eugene Burkov
ab8defdb08 Pull request: fix zero-length ip addresses list bug
Merge in DNS/adguard-home from 2304-fix-panic to master

Updates #2304.

Squashed commit of the following:

commit bd7742eb144b46e16c751f98f6a4a6f15fbfa60e
Merge: 26313926e 7d1d87d6e
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Dec 2 14:29:37 2020 +0300

    Merge branch 'master' into 2304-fix-panic

commit 26313926e827d1f5ceb4eec744b814ce7c32663d
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Dec 2 14:09:16 2020 +0300

    all: add gitignore rule

commit 5a8521bd9b4014972107e8de352e20144f8187fb
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Dec 2 14:03:26 2020 +0300

    dhcpd: fix zero-length ip addresses list bug
2020-12-02 14:42:59 +03:00
Ainar Garipov
7d1d87d6ec Pull request: + client: 2358 Make the mobileconfig API parameterized and more robust
Merge in DNS/adguard-home from feature/2358 to master

Updates #2358.

Squashed commit of the following:

commit b2b91ee3b7303d20b94265d43d785e77260b2210
Author: Artem Baskal <a.baskal@adguard.com>
Date:   Tue Dec 1 14:54:35 2020 +0300

    + client: 2358 Make the mobileconfig API parameterized and more robust
2020-12-01 15:51:35 +03:00
Eugene Burkov
641db73a86 Pull request: 2231 autoupdate
Merge in DNS/adguard-home from 2231-autoupdate to master

Updates #2231.

Squashed commit of the following:

commit 4ee9148ee7a38f2759898302a2109aa982fb4ee9
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Nov 30 19:08:14 2020 +0300

    sysutil: provide os-independent interface

commit 778097c5fdeb1dec94f4cfc6443d08f92d9db0ba
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Nov 30 16:40:33 2020 +0300

    all: add sysutil package
2020-11-30 19:23:14 +03:00
Ainar Garipov
6e615c6eaa Pull request: querylog: resort buffers
Merge in DNS/adguard-home from 2293-log-sort to master

Updates #2293.

Squashed commit of the following:

commit f8961e5c52f82befe23ab1f7603a867243186498
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Sat Nov 28 17:19:15 2020 +0300

    all: document changes

commit c92c53307f1ed4a1c3196bdc19d23a775876b106
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Sat Nov 28 16:44:01 2020 +0300

    querylog: resort buffers
2020-11-30 13:32:58 +03:00
Ainar Garipov
60d72fb9c3 Pull request: all: update changelog
Merge in DNS/adguard-home from update-docs to master

Squashed commit of the following:

commit 177ce523ecc31405837eaad46d894bdce4cbee00
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Nov 27 16:45:44 2020 +0300

    all: update changelog
2020-11-27 17:03:00 +03:00
Ainar Garipov
a6e18c4700 Pull request: dhcpd: wait for interfaces' ip addresses to appear
Merge in DNS/adguard-home from 2304-dncp-backoff to master

Updates #2304.

Squashed commit of the following:

commit c9bff8b27c6b031d43a7dd98152adcde7f49fff1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Nov 27 14:08:03 2020 +0300

    dhcpd: try for 5s instead of 10s

commit 983cf471832de0e7762b8b6e0a4ba9bb76ecadfc
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Nov 25 19:58:41 2020 +0300

    dhcpd: wait for interfaces' ip addresses to appear
2020-11-27 14:39:43 +03:00
Eugene Burkov
f9e4e7b024 Pull request: fix querylog bug
Merge in DNS/adguard-home from 2345-querylog-bug-fix to master

Closes #2345.

Squashed commit of the following:

commit 3ebd13e059242b041f3c4d77583a077f9e619b48
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Nov 27 12:14:49 2020 +0300

    all: make changelog more humanly readable.

commit 3c9bb1be6aec113ebebdb40c976dbdb821f75638
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Nov 26 14:43:14 2020 +0300

    all: log changes

commit 08c67da926aa085fabdec31c092285a351eb0e08
Merge: 650d2241e 96e83a133
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Nov 26 14:42:18 2020 +0300

    Merge branch 'master' into 2345-querylog-bug-fix

commit 650d2241e02cf54a7e1f7a611199e770fd119953
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Nov 26 14:02:57 2020 +0300

    querylog: fix json parsing bug
2020-11-27 12:33:25 +03:00
Ainar Garipov
96e83a133f Pull request: home: improve mobileconfig http api
Merge in DNS/adguard-home from 2358-mobileconfig to master

Updates #2358.

Squashed commit of the following:

commit ab3c7a75ae21f6978904f2dc237cb84cbedff7ab
Merge: fa002e400 b4a35fa88
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Nov 25 16:11:06 2020 +0300

    Merge branch 'master' into 2358-mobileconfig

commit fa002e40004656db08d32c926892c6c820fb1338
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Nov 25 15:19:00 2020 +0300

    home: improve mobileconfig http api
2020-11-25 18:09:41 +03:00
Eugene Burkov
b4a35fa887 Pull request: 2343 http server
Merge in DNS/adguard-home from 2343-http-server to master

Closes #2343.

Squashed commit of the following:

commit f4ebfc129484fc3489409069b3580eb70d71cc74
Merge: b13ec7002 36c7735b8
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Nov 25 15:37:27 2020 +0300

    Merge branch 'master' into 2343-http-server

commit b13ec70024f24f6b68b13a1ec6f27c89535feaf8
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Nov 25 15:31:36 2020 +0300

    all: record changes

commit ce44aac9d43e32db3f68746dec7a4f21b0a9dea4
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Nov 25 14:00:45 2020 +0300

    home: set http servers timeouts

commit 7f3e7385d1df39b39713b8ec443da5d9374d0bc8
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Nov 24 19:58:56 2020 +0300

    home: replace default ServeMux with custom one.
2020-11-25 15:50:59 +03:00
Ainar Garipov
36c7735b85 Pull request: dhcpd: fix interface ipv6 check
Merge in DNS/adguard-home from 2355-dhcpcheck-ipv6 to master

Updates #2335.

Squashed commit of the following:

commit 5ce1cc7bc244ba5dd4a065d47dec8884fa3d45e7
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Nov 25 14:03:24 2020 +0300

    dhcpd: fix loop exit condition

commit 32b4b946bfa30159326dc295fa1a2607b78172af
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Nov 25 13:26:50 2020 +0300

    dhcpd: fix interface ipv6 check
2020-11-25 14:26:26 +03:00
Ainar Garipov
284da7c91b Pull request: improve docs
Merge in DNS/adguard-home from update-docs to master

Squashed commit of the following:

commit 228c432adecf9f7927a692780a4762f1135b8cd6
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Nov 20 18:18:10 2020 +0300

    improve docs
2020-11-25 12:02:21 +03:00
Ainar Garipov
e685d81c92 Pull request #847: dnsfilter: add $dnstype handling
Merge in DNS/adguard-home from 2337-dnstype to master

Updates #2102.
Updates #2337.

Squashed commit of the following:

commit ac4b7522c732c0bf8ee06539fd4c95b5dc1c87b8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Nov 24 17:50:33 2020 +0300

    dnsfilter: add $dnstype handling
2020-11-24 19:55:05 +03:00
Eugene Burkov
1cf9848044 Pull request: update snap core version
Merge in DNS/adguard-home from 2306-update-snap-core to master

Closes #2306.

Squashed commit of the following:

commit e02c083ede35e27e1273d3fa2c1d033ccd749718
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Nov 23 16:15:59 2020 +0300

    all: update snap core version
2020-11-23 18:05:45 +03:00
Ainar Garipov
c129361e55 Pull request: 2305 limit message size
Merge in DNS/adguard-home from 2305-limit-message-size to master

Closes #2305.

Squashed commit of the following:

commit 6edd1e0521277a680f0053308efcf3d9cacc8e62
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Nov 23 14:03:36 2020 +0300

    aghio: fix final inaccuracies

commit 4dd382aaf25132b31eb269749a2cd36daf0cb792
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Nov 23 13:59:10 2020 +0300

    all: improve code quality

commit 060f923f6023d0e6f26441559b7023d5e5f96843
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Nov 23 13:10:57 2020 +0300

    aghio: add validation to constructor

commit f57a2f596f5dc578548241c315c68dce7fc93905
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Nov 20 19:19:26 2020 +0300

    all: fix minor inaccuracies

commit 93462c71725d3d00655a4bd565b77e64451fff60
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Nov 20 19:13:23 2020 +0300

    home: make test name follow convention

commit 4922986ad84481b054479c43b4133a1b97bee86b
Merge: 1f5472abc 046ec13fd
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Nov 20 19:09:01 2020 +0300

    Merge branch 'master' into 2305-limit-message-size

commit 1f5472abcfa7427f389825fc59eb4253e1e2bfb7
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Nov 20 19:08:21 2020 +0300

    aghio: improve readability

commit 60dc706b093fa22bbf62f13b2341934364ddc4df
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Nov 20 18:44:08 2020 +0300

    home: cover middleware with test

commit bedf436b947ca1fa4493af2fc94f1f40beec7c35
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Nov 20 17:10:23 2020 +0300

    aghio: improved error informativeness

commit 682c5da9f21fa330fb3536bb1c112129c91b9990
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Nov 20 13:37:51 2020 +0300

    all: limit readers for ReadAll dealing with miscellanious data.

commit 78c6dd8d90a0a43fe6ee3f9ed4d5fc637b15ba74
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Nov 19 20:07:43 2020 +0300

    all: handle ReadAll calls dealing with request's bodies.

commit bfe1a6faf6468eb44515e2b0ecffa8c51f90b7e8
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Nov 19 17:25:34 2020 +0300

    home: add middlewares

commit bbd1d491b318e6ba07f8af23ad546183383783a8
Merge: 7b77c2cad 62a8fe0b7
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Nov 19 16:44:04 2020 +0300

    Merge branch 'master' into 2305-limit-message-size

commit 7b77c2cad03154177392460982e1d73ee2a30177
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Nov 17 15:33:33 2020 +0300

    aghio: create package
2020-11-23 14:14:08 +03:00
Ainar Garipov
046ec13fdc Pull request: all: reformat yaml, add yaml formatting standard
Merge in DNS/adguard-home from 2297-yaml to master

Closes #2297.

Squashed commit of the following:

commit 85df3a38a14adb1965944ddf14b197c12a213057
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Nov 20 17:52:22 2020 +0300

    all: improve HACKING.md

commit 079acdfe41cc12ab6aa13d7c28dcbf7b7b3c8380
Merge: 202ea078e 3045da174
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Nov 20 17:50:34 2020 +0300

    Merge branch 'master' into 2297-yaml

commit 202ea078e29d88871a32ac6e668dfae6db802bab
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Nov 12 20:25:42 2020 +0300

    all: reformat yaml, add yaml formatting standard
2020-11-20 18:06:07 +03:00
Eugene Burkov
3045da1742 Pull request: 2271 handle nolint
Merge in DNS/adguard-home from 2271-handle-nolint to master

Closes #2271.

Squashed commit of the following:

commit fde5c8795ac79e1f7d02ba8c8e369b5a724a000e
Merge: fc2acd898 642dcd647
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Nov 20 17:12:28 2020 +0300

    Merge branch 'master' into 2271-handle-nolint

commit fc2acd89871de08c39e80ace9e5bb8a7acb7afba
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Nov 17 11:55:29 2020 +0300

    dnsforward: fix test output strings

commit c4ebae6ea9c293bad239519c44ca5a6c576bb921
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Nov 16 22:43:20 2020 +0300

    dnsfilter: make package pass tests

commit f2d98c6acabd8977f3b1b361987eaa31eb6eb9ad
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Nov 16 20:05:00 2020 +0300

    querylog: make decoding pass tests

commit ab5850d24c50d53b8393f2de448cc340241351d7
Merge: 6ed2066bf 8a9c6e8a0
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Nov 16 19:48:31 2020 +0300

    Merge branch 'master' into 2271-handle-nolint

commit 6ed2066bf567e13dd14cfa16fc7b109b59fa39ef
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Nov 16 18:13:45 2020 +0300

    home: fix tests naming

commit af691081fb02b7500a746b16492f01f7f9befe9a
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Nov 16 12:15:49 2020 +0300

    home: impove code quality

commit 2914cd3cd23ef2a1964116baab9187d89b377f86
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Nov 11 15:46:39 2020 +0300

    * querylog: remove useless check

commit 9996840650e784ccc76d1f29964560435ba27dc7
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Nov 11 13:18:34 2020 +0300

    * all: fix noticed defects

commit 2b15293e59337f70302fbc0db81ebb26bee0bed2
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Nov 10 20:15:53 2020 +0300

    * stats: remove last nolint directive

commit b2e1ddf7b58196a2fdbf879f084edb41ca1aa1eb
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Nov 10 18:35:41 2020 +0300

    * all: remove another nolint directive

commit c6fc5cfcc9c95ab9e570a95ab41c3e5c0125e62e
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Nov 10 18:11:28 2020 +0300

    * querylog: remove nolint directive

commit 226ddbf2c92f737f085b44a4ddf6daec7b602153
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Nov 10 16:35:26 2020 +0300

    * home: remove nolint directive

commit 2ea3086ad41e9003282add7e996ae722d72d878b
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Nov 10 16:13:57 2020 +0300

    * home: reduce cyclomatic complexity of run function

commit f479b480c48e0bb832ddef8f57586f56b8a55bab
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Nov 10 15:35:46 2020 +0300

    * home: use crypto/rand instead of math/rand

commit a28d4a53e3b930136b036606fc7e78404f1d208b
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Nov 10 14:11:07 2020 +0300

    * dnsforward: remove gocyclo nolint directive

commit 64a0a324cc2b20614ceec3ccc6505e960fe526e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Nov 10 11:45:49 2020 +0300

    all *: remove some nolint directives

    Updates #2271.
2020-11-20 17:32:41 +03:00
Ainar Garipov
642dcd647c Pull request: all: update backend tools and dependencies
Merge in DNS/adguard-home from 2275-update-tools to master

Squashed commit of the following:

commit 4de1cf91dc7accabeb2103d3c8ec424bee2a89ce
Merge: 06b302c62 62a8fe0b7
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Nov 19 16:22:30 2020 +0300

    Merge branch 'master' into 2275-update-tools

commit 06b302c62958aa8ab4a9da423a32cd71037d58d7
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Nov 13 11:29:19 2020 +0300

    all: update backend tools and dependencies
2020-11-20 13:44:21 +03:00
414 changed files with 36916 additions and 9400 deletions

View File

@@ -1,8 +1,8 @@
coverage:
status:
project:
default:
target: 40%
threshold: null
patch: false
changes: false
'coverage':
'status':
'project':
'default':
'target': '40%'
'threshold': null
'patch': false
'changes': false

View File

@@ -1,40 +1,3 @@
.DS_Store
/.git
/.github
/.vscode
.idea
/AdGuardHome
/AdGuardHome.exe
/AdGuardHome.yaml
/AdGuardHome.log
/data
/build
/dist
/client/node_modules
/.gitattributes
/.gitignore
/.goreleaser.yml
/changelog.config.js
/coverage.txt
/Dockerfile
/LICENSE.txt
/Makefile
/querylog.json
/querylog.json.1
/*.md
# Test output
dnsfilter/tests/top-1m.csv
dnsfilter/tests/dnsfilter.TestLotsOfRules*.pprof
# Snapcraft build temporary files
*.snap
launchpad_credentials
snapcraft_login
snapcraft.yaml.bak
# IntelliJ IDEA project files
*.iml
# Packr
*-packr.go
# Ignore everything except for explicitly allowed stuff.
*
!dist/docker

View File

@@ -1,18 +0,0 @@
#!/bin/bash
set -e;
found=0
git diff --cached --name-only | grep -q '.js$' && found=1
if [ $found == 1 ]; then
npm --prefix client run lint || exit 1
npm run test --prefix client || exit 1
fi
found=0
git diff --cached --name-only | grep -q '.go$' && found=1
if [ $found == 1 ]; then
make lint-go || exit 1
go test ./... || exit 1
fi
exit 0;

View File

@@ -21,6 +21,8 @@ Please answer the following questions for yourself before submitting an issue. *
* **Version of AdGuard Home server:**
* <!-- (e.g. v1.0) -->
* **How did you install AdGuard Home:**
* <!-- (e.g. Snapcraft, Docker, Github releases) -->
* **How did you setup DNS configuration:**
* <!-- (System/Router/IoT) -->
* **If it's a router or IoT, please write device model:**

33
.github/stale.yml vendored
View File

@@ -1,19 +1,20 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- 'bug'
- 'enhancement'
- 'feature request'
- 'localization'
# Label to use when marking an issue as stale
staleLabel: 'wontfix'
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
# Number of days of inactivity before an issue becomes stale.
'daysUntilStale': 60
# Number of days of inactivity before a stale issue is closed.
'daysUntilClose': 7
# Issues with these labels will never be considered stale.
'exemptLabels':
- 'bug'
- 'enhancement'
- 'feature request'
- 'localization'
- 'recurrent'
# Label to use when marking an issue as stale.
'staleLabel': 'wontfix'
# Comment to post when marking an issue as stale. Set to `false` to disable.
'markComment': >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
# Comment to post when closing a stale issue. Set to `false` to disable.
'closeComment': false

View File

@@ -1,170 +1,131 @@
name: build
'name': 'build'
env:
GO_VERSION: 1.14
NODE_VERSION: 13
'env':
'GO_VERSION': '1.14'
'NODE_VERSION': '14'
on:
push:
branches:
- '*'
tags:
- v*
pull_request:
'on':
'push':
'branches':
- '*'
'tags':
- 'v*'
'pull_request':
jobs:
'jobs':
'test':
'runs-on': '${{ matrix.os }}'
'env':
'GO111MODULE': 'on'
'GOPROXY': 'https://goproxy.io'
'strategy':
'fail-fast': false
'matrix':
'os':
- 'ubuntu-latest'
- 'macOS-latest'
- 'windows-latest'
'steps':
- 'name': 'Checkout'
'uses': 'actions/checkout@v2'
'with':
'fetch-depth': 0
- 'name': 'Set up Go'
'uses': 'actions/setup-go@v2'
'with':
'go-version': '${{ env.GO_VERSION }}'
- 'name': 'Set up Node'
'uses': 'actions/setup-node@v1'
'with':
'node-version': '${{ env.NODE_VERSION }}'
- 'name': 'Set up Go modules cache'
'uses': 'actions/cache@v2'
'with':
'path': '~/go/pkg/mod'
'key': "${{ runner.os }}-go-${{ hashFiles('go.sum') }}"
'restore-keys': '${{ runner.os }}-go-'
- 'name': 'Get npm cache directory'
'id': 'npm-cache'
'run': 'echo "::set-output name=dir::$(npm config get cache)"'
- 'name': 'Set up npm cache'
'uses': 'actions/cache@v2'
'with':
'path': '${{ steps.npm-cache.outputs.dir }}'
'key': "${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}"
'restore-keys': '${{ runner.os }}-node-'
- 'name': 'Run make ci'
'shell': 'bash'
'run': 'make VERBOSE=1 ci'
- 'name': 'Upload coverage'
'uses': 'codecov/codecov-action@v1'
'if': "success() && matrix.os == 'ubuntu-latest'"
'with':
'token': '${{ secrets.CODECOV_TOKEN }}'
'file': './coverage.txt'
'build-release':
'runs-on': 'ubuntu-latest'
'needs': 'test'
'steps':
- 'name': 'Checkout'
'uses': 'actions/checkout@v2'
'with':
'fetch-depth': 0
- 'name': 'Set up Go'
'uses': 'actions/setup-go@v2'
'with':
'go-version': '${{ env.GO_VERSION }}'
- 'name': 'Set up Node'
'uses': 'actions/setup-node@v1'
'with':
'node-version': '${{ env.NODE_VERSION }}'
- 'name': 'Set up Go modules cache'
'uses': 'actions/cache@v2'
'with':
'path': '~/go/pkg/mod'
'key': "${{ runner.os }}-go-${{ hashFiles('go.sum') }}"
'restore-keys': '${{ runner.os }}-go-'
- 'name': 'Get npm cache directory'
'id': 'npm-cache'
'run': 'echo "::set-output name=dir::$(npm config get cache)"'
- 'name': 'Set up node_modules cache'
'uses': 'actions/cache@v2'
'with':
'path': '${{ steps.npm-cache.outputs.dir }}'
'key': "${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}"
'restore-keys': '${{ runner.os }}-node-'
- 'name': 'Set up Snapcraft'
'run': 'sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft'
- 'name': 'Set up QEMU'
'uses': 'docker/setup-qemu-action@v1'
- 'name': 'Set up Docker Buildx'
'uses': 'docker/setup-buildx-action@v1'
- 'name': 'Run snapshot build'
'run': 'make SIGN=0 VERBOSE=1 js-deps js-build build-release build-docker'
test:
runs-on: ${{ matrix.os }}
env:
GO111MODULE: on
GOPROXY: https://goproxy.io
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macOS-latest
- windows-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
-
name: Set up Node
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
-
name: Set up Go modules cache
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
restore-keys: |
${{ runner.os }}-go-
-
name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
-
name: Set up npm cache
uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
-
name: Run make ci
shell: bash
run: |
make ci
-
name: Upload coverage
uses: codecov/codecov-action@v1
if: success() && matrix.os == 'ubuntu-latest'
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
app:
runs-on: ubuntu-latest
needs: test
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
-
name: Set up Node
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
-
name: Set up Go modules cache
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
restore-keys: |
${{ runner.os }}-go-
-
name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
-
name: Set up node_modules cache
uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
-
name: Set up Snapcraft
run: |
sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft
-
name: Set up GoReleaser
run: |
curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | BINDIR="$(go env GOPATH)/bin" sh
-
name: Run snapshot build
run: |
make release
docker:
runs-on: ubuntu-latest
needs: test
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Docker Buildx (build)
run: |
make docker-multi-arch
notify:
needs: [app, docker]
# Secrets are not passed to workflows that are triggered by a pull request from a fork
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
steps:
-
name: Conclusion
uses: technote-space/workflow-conclusion-action@v1
-
name: Send Slack notif
uses: 8398a7/action-slack@v3
with:
status: ${{ env.WORKFLOW_CONCLUSION }}
fields: repo,message,commit,author
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
'notify':
'needs':
- 'build-release'
# Secrets are not passed to workflows that are triggered by a pull request
# from a fork.
#
# Use always() to signal to the runner that this job must run even if the
# previous ones failed.
'if':
${{ always() &&
(
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name == github.repository
)
}}
'runs-on': 'ubuntu-latest'
'steps':
- 'name': 'Conclusion'
'uses': 'technote-space/workflow-conclusion-action@v1'
- 'name': 'Send Slack notif'
'uses': '8398a7/action-slack@v3'
'with':
'status': '${{ env.WORKFLOW_CONCLUSION }}'
'fields': 'repo, message, commit, author, workflow'
'env':
'GITHUB_TOKEN': '${{ secrets.GITHUB_TOKEN }}'
'SLACK_WEBHOOK_URL': '${{ secrets.SLACK_WEBHOOK_URL }}'

View File

@@ -1,47 +1,52 @@
name: golangci-lint
on:
push:
tags:
- v*
branches:
- '*'
pull_request:
jobs:
golangci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2.3.0
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.32
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install modules
run: npm --prefix client ci
- name: Run ESLint
run: npm --prefix client run lint
notify:
needs: [golangci,eslint]
# Secrets are not passed to workflows that are triggered by a pull request from a fork
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
steps:
-
name: Conclusion
uses: technote-space/workflow-conclusion-action@v1
-
name: Send Slack notif
uses: 8398a7/action-slack@v3
with:
status: ${{ env.WORKFLOW_CONCLUSION }}
fields: repo,message,commit,author
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
'name': 'lint'
'on':
'push':
'tags':
- 'v*'
'branches':
- '*'
'pull_request':
'jobs':
'go-lint':
'runs-on': 'ubuntu-latest'
'steps':
- 'uses': 'actions/checkout@v2'
- 'name': 'run-lint'
'run': >
make go-deps go-tools go-lint
'eslint':
'runs-on': 'ubuntu-latest'
'steps':
- 'uses': 'actions/checkout@v2'
- 'name': 'Install modules'
'run': 'npm --prefix="./client" ci'
- 'name': 'Run ESLint'
'run': 'npm --prefix="./client" run lint'
'notify':
'needs':
- 'go-lint'
- 'eslint'
# Secrets are not passed to workflows that are triggered by a pull request
# from a fork.
#
# Use always() to signal to the runner that this job must run even if the
# previous ones failed.
'if':
${{ always() &&
(
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name == github.repository
)
}}
'runs-on': 'ubuntu-latest'
'steps':
- 'name': 'Conclusion'
'uses': 'technote-space/workflow-conclusion-action@v1'
- 'name': 'Send Slack notif'
'uses': '8398a7/action-slack@v3'
'with':
'status': '${{ env.WORKFLOW_CONCLUSION }}'
'fields': 'repo, message, commit, author, workflow'
'env':
'GITHUB_TOKEN': '${{ secrets.GITHUB_TOKEN }}'
'SLACK_WEBHOOK_URL': '${{ secrets.SLACK_WEBHOOK_URL }}'

53
.gitignore vendored
View File

@@ -1,30 +1,25 @@
.DS_Store
/.vscode
.idea
/AdGuardHome
/AdGuardHome.exe
/AdGuardHome.yaml
/AdGuardHome.log
/data/
/build/
/dist/
/client/node_modules/
/querylog.json
/querylog.json.1
coverage.txt
# Test output
dnsfilter/tests/top-1m.csv
dnsfilter/tests/dnsfilter.TestLotsOfRules*.pprof
# Snapcraft build temporary files
*.snap
launchpad_credentials
snapcraft_login
snapcraft.yaml.bak
# IntelliJ IDEA project files
*.iml
# Packr
# Please, DO NOT put your text editors' temporary files here. The more are
# added, the harder it gets to maintain and manage projects' gitignores. Put
# them into your global gitignore file instead.
#
# See https://stackoverflow.com/a/7335487/1892060.
#
# Only build, run, and test outputs here. Sorted.
*-packr.go
*.db
*.log
*.snap
/bin/
/build/
/build2/
/data/
/dist/
/dnsfilter/tests/dnsfilter.TestLotsOfRules*.pprof
/dnsfilter/tests/top-1m.csv
/launchpad_credentials
/querylog.json*
/snapcraft_login
AdGuardHome*
coverage.txt
leases.db
node_modules/

View File

@@ -1,79 +0,0 @@
# options for analysis running
run:
# default concurrency is a available CPU number
concurrency: 4
# timeout for analysis, e.g. 30s, 5m, default is 1m
deadline: 2m
# which files to skip: they will be analyzed, but issues from them
# won't be reported. Default value is empty list, but there is
# no need to include all autogenerated files, we confidently recognize
# autogenerated files. If it's not please let us know.
skip-files:
- ".*generated.*"
- dnsfilter/rule_to_regexp.go
- util/pprof.go
- ".*_test.go"
- client/.*
- build/.*
- dist/.*
# all available settings of specific linters
linters-settings:
errcheck:
# [deprecated] comma-separated list of pairs of the form pkg:regex
# the regex is used to ignore names within pkg. (default "fmt:.*").
# see https://github.com/kisielk/errcheck#the-deprecated-method for details
ignore: fmt:.*,net:SetReadDeadline,net/http:^Write
gocyclo:
min-complexity: 20
lll:
line-length: 200
linters:
enable:
- deadcode
- errcheck
- govet
- ineffassign
- staticcheck
- structcheck
- unused
- varcheck
- bodyclose
- depguard
- dupl
- gocyclo
- goimports
- golint
- gosec
- misspell
- stylecheck
- unconvert
disable-all: true
fast: true
issues:
# List of regexps of issue texts to exclude, empty list by default.
# But independently from this option we use default exclude patterns,
# it can be disabled by `exclude-use-default: false`. To list all
# excluded by default patterns execute `golangci-lint run --help`
exclude:
# structcheck cannot detect usages while they're there
- .parentalServer. is unused
- .safeBrowsingServer. is unused
# errcheck
- Error return value of .s.closeConn. is not checked
- Error return value of ..*.Shutdown.
# goconst
- string .forcesafesearch.google.com. has 3 occurrences
# gosec: Profiling endpoint is automatically exposed on /debug/pprof
- G108
# gosec: Subprocess launched with function call as argument or cmd arguments
- G204
# gosec: Potential DoS vulnerability via decompression bomb
- G110
# gosec: Expect WriteFile permissions to be 0600 or less
- G306

View File

@@ -1,106 +0,0 @@
project_name: AdGuardHome
env:
- GO111MODULE=on
- GOPROXY=https://goproxy.io
before:
hooks:
- go mod download
- go generate ./...
builds:
- main: ./main.go
ldflags:
- -s -w -X main.version={{.Version}} -X main.channel={{.Env.CHANNEL}} -X main.goarm={{.Env.GOARM}}
env:
- CGO_ENABLED=0
goos:
- darwin
- linux
- freebsd
- windows
goarch:
- 386
- amd64
- arm
- arm64
- mips
- mipsle
- mips64
- mips64le
goarm:
- 5
- 6
- 7
gomips:
- softfloat
ignore:
- goos: freebsd
goarch: mips
- goos: freebsd
goarch: mipsle
archives:
- # Archive name template.
# Defaults:
# - if format is `tar.gz`, `tar.xz`, `gz` or `zip`:
# - `{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}`
# - if format is `binary`:
# - `{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}`
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}"
wrap_in_directory: "AdGuardHome"
format_overrides:
- goos: windows
format: zip
- goos: darwin
format: zip
files:
- LICENSE.txt
- README.md
snapcrafts:
- name: adguard-home
base: core18
name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
summary: Network-wide ads & trackers blocking DNS server
description: |
AdGuard Home is a network-wide software for blocking ads & tracking. After
you set it up, it'll cover ALL your home devices, and you don't need any
client-side software for that.
It operates as a DNS server that re-routes tracking domains to a "black hole,"
thus preventing your devices from connecting to those servers. It's based
on software we use for our public AdGuard DNS servers -- both share a lot
of common code.
grade: stable
confinement: strict
publish: false
license: GPL-3.0
extra_files:
- source: scripts/snap/local/adguard-home-web.sh
destination: adguard-home-web.sh
mode: 0755
- source: scripts/snap/gui/adguard-home-web.desktop
destination: meta/gui/adguard-home-web.desktop
mode: 0644
- source: scripts/snap/gui/adguard-home-web.png
destination: meta/gui/adguard-home-web.png
mode: 0644
apps:
adguard-home:
command: AdGuardHome -w $SNAP_DATA --no-check-update
plugs:
# Add the "netrwork-bind" plug to bind to interfaces.
- network-bind
# Add the "netrwork-control" plug to be able to bind to ports below
# 1024 (cap_net_bind_service) and also to bind to a particular
# interface using SO_BINDTODEVICE (cap_net_raw).
- network-control
daemon: simple
adguard-home-web:
command: adguard-home-web.sh
plugs: [ desktop ]
checksum:
name_template: 'checksums.txt'

View File

@@ -1833,16 +1833,22 @@ Response:
200 OK
{
"reason":"FilteredBlackList",
"filter_id":1,
"rule":"||doubleclick.net^",
"service_name": "...", // set if reason=FilteredBlockedService
// if reason=ReasonRewrite:
"cname": "...",
"ip_addrs": ["1.2.3.4", ...],
"reason":"FilteredBlackList",
"rules":{
"filter_list_id":42,
"text":"||doubleclick.net^",
},
// If we have "reason":"FilteredBlockedService".
"service_name": "...",
// If we have "reason":"Rewrite".
"cname": "...",
"ip_addrs": ["1.2.3.4", ...]
}
There are also deprecated properties `filter_id` and `rule` on the top level of
the response object. Their usage should be replaced with
`rules[*].filter_list_id` and `rules[*].text` correspondingly. See the
_OpenAPI_ documentation and the `./openapi/CHANGELOG.md` file.
## Log-in page

View File

@@ -9,7 +9,98 @@ and this project adheres to
## [Unreleased]
<!--
## [v0.105.0] - 2021-02-03
-->
### Added
- `ipset` subdomain matching, just like `dnsmasq` does ([#2179]).
- Client ID support for DNS-over-HTTPS, DNS-over-QUIC, and DNS-over-TLS
([#1383]).
- `$dnsrewrite` modifier for filters ([#2102]).
- The host checking API and the query logs API can now return multiple matched
rules ([#2102]).
- Detecting of network interface configured to have static IP address via
`/etc/network/interfaces` ([#2302]).
- DNSCrypt protocol support ([#1361]).
- A 5 second wait period until a DHCP server's network interface gets an IP
address ([#2304]).
- `$dnstype` modifier for filters ([#2337]).
- HTTP API request body size limit ([#2305]).
[#1361]: https://github.com/AdguardTeam/AdGuardHome/issues/1361
[#1383]: https://github.com/AdguardTeam/AdGuardHome/issues/1383
[#2102]: https://github.com/AdguardTeam/AdGuardHome/issues/2102
[#2179]: https://github.com/AdguardTeam/AdGuardHome/issues/2179
[#2302]: https://github.com/AdguardTeam/AdGuardHome/issues/2302
[#2304]: https://github.com/AdguardTeam/AdGuardHome/issues/2304
[#2305]: https://github.com/AdguardTeam/AdGuardHome/issues/2305
[#2337]: https://github.com/AdguardTeam/AdGuardHome/issues/2337
### Changed
- `workDir` now supports symlinks.
- Stopped mounting together the directories `/opt/adguardhome/conf` and
`/opt/adguardhome/work` in our Docker images ([#2589]).
- When `dns.bogus_nxdomain` option is used, the server will now transform
responses if there is at least one bogus address instead of all of them
([#2394]). The new behavior is the same as in `dnsmasq`.
- Post-updating relaunch possibility is now determined OS-dependently ([#2231],
[#2391]).
- Made the mobileconfig HTTP API more robust and predictable, add parameters and
improve error response ([#2358]).
- Improved HTTP requests handling and timeouts ([#2343]).
- Our snap package now uses the `core20` image as its base ([#2306]).
- New build system and various internal improvements ([#2271], [#2276], [#2297],
[#2509], [#2552]).
[#2231]: https://github.com/AdguardTeam/AdGuardHome/issues/2231
[#2271]: https://github.com/AdguardTeam/AdGuardHome/issues/2271
[#2276]: https://github.com/AdguardTeam/AdGuardHome/issues/2276
[#2297]: https://github.com/AdguardTeam/AdGuardHome/issues/2297
[#2306]: https://github.com/AdguardTeam/AdGuardHome/issues/2306
[#2343]: https://github.com/AdguardTeam/AdGuardHome/issues/2343
[#2358]: https://github.com/AdguardTeam/AdGuardHome/issues/2358
[#2391]: https://github.com/AdguardTeam/AdGuardHome/issues/2391
[#2394]: https://github.com/AdguardTeam/AdGuardHome/issues/2394
[#2509]: https://github.com/AdguardTeam/AdGuardHome/issues/2509
[#2552]: https://github.com/AdguardTeam/AdGuardHome/issues/2552
[#2589]: https://github.com/AdguardTeam/AdGuardHome/issues/2589
### Deprecated
- _Go_ 1.14 support. v0.106.0 will require at least _Go_ 1.15 to build.
- The `darwin/386` port. It will be removed in v0.106.0.
- The `"rule"` and `"filter_id"` fields in `GET /filtering/check_host` and
`GET /querylog` responses. They will be removed in v0.106.0 ([#2102]).
### Fixed
- Unnecessary conversions from `string` to `net.IP`, and vice versa ([#2508]).
- Inability to set DNS cache TTL limits ([#2459]).
- Possible freezes on slower machines ([#2225]).
- A mitigation against records being shown in the wrong order on the query log
page ([#2293]).
- A JSON parsing error in query log ([#2345]).
- Incorrect detection of the IPv6 address of an interface as well as another
infinite loop in the `/dhcp/find_active_dhcp` HTTP API ([#2355]).
[#2225]: https://github.com/AdguardTeam/AdGuardHome/issues/2225
[#2293]: https://github.com/AdguardTeam/AdGuardHome/issues/2293
[#2345]: https://github.com/AdguardTeam/AdGuardHome/issues/2345
[#2355]: https://github.com/AdguardTeam/AdGuardHome/issues/2355
[#2459]: https://github.com/AdguardTeam/AdGuardHome/issues/2459
[#2508]: https://github.com/AdguardTeam/AdGuardHome/issues/2508
### Removed
- The undocumented ability to use hostnames as any of `bind_host` values in
configuration. Documentation requires them to be valid IP addresses, and now
the implementation makes sure that that is the case ([#2508]).
- `Dockerfile` ([#2276]). Replaced with the script
`scripts/make/build-docker.sh` which uses `scripts/make/Dockerfile`.
- Support for pre-v0.99.3 format of query logs ([#2102]).
## [v0.104.3] - 2020-11-19
@@ -49,6 +140,10 @@ and this project adheres to
<!--
[Unreleased]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.105.0...HEAD
[v0.105.0]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.104.3...v0.105.0
-->
[Unreleased]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.104.3...HEAD
[v0.104.3]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.104.2...v0.104.3
[v0.104.2]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.104.1...v0.104.2

View File

@@ -1,77 +0,0 @@
FROM --platform=${BUILDPLATFORM:-linux/amd64} tonistiigi/xx:golang AS xgo
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.14-alpine as builder
ARG BUILD_DATE
ARG VCS_REF
ARG VERSION=dev
ARG CHANNEL=release
ENV CGO_ENABLED 0
ENV GO111MODULE on
ENV GOPROXY https://goproxy.io
COPY --from=xgo / /
RUN go env
RUN apk --update --no-cache add \
build-base \
gcc \
git \
npm \
&& rm -rf /tmp/* /var/cache/apk/*
WORKDIR /app
COPY . ./
# Prepare the client code
RUN npm --prefix client ci && npm --prefix client run build-prod
# Download go dependencies
RUN go mod download
RUN go generate ./...
# It's important to place TARGET* arguments here to avoid running npm and go mod download for every platform
ARG TARGETPLATFORM
ARG TARGETOS
ARG TARGETARCH
RUN go build -ldflags="-s -w -X main.version=${VERSION} -X main.channel=${CHANNEL} -X main.goarm=${GOARM}"
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine:latest
ARG BUILD_DATE
ARG VCS_REF
ARG VERSION
ARG CHANNEL
LABEL maintainer="AdGuard Team <devteam@adguard.com>" \
org.opencontainers.image.created=$BUILD_DATE \
org.opencontainers.image.url="https://adguard.com/adguard-home.html" \
org.opencontainers.image.source="https://github.com/AdguardTeam/AdGuardHome" \
org.opencontainers.image.version=$VERSION \
org.opencontainers.image.revision=$VCS_REF \
org.opencontainers.image.vendor="AdGuard" \
org.opencontainers.image.title="AdGuard Home" \
org.opencontainers.image.description="Network-wide ads & trackers blocking DNS server" \
org.opencontainers.image.licenses="GPL-3.0"
RUN apk --update --no-cache add \
ca-certificates \
libcap \
libressl \
&& rm -rf /tmp/* /var/cache/apk/*
COPY --from=builder --chown=nobody:nogroup /app/AdGuardHome /opt/adguardhome/AdGuardHome
COPY --from=builder --chown=nobody:nogroup /usr/local/go/lib/time/zoneinfo.zip /usr/local/go/lib/time/zoneinfo.zip
RUN /opt/adguardhome/AdGuardHome --version \
&& mkdir -p /opt/adguardhome/conf /opt/adguardhome/work \
&& chown -R nobody: /opt/adguardhome \
&& setcap 'cap_net_bind_service=+eip' /opt/adguardhome/AdGuardHome
EXPOSE 53/tcp 53/udp 67/udp 68/udp 80/tcp 443/tcp 853/tcp 3000/tcp
WORKDIR /opt/adguardhome/work
VOLUME ["/opt/adguardhome/conf", "/opt/adguardhome/work"]
ENTRYPOINT ["/opt/adguardhome/AdGuardHome"]
CMD ["-h", "0.0.0.0", "-c", "/opt/adguardhome/conf/AdGuardHome.yaml", "-w", "/opt/adguardhome/work", "--no-check-update"]

View File

@@ -1,10 +1,17 @@
# AdGuardHome Developer Guidelines
# AdGuard Home Developer Guidelines
As of **2020-11-12**, this document is still a work-in-progress. Some of the
rules aren't enforced, and others might change. Still, this is a good place to
find out about how we **want** our code to look like.
As of **December 2020**, this document is partially a work-in-progress, but
should still be followed. Some of the rules aren't enforced as thoroughly or
remain broken in old code, but this is still the place to find out about what we
**want** our code to look like.
## Git
The rules are mostly sorted in the alphabetical order.
## *Git*
* Call your branches either `NNNN-fix-foo` (where `NNNN` is the ID of the
*GitHub* issue you worked on in this branch) or just `fix-foo` if there was
no *GitHub* issue.
* Follow the commit message header format:
@@ -12,43 +19,78 @@ find out about how we **want** our code to look like.
pkg: fix the network error logging issue
```
Where `pkg` is the package where most changes took place. If there are
several such packages, just write `all`.
Where `pkg` is the directory or Go package (without the `internal/` part)
where most changes took place. If there are several such packages, or the
change is top-level only, write `all`.
* Keep your commit messages to be no wider than eighty (**80**) columns.
* Keep your commit messages, including headers, to eighty (**80**) columns.
* Only use lowercase letters in your commit message headers.
* Only use lowercase letters in your commit message headers. The rest of the
message should follow the plain text conventions below.
## Go
The only exceptions are direct mentions of identifiers from the source code
and filenames like `HACKING.md`.
* <https://github.com/golang/go/wiki/CodeReviewComments>.
## *Go*
* <https://github.com/golang/go/wiki/TestComments>.
> Not Golang, not GO, not GOLANG, not GoLang. It is Go in natural language,
> golang for others.
* <https://go-proverbs.github.io/>
— [@rakyll](https://twitter.com/rakyll/status/1229850223184269312)
### Code And Naming
* Avoid `goto`.
* Avoid `init` and use explicit initialization functions instead.
* Avoid `new`, especially with structs.
* Document everything, including unexported top-level identifiers, to build
a habit of writing documentation.
* Check against empty strings like this:
* Don't put variable names into any kind of quotes.
```go
if s == "" {
// …
}
```
* Constructors should validate their arguments and return meaningful errors.
As a corollary, avoid lazy initialization.
* Don't use naked `return`s.
* Don't use underscores in file and package names, unless they're build tags
or for tests. This is to prevent accidental build errors with weird tags.
* Don't write code with more than four (**4**) levels of indentation. Just
like [Linus said], plus an additional level for an occasional error check or
struct initialization.
* Don't write non-test code with more than four (**4**) levels of indentation.
Just like [Linus said], plus an additional level for an occasional error
check or struct initialization.
The exception proving the rule is the table-driven test code, where an
additional level of indentation is allowed.
* Eschew external dependencies, including transitive, unless
absolutely necessary.
* No `goto`.
* Name benchmarks and tests using the same convention as examples. For
example:
```go
func TestFunction(t *testing.T) { /* … */ }
func TestFunction_suffix(t *testing.T) { /* … */ }
func TestType_Method(t *testing.T) { /* … */ }
func TestType_Method_suffix(t *testing.T) { /* … */ }
```
* Name parameters in interface definitions:
```go
type Frobulator interface {
Frobulate(f Foo, b Bar) (r Result, err error)
}
```
* Name the deferred errors (e.g. when closing something) `cerr`.
* No shadowing, since it can often lead to subtle bugs, especially with
errors.
@@ -56,29 +98,64 @@ find out about how we **want** our code to look like.
* Prefer constants to variables where possible. Reduce global variables. Use
[constant errors] instead of `errors.New`.
* Put comments above the documented entity, **not** to the side, to improve
readability.
* Program code lines should not be longer than one hundred (**100**) columns.
For comments, see the text section below.
* Use `gofumpt --extra -s`.
* Unused arguments in anonymous functions must be called `_`:
**TODO(a.garipov):** Add to the linters.
```go
v.onSuccess = func(_ int, msg string) {
// …
}
```
* Use linters.
* Use named returns to improve readability of function signatures.
* Write logs and error messages in lowercase only to make it easier to `grep`
logs and error messages without using the `-i` flag.
[constant errors]: https://dave.cheney.net/2016/04/07/constant-errors
[Linus said]: https://www.kernel.org/doc/html/v4.17/process/coding-style.html#indentation
### Commenting
* See also the *Text, Including Comments* section below.
* Document everything, including unexported top-level identifiers, to build
a habit of writing documentation.
* Don't put identifiers into any kind of quotes.
* Put comments above the documented entity, **not** to the side, to improve
readability.
* When a method implements an interface, start the doc comment with the
standard template:
```go
// Foo implements the Fooer interface for *foo.
func (f *foo) Foo() {
// …
// …
}
```
* Write logs and error messages in lowercase only to make it easier to `grep`
logs and error messages without using the `-i` flag.
When the implemented interface is unexported:
```go
// Unwrap implements the hidden wrapper interface for *fooError.
func (err *fooError) Unwrap() (unwrapped error) {
// …
}
```
### Formatting
* Add an empty line before `break`, `continue`, `fallthrough`, and `return`,
unless it's the only statement in that block.
* Use `gofumpt --extra -s`.
* Write slices of struct like this:
@@ -95,11 +172,69 @@ find out about how we **want** our code to look like.
}}
```
[constant errors]: https://dave.cheney.net/2016/04/07/constant-errors
[Linus said]: https://www.kernel.org/doc/html/v4.17/process/coding-style.html#indentation
### Recommended Reading
* <https://github.com/golang/go/wiki/CodeReviewComments>.
* <https://github.com/golang/go/wiki/TestComments>.
* <https://go-proverbs.github.io/>
## *Markdown*
* **TODO(a.garipov):** Define our *Markdown* conventions.
## Shell Scripting
* Avoid bashisms and GNUisms, prefer *POSIX* features only.
* Prefer `'raw strings'` to `"double quoted strings"` whenever possible.
* Put spaces within `$( cmd )`, `$(( expr ))`, and `{ cmd; }`.
* Put utility flags in the ASCII order and **don't** group them together. For
example, `ls -1 -A -q`.
* `snake_case`, not `camelCase` for variables. `kebab-case` for filenames.
* UPPERCASE names for external exported variables, lowercase for local,
unexported ones.
* Use `set -e -f -u` and also `set -x` in verbose mode.
* Use `readonly` liberally.
* Use the `"$var"` form instead of the `$var` form, unless word splitting is
required.
* When concatenating, always use the form with curly braces to prevent
accidental bad variable names. That is, `"${var}_tmp.txt"` and **not**
`"$var_tmp.txt"`. The latter will try to lookup variable `var_tmp`.
* When concatenating, surround the whole string with quotes. That is, use
this:
```sh
dir="${TOP_DIR}/sub"
```
And **not** this:
```sh
# Bad!
dir="${TOP_DIR}"/sub
```
## Text, Including Comments
* End sentences with appropriate punctuation.
* Headers should be written with all initial letters capitalized, except for
references to variable names that start with a lowercase letter.
* Start sentences with a capital letter, unless the first word is a reference
to a variable name that starts with a lowercase letter.
* Text should wrap at eighty (**80**) columns to be more readable, to use
a common standard, and to allow editing or diffing side-by-side without
wrapping.
@@ -111,7 +246,7 @@ find out about how we **want** our code to look like.
* Use double spacing between sentences to make sentence borders more clear.
* Use the serial comma (a.k.a. Oxford comma) to improve comprehension,
* Use the serial comma (a.k.a. *Oxford* comma) to improve comprehension,
decrease ambiguity, and use a common standard.
* Write todos like this:
@@ -126,17 +261,17 @@ find out about how we **want** our code to look like.
// TODO(usr1, usr2): Fix the frobulation issue.
```
## Markdown
## *YAML*
* **TODO(a.garipov):** Define our Markdown conventions.
* **TODO(a.garipov):** Define naming conventions for schema names in our
*OpenAPI* *YAML* file. And just generally OpenAPI conventions.
## YAML
* **TODO(a.garipov):** Find a *YAML* formatter or write our own.
* **TODO(a.garipov):** Find a YAML formatter or write our own.
* All strings, including keys, must be quoted. Reason: the [*NO-rway Law*].
* All strings, including keys, must be quoted. Reason: the [NO-rway Law].
* Indent with two (**2**) spaces.
* Indent with two (**2**) spaces. *YAML* documents can get pretty
deeply-nested.
* No extra indentation in multiline arrays:
@@ -147,7 +282,10 @@ find out about how we **want** our code to look like.
- 'value-3'
```
* Prefer single quotes for string to prevent accidental escaping, unless
escaping is required.
* Prefer single quotes for strings to prevent accidental escaping, unless
escaping is required or there are single quotes inside the string (e.g. for
*GitHub Actions*).
[NO-rway Law]: https://news.ycombinator.com/item?id=17359376
* Use `>` for multiline strings, unless you need to keep the line breaks.
[*NO-rway Law*]: https://news.ycombinator.com/item?id=17359376

413
Makefile
View File

@@ -1,348 +1,103 @@
# Keep the Makefile POSIX-compliant. We currently allow hyphens in
# target names, but that may change in the future.
#
# Available targets
# See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html.
.POSIX:
CHANNEL = development
CLIENT_BETA_DIR = client2
CLIENT_DIR = client
COMMIT = $$(git rev-parse --short HEAD)
DIST_DIR = dist
GO = go
# TODO(a.garipov): Add more default proxies using pipes after update to
# Go 1.15.
#
# * build -- builds AdGuardHome for the current platform
# * client -- builds client-side code of AdGuard Home
# * client-watch -- builds client-side code of AdGuard Home and watches for changes there
# * docker -- builds a docker image for the current platform
# * clean -- clean everything created by previous builds
# * lint -- run all linters
# * test -- run all unit-tests
# * dependencies -- installs dependencies (go and npm modules)
# * ci -- installs dependencies, runs linters and tests, intended to be used by CI/CD
#
# Building releases:
#
# * release -- builds AdGuard Home distros. CHANNEL must be specified (edge, release or beta).
# * release_and_sign -- builds AdGuard Home distros and signs the binary files.
# CHANNEL must be specified (edge, release or beta).
# * sign -- Repacks all release archive files and signs the binary files inside them.
# For signing to work, the public+private key pair for $(GPG_KEY) must be imported:
# gpg --import public.txt
# gpg --import private.txt
# GPG_KEY_PASSPHRASE must contain the GPG key passphrase
# * docker-multi-arch -- builds a multi-arch image. If you want it to be pushed to docker hub,
# you must specify:
# * DOCKER_IMAGE_NAME - adguard/adguard-home
# * DOCKER_OUTPUT - type=image,name=adguard/adguard-home,push=true
# GOPROXY = https://goproxy.io|https://goproxy.cn|direct
GOPROXY = https://goproxy.cn,https://goproxy.io,direct
GPG_KEY = devteam@adguard.com
GPG_KEY_PASSPHRASE = not-a-real-password
NPM = npm
NPM_FLAGS = --prefix $(CLIENT_DIR)
SIGN = 1
VERBOSE = 0
VERSION = v0.0.0
YARN = yarn
YARN_FLAGS = --cwd $(CLIENT_BETA_DIR)
GOPATH := $(shell go env GOPATH)
PWD := $(shell pwd)
TARGET=AdGuardHome
BASE_URL="https://static.adguard.com/adguardhome/$(CHANNEL)"
GPG_KEY := devteam@adguard.com
GPG_KEY_PASSPHRASE :=
GPG_CMD := gpg --detach-sig --default-key $(GPG_KEY) --pinentry-mode loopback --passphrase $(GPG_KEY_PASSPHRASE)
ENV = env\
COMMIT='$(COMMIT)'\
CHANNEL='$(CHANNEL)'\
GPG_KEY='$(GPG_KEY)'\
GPG_KEY_PASSPHRASE='$(GPG_KEY_PASSPHRASE)'\
DIST_DIR='$(DIST_DIR)'\
GO='$(GO)'\
GOPROXY='$(GOPROXY)'\
PATH="$${PWD}/bin:$$($(GO) env GOPATH)/bin:$${PATH}"\
SIGN='$(SIGN)'\
VERBOSE='$(VERBOSE)'\
VERSION='$(VERSION)'\
# See release target
DIST_DIR=dist
# Keep the line above blank.
# Update channel. Can be release, beta or edge. Uses edge by default.
CHANNEL ?= edge
# Keep this target first, so that a naked make invocation triggers
# a full build.
build: deps quick-build
# Validate channel
ifneq ($(CHANNEL),release)
ifneq ($(CHANNEL),beta)
ifneq ($(CHANNEL),edge)
$(error CHANNEL value is not valid. Valid values are release,beta or edge)
endif
endif
endif
quick-build: js-build go-build
# Version history URL (see
VERSION_HISTORY_URL="https://github.com/AdguardTeam/AdGuardHome/releases"
ifeq ($(CHANNEL),edge)
VERSION_HISTORY_URL="https://github.com/AdguardTeam/AdGuardHome/commits/master"
endif
ci: deps test
# goreleaser command depends on the $CHANNEL
GORELEASER_COMMAND=goreleaser release --rm-dist --skip-publish --snapshot --parallelism 1
ifneq ($(CHANNEL),edge)
# If this is not an "edge" build, use normal release command
GORELEASER_COMMAND=goreleaser release --rm-dist --skip-publish --parallelism 1
endif
deps: js-deps go-deps
lint: js-lint go-lint
test: js-test go-test
# Version properties
COMMIT=$(shell git rev-parse --short HEAD)
TAG_NAME=$(shell git describe --abbrev=0)
RELEASE_VERSION=$(TAG_NAME)
SNAPSHOT_VERSION=$(RELEASE_VERSION)-SNAPSHOT-$(COMMIT)
# Here and below, keep $(SHELL) in quotes, because on Windows this will
# expand to something like "C:/Program Files/Git/usr/bin/sh.exe".
build-docker: ; $(ENV) "$(SHELL)" ./scripts/make/build-docker.sh
# Set proper version
VERSION=
ifeq ($(TAG_NAME),$(shell git describe --abbrev=4))
ifeq ($(CHANNEL),edge)
VERSION=$(SNAPSHOT_VERSION)
else
VERSION=$(RELEASE_VERSION)
endif
else
VERSION=$(SNAPSHOT_VERSION)
endif
build-release: deps js-build
$(ENV) "$(SHELL)" ./scripts/make/build-release.sh
# Docker target parameters
DOCKER_IMAGE_NAME ?= adguardhome-dev
DOCKER_IMAGE_FULL_NAME = $(DOCKER_IMAGE_NAME):$(VERSION)
DOCKER_PLATFORMS=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le
DOCKER_OUTPUT ?= type=image,name=$(DOCKER_IMAGE_NAME),push=false
BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
clean: ; $(ENV) "$(SHELL)" ./scripts/make/clean.sh
init: ; git config core.hooksPath ./scripts/hooks
# Docker tags (can be redefined)
DOCKER_TAGS ?=
ifndef DOCKER_TAGS
ifeq ($(CHANNEL),release)
DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):latest
endif
ifeq ($(CHANNEL),beta)
DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):beta
endif
ifeq ($(CHANNEL),edge)
# Don't set the version tag when pushing to "edge"
DOCKER_IMAGE_FULL_NAME := $(DOCKER_IMAGE_NAME):edge
# DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):edge
endif
endif
js-build:
$(NPM) $(NPM_FLAGS) run build-prod
$(YARN) $(YARN_FLAGS) build
js-deps:
$(NPM) $(NPM_FLAGS) ci
$(YARN) $(YARN_FLAGS) install
# Validate docker build arguments
ifndef DOCKER_IMAGE_NAME
$(error DOCKER_IMAGE_NAME value is not set)
endif
# TODO(a.garipov): Remove the legacy client tasks support once the new
# client is done and the old one is removed.
js-lint: ; $(NPM) $(NPM_FLAGS) run lint
js-test: ; $(NPM) $(NPM_FLAGS) run test
js-beta-lint: ; $(YARN) $(YARN_FLAGS) lint
js-beta-test: ; # TODO(v.abdulmyanov): Add tests for the new client.
# OS-specific flags
TEST_FLAGS := --race -v
ifeq ($(OS),Windows_NT)
TEST_FLAGS :=
endif
go-build: ; $(ENV) "$(SHELL)" ./scripts/make/go-build.sh
go-deps: ; $(ENV) "$(SHELL)" ./scripts/make/go-deps.sh
go-lint: ; $(ENV) "$(SHELL)" ./scripts/make/go-lint.sh
go-test: ; $(ENV) "$(SHELL)" ./scripts/make/go-test.sh
go-tools: ; $(ENV) "$(SHELL)" ./scripts/make/go-tools.sh
.PHONY: all build client client-watch docker lint lint-js lint-go test dependencies clean release docker-multi-arch
all: build
go-check: go-tools go-lint go-test
init:
git config core.hooksPath .githooks
build: client_with_deps
go mod download
PATH=$(GOPATH)/bin:$(PATH) go generate ./...
CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=$(VERSION) -X main.channel=$(CHANNEL) -X main.goarm=$(GOARM)"
PATH=$(GOPATH)/bin:$(PATH) packr clean
client:
npm --prefix client run build-prod
client_with_deps:
npm --prefix client ci
npm --prefix client run build-prod
client-watch:
npm --prefix client run watch
docker:
DOCKER_CLI_EXPERIMENTAL=enabled \
docker buildx build \
--build-arg VERSION=$(VERSION) \
--build-arg CHANNEL=$(CHANNEL) \
--build-arg VCS_REF=$(COMMIT) \
--build-arg BUILD_DATE=$(BUILD_DATE) \
$(DOCKER_TAGS) \
--load \
-t "$(DOCKER_IMAGE_NAME)" -f ./Dockerfile .
@echo Now you can run the docker image:
@echo docker run --name "adguard-home" -p 53:53/tcp -p 53:53/udp -p 80:80/tcp -p 443:443/tcp -p 853:853/tcp -p 3000:3000/tcp $(DOCKER_IMAGE_NAME)
lint: lint-js lint-go
lint-js: dependencies
@echo Running js linter
npm --prefix client run lint
lint-go:
@echo Running go linter
golangci-lint run
test: test-js test-go
test-js:
npm run test --prefix client
test-go:
go test $(TEST_FLAGS) --coverprofile coverage.txt ./...
ci: client_with_deps
go mod download
$(MAKE) test
openapi-lint: ; cd ./openapi/ && $(YARN) test
openapi-show: ; cd ./openapi/ && $(YARN) start
# TODO(a.garipov): Remove the legacy targets once the build
# infrastructure stops using them.
dependencies:
npm --prefix client ci
go mod download
clean:
# make build output
rm -f AdGuardHome
rm -f AdGuardHome.exe
# tests output
rm -rf data
rm -f coverage.txt
# static build output
rm -rf build
# dist folder
rm -rf $(DIST_DIR)
# client deps
rm -rf client/node_modules
# packr-generated files
PATH=$(GOPATH)/bin:$(PATH) packr clean || true
@ echo "use make deps instead"
@ $(MAKE) deps
docker-multi-arch:
DOCKER_CLI_EXPERIMENTAL=enabled \
docker buildx build \
--platform $(DOCKER_PLATFORMS) \
--build-arg VERSION=$(VERSION) \
--build-arg CHANNEL=$(CHANNEL) \
--build-arg VCS_REF=$(COMMIT) \
--build-arg BUILD_DATE=$(BUILD_DATE) \
$(DOCKER_TAGS) \
--output "$(DOCKER_OUTPUT)" \
-t "$(DOCKER_IMAGE_FULL_NAME)" -f ./Dockerfile .
@echo If the image was pushed to the registry, you can now run it:
@echo docker run --name "adguard-home" -p 53:53/tcp -p 53:53/udp -p 80:80/tcp -p 443:443/tcp -p 853:853/tcp -p 3000:3000/tcp $(DOCKER_IMAGE_NAME)
release: client_with_deps
go mod download
@echo Starting release build: version $(VERSION), channel $(CHANNEL)
CHANNEL=$(CHANNEL) $(GORELEASER_COMMAND)
$(call write_version_file,$(VERSION))
PATH=$(GOPATH)/bin:$(PATH) packr clean
release_and_sign: client_with_deps
$(MAKE) release
$(call repack_dist)
sign:
$(call repack_dist)
define write_version_file
$(eval version := $(1))
@echo Writing version file: $(version)
# Variables for CI
rm -f $(DIST_DIR)/version.txt
echo "version=$(version)" > $(DIST_DIR)/version.txt
# Prepare the version.json file
rm -f $(DIST_DIR)/version.json
echo "{" >> $(DIST_DIR)/version.json
echo " \"version\": \"$(version)\"," >> $(DIST_DIR)/version.json
echo " \"announcement\": \"AdGuard Home $(version) is now available!\"," >> $(DIST_DIR)/version.json
echo " \"announcement_url\": \"$(VERSION_HISTORY_URL)\"," >> $(DIST_DIR)/version.json
echo " \"selfupdate_min_version\": \"0.0\"," >> $(DIST_DIR)/version.json
# Windows builds
echo " \"download_windows_amd64\": \"$(BASE_URL)/AdGuardHome_windows_amd64.zip\"," >> $(DIST_DIR)/version.json
echo " \"download_windows_386\": \"$(BASE_URL)/AdGuardHome_windows_386.zip\"," >> $(DIST_DIR)/version.json
# MacOS builds
echo " \"download_darwin_amd64\": \"$(BASE_URL)/AdGuardHome_darwin_amd64.zip\"," >> $(DIST_DIR)/version.json
echo " \"download_darwin_386\": \"$(BASE_URL)/AdGuardHome_darwin_386.zip\"," >> $(DIST_DIR)/version.json
# Linux
echo " \"download_linux_amd64\": \"$(BASE_URL)/AdGuardHome_linux_amd64.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_386\": \"$(BASE_URL)/AdGuardHome_linux_386.tar.gz\"," >> $(DIST_DIR)/version.json
# Linux, all kinds of ARM
echo " \"download_linux_arm\": \"$(BASE_URL)/AdGuardHome_linux_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv5\": \"$(BASE_URL)/AdGuardHome_linux_armv5.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv6\": \"$(BASE_URL)/AdGuardHome_linux_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv7\": \"$(BASE_URL)/AdGuardHome_linux_armv7.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_arm64\": \"$(BASE_URL)/AdGuardHome_linux_arm64.tar.gz\"," >> $(DIST_DIR)/version.json
# Linux, MIPS
echo " \"download_linux_mips\": \"$(BASE_URL)/AdGuardHome_linux_mips_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mipsle\": \"$(BASE_URL)/AdGuardHome_linux_mipsle_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mips64\": \"$(BASE_URL)/AdGuardHome_linux_mips64_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mips64le\": \"$(BASE_URL)/AdGuardHome_linux_mips64le_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
# FreeBSD
echo " \"download_freebsd_386\": \"$(BASE_URL)/AdGuardHome_freebsd_386.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_amd64\": \"$(BASE_URL)/AdGuardHome_freebsd_amd64.tar.gz\"," >> $(DIST_DIR)/version.json
# FreeBSD, all kinds of ARM
echo " \"download_freebsd_arm\": \"$(BASE_URL)/AdGuardHome_freebsd_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv5\": \"$(BASE_URL)/AdGuardHome_freebsd_armv5.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv6\": \"$(BASE_URL)/AdGuardHome_freebsd_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv7\": \"$(BASE_URL)/AdGuardHome_freebsd_armv7.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_arm64\": \"$(BASE_URL)/AdGuardHome_freebsd_arm64.tar.gz\"" >> $(DIST_DIR)/version.json
# Finish
echo "}" >> $(DIST_DIR)/version.json
endef
define repack_dist
# Repack archive files
# A temporary solution for our auto-update code to be able to unpack these archive files
# The problem is that goreleaser doesn't add directory AdGuardHome/ to the archive file
# and we can't create it
rm -rf $(DIST_DIR)/AdGuardHome
# Windows builds
$(call zip_repack_windows,AdGuardHome_windows_amd64.zip)
$(call zip_repack_windows,AdGuardHome_windows_386.zip)
# MacOS builds
$(call zip_repack,AdGuardHome_darwin_amd64.zip)
$(call zip_repack,AdGuardHome_darwin_386.zip)
# Linux
$(call tar_repack,AdGuardHome_linux_amd64.tar.gz)
$(call tar_repack,AdGuardHome_linux_386.tar.gz)
# Linux, all kinds of ARM
$(call tar_repack,AdGuardHome_linux_armv5.tar.gz)
$(call tar_repack,AdGuardHome_linux_armv6.tar.gz)
$(call tar_repack,AdGuardHome_linux_armv7.tar.gz)
$(call tar_repack,AdGuardHome_linux_arm64.tar.gz)
# Linux, MIPS
$(call tar_repack,AdGuardHome_linux_mips_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mipsle_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mips64_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mips64le_softfloat.tar.gz)
# FreeBSD
$(call tar_repack,AdGuardHome_freebsd_386.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_amd64.tar.gz)
# FreeBSD, all kinds of ARM
$(call tar_repack,AdGuardHome_freebsd_armv5.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_armv6.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_armv7.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_arm64.tar.gz)
endef
define zip_repack_windows
$(eval ARC := $(1))
cd $(DIST_DIR) && \
unzip $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome.exe && \
zip -r $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
define zip_repack
$(eval ARC := $(1))
cd $(DIST_DIR) && \
unzip $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome && \
zip -r $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
define tar_repack
$(eval ARC := $(1))
cd $(DIST_DIR) && \
tar xzf $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome && \
tar czf $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
@ echo "use make build-docker instead"
@ $(MAKE) build-docker
go-install-tools:
@ echo "use make go-tools instead"
@ $(MAKE) go-tools
release:
@ echo "use make build-release instead"
@ $(MAKE) build-release

View File

@@ -45,7 +45,7 @@
AdGuard Home is a network-wide software for blocking ads & tracking. After you set it up, it'll cover ALL your home devices, and you don't need any client-side software for that.
It operates as a DNS server that re-routes tracking domains to a "black hole," thus preventing your devices from connecting to those servers. It's based on software we use for our public [AdGuard DNS](https://adguard.com/en/adguard-dns/overview.html) servers -- both share a lot of common code.
It operates as a DNS server that re-routes tracking domains to a "black hole", thus preventing your devices from connecting to those servers. It's based on software we use for our public [AdGuard DNS](https://adguard.com/en/adguard-dns/overview.html) servers -- both share a lot of common code.
* [Getting Started](#getting-started)
* [Comparing AdGuard Home to other solutions](#comparison)
@@ -58,7 +58,7 @@ It operates as a DNS server that re-routes tracking domains to a "black hole," t
* [Reporting issues](#reporting-issues)
* [Help with translations](#translate)
* [Other](#help-other)
* [Projects that use AdGuardHome](#uses)
* [Projects that use AdGuard Home](#uses)
* [Acknowledgments](#acknowledgments)
* [Privacy](#privacy)
@@ -87,12 +87,21 @@ If you're running **Linux**, there's a secure and easy way to install AdGuard Ho
### Guides
* [FAQ](https://github.com/AdguardTeam/AdGuardHome/wiki/FAQ)
* [Configuration](https://github.com/AdguardTeam/AdGuardHome/wiki/Configuration)
* [AdGuard Home as a DNS-over-HTTPS or DNS-over-TLS server](https://github.com/AdguardTeam/AdGuardHome/wiki/Encryption)
* [How to install and run AdGuard Home on Raspberry Pi](https://github.com/AdguardTeam/AdGuardHome/wiki/Raspberry-Pi)
* [How to install and run AdGuard Home on a Virtual Private Server](https://github.com/AdguardTeam/AdGuardHome/wiki/VPS)
* [How to write your own hosts blocklists properly](https://github.com/AdguardTeam/AdGuardHome/wiki/Hosts-Blocklists)
* [Getting Started](https://github.com/AdguardTeam/AdGuardHome/wiki/Getting-Started)
* [FAQ](https://github.com/AdguardTeam/AdGuardHome/wiki/FAQ)
* [How to Write Hosts Blocklists](https://github.com/AdguardTeam/AdGuardHome/wiki/Hosts-Blocklists)
* [Comparing AdGuard Home to Other Solutions](https://github.com/AdguardTeam/AdGuardHome/wiki/Comparison)
* Configuring AdGuard
* [Configuration](https://github.com/AdguardTeam/AdGuardHome/wiki/Configuration)
* [Configuring AdGuard Home Clients](https://github.com/AdguardTeam/AdGuardHome/wiki/Clients)
* [AdGuard Home as a DoH, DoT, or DoQ Server](https://github.com/AdguardTeam/AdGuardHome/wiki/Encryption)
* [AdGuard Home as a DNSCrypt Server](https://github.com/AdguardTeam/AdGuardHome/wiki/DNSCrypt)
* [AdGuard Home as a DHCP Server](https://github.com/AdguardTeam/AdGuardHome/wiki/DHCP)
* Installing AdGuard Home
* [Docker](https://github.com/AdguardTeam/AdGuardHome/wiki/Docker)
* [How to Install and Run AdGuard Home on a Raspberry Pi](https://github.com/AdguardTeam/AdGuardHome/wiki/Raspberry-Pi)
* [How to Install and Run AdGuard Home on a Virtual Private Server](https://github.com/AdguardTeam/AdGuardHome/wiki/VPS)
* [Verifying Releases](https://github.com/AdguardTeam/AdGuardHome/wiki/Verify-Releases)
### API
@@ -123,20 +132,21 @@ AdGuard Home provides a lot of features out-of-the-box with no need to install a
> Disclaimer: some of the listed features can be added to Pi-Hole by installing additional software or by manually using SSH terminal and reconfiguring one of the utilities Pi-Hole consists of. However, in our opinion, this cannot be legitimately counted as a Pi-Hole's feature.
| Feature | AdGuard&nbsp;Home | Pi-Hole |
|-------------------------------------------------------------------------|--------------|--------------------------------------------------------|
| Blocking ads and trackers | ✅ | ✅ |
| Customizing blocklists | ✅ | ✅ |
| Built-in DHCP server | ✅ | ✅ |
| HTTPS for the Admin interface | ✅ | Kind of, but you'll need to manually configure lighthttpd |
| Encrypted DNS upstream servers (DNS-over-HTTPS, DNS-over-TLS, DNSCrypt) | ✅ | ❌ (requires additional software) |
| Cross-platform | ✅ | ❌ (not natively, only via Docker) |
| Running as a DNS-over-HTTPS or DNS-over-TLS server | ✅ | ❌ (requires additional software) |
| Blocking phishing and malware domains | ✅ | ❌ (requires non-default blocklists) |
| Parental control (blocking adult domains) | ✅ | ❌ |
| Force Safe search on search engines | ✅ | ❌ |
| Per-client (device) configuration | ✅ | ✅ |
| Access settings (choose who can use AGH DNS) | ✅ | ❌ |
| Feature | AdGuard&nbsp;Home | Pi-Hole |
|-------------------------------------------------------------------------|-------------------|-----------------------------------------------------------|
| Blocking ads and trackers | ✅ | ✅ |
| Customizing blocklists | ✅ | ✅ |
| Built-in DHCP server | ✅ | ✅ |
| HTTPS for the Admin interface | ✅ | Kind of, but you'll need to manually configure lighthttpd |
| Encrypted DNS upstream servers (DNS-over-HTTPS, DNS-over-TLS, DNSCrypt) | ✅ | ❌ (requires additional software) |
| Cross-platform | ✅ | ❌ (not natively, only via Docker) |
| Running as a DNS-over-HTTPS or DNS-over-TLS server | ✅ | ❌ (requires additional software) |
| Blocking phishing and malware domains | ✅ | ❌ (requires non-default blocklists) |
| Parental control (blocking adult domains) | ✅ | ❌ |
| Force Safe search on search engines | ✅ | ❌ |
| Per-client (device) configuration | ✅ | ✅ |
| Access settings (choose who can use AGH DNS) | ✅ | ❌ |
| Running [without root privileges](https://github.com/AdguardTeam/AdGuardHome/wiki/Getting-Started#running-without-superuser) | ✅ | ❌ |
<a id="comparison-adblock"></a>
### How does AdGuard Home compare to traditional ad blockers
@@ -169,11 +179,9 @@ You will need this to build AdGuard Home:
* [go](https://golang.org/dl/) v1.14 or later.
* [node.js](https://nodejs.org/en/download/) v10.16.2 or later.
* [npm](https://www.npmjs.com/) v6.14 or later.
* [npm](https://www.npmjs.com/) v6.14 or later (temporary requirement, TODO: remove when redesign is finished).
* [yarn](https://yarnpkg.com/) v1.22.5 or later.
Optionally, for Go devs:
* [golangci-lint](https://github.com/golangci/golangci-lint)
### Building
Open Terminal and execute these commands:
@@ -186,31 +194,33 @@ make
Check the [`Makefile`](https://github.com/AdguardTeam/AdGuardHome/blob/master/Makefile) to learn about other commands.
**Building for a different platform.** You can build AdGuard for any OS/ARCH just like any other Golang project.
**Building for a different platform.** You can build AdGuard for any OS/ARCH just like any other Go project.
In order to do this, specify `GOOS` and `GOARCH` env variables before running make.
For example:
```
GOOS=linux GOARCH=arm64 make
env GOOS='linux' GOARCH='arm64' make
```
Or:
```
make GOOS='linux' GOARCH='arm64'
```
#### Preparing release
You'll need this to prepare a release build:
* [goreleaser](https://goreleaser.com/)
* [snapcraft](https://snapcraft.io/)
Commands:
* `make release` - builds a snapshot build (CHANNEL=edge)
* `CHANNEL=beta make release` - builds beta version, tag is mandatory.
* `CHANNEL=release make release` - builds release version, tag is mandatory.
```
make build-release CHANNEL='...' VERSION='...'
```
#### Docker image
* Run `make docker` to build the Docker image locally.
* Run `make docker-multi-arch` to build the multi-arch Docker image (the one that we publish to Docker Hub).
* Run `make build-docker` to build the Docker image locally (the one that we publish to DockerHub).
Please note, that we're using [Docker Buildx](https://docs.docker.com/buildx/working-with-buildx/) to build our official image.
@@ -258,7 +268,7 @@ curl -sSL https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scrip
* Beta channel builds
* Linux: [64-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_amd64.tar.gz), [32-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_386.tar.gz)
* Linux ARM: [32-bit ARMv6](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_armv6.tar.gz) (recommended for Rapsberry Pi), [64-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_arm64.tar.gz), [32-bit ARMv5](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_armv5.tar.gz), [32-bit ARMv7](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_armv7.tar.gz)
* Linux ARM: [32-bit ARMv6](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_armv6.tar.gz) (recommended for Raspberry Pi), [64-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_arm64.tar.gz), [32-bit ARMv5](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_armv5.tar.gz), [32-bit ARMv7](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_armv7.tar.gz)
* Linux MIPS: [32-bit MIPS](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_mips_softfloat.tar.gz), [32-bit MIPSLE](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_mipsle_softfloat.tar.gz), [64-bit MIPS](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_mips64_softfloat.tar.gz), [64-bit MIPSLE](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_mips64le_softfloat.tar.gz)
* Windows: [64-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_windows_amd64.zip), [32-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_windows_386.zip)
* MacOS: [64-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_darwin_amd64.zip), [32-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_darwin_386.zip)
@@ -267,7 +277,7 @@ curl -sSL https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scrip
* Edge channel builds
* Linux: [64-bit](https://static.adguard.com/adguardhome/edge/AdGuardHome_linux_amd64.tar.gz), [32-bit](https://static.adguard.com/adguardhome/edge/AdGuardHome_linux_386.tar.gz)
* Linux ARM: [32-bit ARMv6](https://static.adguard.com/adguardhome/edge/AdGuardHome_linux_armv6.tar.gz) (recommended for Rapsberry Pi), [64-bit](https://static.adguard.com/adguardhome/edge/AdGuardHome_linux_arm64.tar.gz), [32-bit ARMv5](https://static.adguard.com/adguardhome/edge/AdGuardHome_linux_armv5.tar.gz), [32-bit ARMv7](https://static.adguard.com/adguardhome/edge/AdGuardHome_linux_armv7.tar.gz)
* Linux ARM: [32-bit ARMv6](https://static.adguard.com/adguardhome/edge/AdGuardHome_linux_armv6.tar.gz) (recommended for Raspberry Pi), [64-bit](https://static.adguard.com/adguardhome/edge/AdGuardHome_linux_arm64.tar.gz), [32-bit ARMv5](https://static.adguard.com/adguardhome/edge/AdGuardHome_linux_armv5.tar.gz), [32-bit ARMv7](https://static.adguard.com/adguardhome/edge/AdGuardHome_linux_armv7.tar.gz)
* Linux MIPS: [32-bit MIPS](https://static.adguard.com/adguardhome/edge/AdGuardHome_linux_mips_softfloat.tar.gz), [32-bit MIPSLE](https://static.adguard.com/adguardhome/edge/AdGuardHome_linux_mipsle_softfloat.tar.gz), [64-bit MIPS](https://static.adguard.com/adguardhome/edge/AdGuardHome_linux_mips64_softfloat.tar.gz), [64-bit MIPSLE](https://static.adguard.com/adguardhome/edge/AdGuardHome_linux_mips64le_softfloat.tar.gz)
* Windows: [64-bit](https://static.adguard.com/adguardhome/edge/AdGuardHome_windows_amd64.zip), [32-bit](https://static.adguard.com/adguardhome/edge/AdGuardHome_windows_386.zip)
* MacOS: [64-bit](https://static.adguard.com/adguardhome/edge/AdGuardHome_darwin_amd64.zip), [32-bit](https://static.adguard.com/adguardhome/edge/AdGuardHome_darwin_386.zip)
@@ -298,12 +308,12 @@ Here's what you can also do to contribute:
4. Actualize the list of vetted *blocklists*. It it can be found in [client/src/helpers/filters/filters.json](https://github.com/AdguardTeam/AdGuardHome/blob/master/client/src/helpers/filters/filters.json).
<a id="uses"></a>
## Projects that use AdGuardHome
## Projects that use AdGuard Home
* Python library (https://github.com/frenck/python-adguardhome)
* Hass.io add-on (https://github.com/hassio-addons/addon-adguard-home)
* OpenWrt LUCI app (https://github.com/rufengsuixing/luci-app-adguardhome)
* OpenWrt LUCI app (https://github.com/kongfl888/luci-app-adguardhome)
* Prometheus exporter for AdGuard Home (https://github.com/ebrianne/adguard-exporter)
<a id="acknowledgments"></a>
## Acknowledgments
@@ -324,11 +334,11 @@ This software wouldn't have been possible without:
* And many more node.js packages.
* [whotracks.me data](https://github.com/cliqz-oss/whotracks.me)
You might have seen that [CoreDNS](https://coredns.io) was mentioned here before — we've stopped using it in AdGuardHome. While we still use it on our servers for [AdGuard DNS](https://adguard.com/adguard-dns/overview.html) service, it seemed like an overkill for Home as it impeded with Home features that we plan to implement.
You might have seen that [CoreDNS](https://coredns.io) was mentioned here before — we've stopped using it in AdGuard Home. While we still use it on our servers for [AdGuard DNS](https://adguard.com/adguard-dns/overview.html) service, it seemed like an overkill for Home as it impeded with Home features that we plan to implement.
For a full list of all node.js packages in use, please take a look at [client/package.json](https://github.com/AdguardTeam/AdGuardHome/blob/master/client/package.json) file.
<a id="privacy"></a>
## Privacy
Our main idea is that you are the one, who should be in control of your data. So it is only natural, that AdGuard Home does not collect any usage statistics, and does not use any web services unless you configure it to do so. Full policy with every bit that _could in theory be_ sent by AdGuard Home is available [here](https://adguard.com/en/privacy/home.html).
Our main idea is that you are the one, who should be in control of your data. So it is only natural, that AdGuard Home does not collect any usage statistics, and does not use any web services unless you configure it to do so. Full policy with every bit that _could in theory be_ sent by AdGuard Home is available [here](https://adguard.com/en/privacy/home.html).

12
client/package-lock.json generated vendored
View File

@@ -3066,12 +3066,6 @@
"pkg-up": "^2.0.0"
}
},
"caniuse-lite": {
"version": "1.0.30001062",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001062.tgz",
"integrity": "sha512-ei9ZqeOnN7edDrb24QfJ0OZicpEbsWxv7WusOiQGz/f2SfvBgHHbOEwBJ8HKGVSyx8Z6ndPjxzR6m0NQq+0bfw==",
"dev": true
},
"postcss": {
"version": "7.0.30",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.30.tgz",
@@ -3928,9 +3922,9 @@
}
},
"caniuse-lite": {
"version": "1.0.30001059",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001059.tgz",
"integrity": "sha512-oOrc+jPJWooKIA0IrNZ5sYlsXc7NP7KLhNWrSGEJhnfSzDvDJ0zd3i6HXsslExY9bbu+x0FQ5C61LcqmPt7bOQ==",
"version": "1.0.30001165",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001165.tgz",
"integrity": "sha512-8cEsSMwXfx7lWSUMA2s08z9dIgsnR5NAqjXP23stdsU3AUWkCr/rr4s4OFtHXn5XXr6+7kam3QFVoYyXNPdJPA==",
"dev": true
},
"capture-exit": {

View File

@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, shrink-to-fit=no">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<meta name="google" content="notranslate">
<meta http-equiv="x-dns-prefetch-control" content="off">

View File

@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, shrink-to-fit=no">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<meta name="google" content="notranslate">
<meta name="mobile-web-app-capable" content="yes" />

View File

@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, shrink-to-fit=no">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<meta name="google" content="notranslate">
<link rel="apple-touch-icon" sizes="180x180" href="assets/apple-touch-icon-180x180.png" />

View File

@@ -32,6 +32,7 @@
"form_error_ip_format": "Invalid IP format",
"form_error_mac_format": "Invalid MAC format",
"form_error_client_id_format": "Invalid client ID format",
"form_error_server_name": "Invalid server name",
"form_error_positive": "Must be greater than 0",
"form_error_negative": "Must be equal to 0 or greater",
"range_end_error": "Must be greater than range start",
@@ -250,8 +251,12 @@
"dns_over_https": "DNS-over-HTTPS",
"dns_over_tls": "DNS-over-TLS",
"dns_over_quic": "DNS-over-QUIC",
"client_id": "Client ID",
"client_id_placeholder": "Enter client ID",
"client_id_desc": "Different clients can be identified by a special client ID. <a>Here</a> you can learn more about how to identify clients.",
"download_mobileconfig_doh": "Download .mobileconfig for DNS-over-HTTPS",
"download_mobileconfig_dot": "Download .mobileconfig for DNS-over-TLS",
"download_mobileconfig": "Download configuration file",
"plain_dns": "Plain DNS",
"form_enter_rate_limit": "Enter rate limit",
"rate_limit": "Rate limit",
@@ -270,7 +275,7 @@
"source_label": "Source",
"found_in_known_domain_db": "Found in the known domains database.",
"category_label": "Category",
"rule_label": "Rule",
"rule_label": "Rule(s)",
"list_label": "List",
"unknown_filter": "Unknown filter {{filterId}}",
"known_tracker": "Known tracker",
@@ -331,7 +336,7 @@
"encryption_config_saved": "Encryption config saved",
"encryption_server": "Server name",
"encryption_server_enter": "Enter your domain name",
"encryption_server_desc": "In order to use HTTPS, you need to enter the server name that matches your SSL certificate.",
"encryption_server_desc": "In order to use HTTPS, you need to enter the server name that matches your SSL certificate or wildcard certificate. If the field is not set, it will accept TLS connections for any domain.",
"encryption_redirect": "Redirect to HTTPS automatically",
"encryption_redirect_desc": "If checked, AdGuard Home will automatically redirect you from HTTP to HTTPS addresses.",
"encryption_https": "HTTPS port",
@@ -387,7 +392,7 @@
"client_edit": "Edit Client",
"client_identifier": "Identifier",
"ip_address": "IP address",
"client_identifier_desc": "Clients can be identified by the IP address, CIDR, MAC address. Please note that using MAC as identifier is possible only if AdGuard Home is also a <0>DHCP server</0>",
"client_identifier_desc": "Clients can be identified by the IP address, CIDR, MAC address or a special client ID (can be used for DoT/DoH/DoQ). <0>Here</0> you can learn more about how to identify clients.",
"form_enter_ip": "Enter IP",
"form_enter_mac": "Enter MAC",
"form_enter_id": "Enter identifier",
@@ -431,6 +436,7 @@
"setup_dns_privacy_other_3": "<0>dnscrypt-proxy</0> supports <1>DNS-over-HTTPS</1>.",
"setup_dns_privacy_other_4": "<0>Mozilla Firefox</0> supports <1>DNS-over-HTTPS</1>.",
"setup_dns_privacy_other_5": "You will find more implementations <0>here</0> and <1>here</1>.",
"setup_dns_privacy_ioc_mac": "iOS and macOS configuration",
"setup_dns_notice": "In order to use <1>DNS-over-HTTPS</1> or <1>DNS-over-TLS</1>, you need to <0>configure Encryption</0> in AdGuard Home settings.",
"rewrite_added": "DNS rewrite for \"{{key}}\" successfully added",
"rewrite_deleted": "DNS rewrite for \"{{key}}\" successfully deleted",
@@ -530,7 +536,6 @@
"check_ip": "IP addresses: {{ip}}",
"check_cname": "CNAME: {{cname}}",
"check_reason": "Reason: {{reason}}",
"check_rule": "Rule: {{rule}}",
"check_service": "Service name: {{service}}",
"service_name": "Service name",
"check_not_found": "Not found in your filter lists",

View File

@@ -273,15 +273,15 @@ describe('sortIp', () => {
});
});
describe('invalid input', () => {
const originalError = console.error;
const originalWarn = console.warn;
beforeEach(() => {
console.error = jest.fn();
console.warn = jest.fn();
});
afterEach(() => {
expect(console.error).toHaveBeenCalled();
console.error = originalError;
expect(console.warn).toHaveBeenCalled();
console.warn = originalWarn;
});
test('invalid strings', () => {

View File

@@ -287,7 +287,7 @@ export const getDnsStatus = () => async (dispatch) => {
try {
checkStatus(handleRequestSuccess, handleRequestError);
} catch (error) {
handleRequestError(error);
handleRequestError();
}
};

View File

@@ -8,11 +8,11 @@ import {
import { addErrorToast, addSuccessToast } from './toasts';
const enrichWithClientInfo = async (logs) => {
const clientsParams = getParamsForClientsSearch(logs, 'client');
const clientsParams = getParamsForClientsSearch(logs, 'client', 'client_id');
if (Object.keys(clientsParams).length > 0) {
const clients = await apiClient.findClients(clientsParams);
return addClientInfo(logs, clients, 'client');
return addClientInfo(logs, clients, 'client_id', 'client');
}
return logs;

View File

@@ -1,9 +1,9 @@
:root {
--yellow-pale: rgba(247, 181, 0, 0.1);
--green79: #67B279;
--green79: #67b279;
--gray-a5: #a5a5a5;
--gray-d8: #d8d8d8;
--gray-f3: #F3F3F3;
--gray-f3: #f3f3f3;
--font-family-monospace: Monaco, Menlo, "Ubuntu Mono", Consolas, source-code-pro, monospace;
}
@@ -13,6 +13,12 @@ body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
@media screen and (max-width: 767px) {
input, select, textarea {
font-size: 16px !important;
}
}
.status {
margin-top: 30px;
}
@@ -71,3 +77,11 @@ body {
.button-action--active {
visibility: visible;
}
.ReactModal__Body--open {
overflow: hidden;
}
a.btn-success.disabled {
color: #fff;
}

View File

@@ -9,7 +9,7 @@ import Card from '../ui/Card';
import Cell from '../ui/Cell';
import { getPercent, sortIp } from '../../helpers/helpers';
import { BLOCK_ACTIONS, STATUS_COLORS } from '../../helpers/constants';
import { BLOCK_ACTIONS, R_CLIENT_ID, STATUS_COLORS } from '../../helpers/constants';
import { toggleClientBlock } from '../../actions/access';
import { renderFormattedClientCell } from '../../helpers/renderFormattedClientCell';
import { getStats } from '../../actions/stats';
@@ -35,6 +35,10 @@ const CountCell = (row) => {
};
const renderBlockingButton = (ip, disallowed, disallowed_rule) => {
if (R_CLIENT_ID.test(ip)) {
return null;
}
const dispatch = useDispatch();
const { t } = useTranslation();
const processingSet = useSelector((state) => state.access.processingSet);
@@ -59,17 +63,19 @@ const renderBlockingButton = (ip, disallowed, disallowed_rule) => {
const text = disallowed ? BLOCK_ACTIONS.UNBLOCK : BLOCK_ACTIONS.BLOCK;
const isNotInAllowedList = disallowed && disallowed_rule === '';
return <div className="table__action pl-4">
<button
return (
<div className="table__action pl-4">
<button
type="button"
className={buttonClass}
onClick={isNotInAllowedList ? undefined : onClick}
disabled={isNotInAllowedList || processingSet}
title={t(isNotInAllowedList ? 'client_not_in_allowed_clients' : text)}
>
<Trans>{text}</Trans>
</button>
</div>;
>
<Trans>{text}</Trans>
</button>
</div>
);
};
const ClientCell = (row) => {
@@ -90,13 +96,14 @@ const Clients = ({
const { t } = useTranslation();
const topClients = useSelector((state) => state.stats.topClients, shallowEqual);
return <Card
return (
<Card
title={t('top_clients')}
subtitle={subtitle}
bodyType="card-table"
refresh={refreshButton}
>
<ReactTable
>
<ReactTable
data={topClients.map(({
name: ip, count, info, blocked,
}) => ({
@@ -107,7 +114,7 @@ const Clients = ({
}))}
columns={[
{
Header: 'IP',
Header: <Trans>client_table_header</Trans>,
accessor: 'ip',
sortMethod: sortIp,
Cell: ClientCell,
@@ -134,8 +141,9 @@ const Clients = ({
return disallowed ? { className: 'logs__row--red' } : {};
}}
/>
</Card>;
/>
</Card>
);
};
Clients.propTypes = {

View File

@@ -34,7 +34,7 @@
align-items: center;
}
.dashboard-title__button{
.dashboard-title__button {
margin: 0 0.5rem;
}
@@ -44,7 +44,7 @@
align-items: flex-start;
}
.dashboard-title__button{
.dashboard-title__button {
margin: 0.5rem 0;
display: block;
}

View File

@@ -44,6 +44,7 @@ const Dashboard = ({
const refreshButton = <button
type="button"
className="btn btn-icon btn-outline-primary btn-sm"
title={t('refresh_btn')}
onClick={() => getAllStats()}
>
<svg className="icons">

View File

@@ -12,7 +12,7 @@ import {
checkSafeSearch,
checkSafeBrowsing,
checkParental,
getFilterName,
getRulesToFilterList,
} from '../../../helpers/helpers';
import { BLOCK_ACTIONS, FILTERED, FILTERED_STATUS } from '../../../helpers/constants';
import { toggleBlocking } from '../../../actions';
@@ -41,32 +41,27 @@ const renderBlockingButton = (isFiltered, domain) => {
</button>;
};
const getTitle = (reason) => {
const getTitle = () => {
const { t } = useTranslation();
const filters = useSelector((state) => state.filtering.filters, shallowEqual);
const whitelistFilters = useSelector((state) => state.filtering.whitelistFilters, shallowEqual);
const filter_id = useSelector((state) => state.filtering.check.filter_id);
const filterName = getFilterName(
filters,
whitelistFilters,
filter_id,
'filtered_custom_rules',
(filter) => (filter?.name ? t('query_log_filtered', { filter: filter.name }) : ''),
);
const rules = useSelector((state) => state.filtering.check.rules, shallowEqual);
const reason = useSelector((state) => state.filtering.check.reason);
const getReasonFiltered = (reason) => {
const filterKey = reason.replace(FILTERED, '');
return i18next.t('query_log_filtered', { filter: filterKey });
};
const ruleAndFilterNames = getRulesToFilterList(rules, filters, whitelistFilters);
const REASON_TO_TITLE_MAP = {
[FILTERED_STATUS.NOT_FILTERED_NOT_FOUND]: t('check_not_found'),
[FILTERED_STATUS.REWRITE]: t('rewrite_applied'),
[FILTERED_STATUS.REWRITE_HOSTS]: t('rewrite_hosts_applied'),
[FILTERED_STATUS.FILTERED_BLACK_LIST]: filterName,
[FILTERED_STATUS.NOT_FILTERED_WHITE_LIST]: filterName,
[FILTERED_STATUS.FILTERED_BLACK_LIST]: ruleAndFilterNames,
[FILTERED_STATUS.NOT_FILTERED_WHITE_LIST]: ruleAndFilterNames,
[FILTERED_STATUS.FILTERED_SAFE_SEARCH]: getReasonFiltered(reason),
[FILTERED_STATUS.FILTERED_SAFE_BROWSING]: getReasonFiltered(reason),
[FILTERED_STATUS.FILTERED_PARENTAL]: getReasonFiltered(reason),
@@ -78,7 +73,11 @@ const getTitle = (reason) => {
return <>
<div>{t('check_reason', { reason })}</div>
<div>{filterName}</div>
<div>
{t('rule_label')}:
&nbsp;
{ruleAndFilterNames}
</div>
</>;
};
@@ -86,14 +85,13 @@ const Info = () => {
const {
hostname,
reason,
rule,
service_name,
cname,
ip_addrs,
} = useSelector((state) => state.filtering.check, shallowEqual);
const { t } = useTranslation();
const title = getTitle(reason);
const title = getTitle();
const className = classNames('card mb-0 p-3', {
'logs__row--red': checkFiltered(reason),
@@ -112,7 +110,6 @@ const Info = () => {
<div>{title}</div>
{!onlyFiltered
&& <>
{rule && <div>{t('check_rule', { rule })}</div>}
{service_name && <div>{t('check_service', { service: service_name })}</div>}
{cname && <div>{t('check_cname', { cname })}</div>}
{ip_addrs && <div>{t('check_ip', { ip: ip_addrs.join(', ') })}</div>}

View File

@@ -2,6 +2,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import ReactTable from 'react-table';
import { withTranslation } from 'react-i18next';
import { sortIp } from '../../../helpers/helpers';
class Table extends Component {
cellWrap = ({ value }) => (
@@ -21,6 +22,7 @@ class Table extends Component {
{
Header: this.props.t('answer'),
accessor: 'answer',
sortMethod: sortIp,
Cell: this.cellWrap,
},
{

View File

@@ -46,7 +46,7 @@ const Header = () => {
<div className="header__column">
<div className="d-flex align-items-center">
<Link to="/" className="nav-link pl-0 pr-1">
<img src={logo} alt="" className="header-brand-img" />
<img src={logo} alt="AdGuard Home logo" className="header-brand-img" />
</Link>
{!processing && isCoreRunning
&& <span className={badgeClass}

View File

@@ -16,6 +16,7 @@ import { updateLogs } from '../../../actions/queryLogs';
const ClientCell = ({
client,
client_id,
domain,
info,
info: {
@@ -33,12 +34,14 @@ const ClientCell = ({
const autoClient = autoClients.find((autoClient) => autoClient.name === client);
const source = autoClient?.source;
const whoisAvailable = whois_info && Object.keys(whois_info).length > 0;
const clientName = name || client_id;
const clientInfo = { ...info, name: clientName };
const id = nanoid();
const data = {
address: client,
name,
name: clientName,
country: whois_info?.country,
city: whois_info?.city,
network: whois_info?.orgname,
@@ -99,13 +102,20 @@ const ClientCell = ({
if (options.length === 0) {
return null;
}
return <>{options.map(({ name, onClick, disabled }) => <button
key={name}
className="button-action--arrow-option px-4 py-2"
onClick={onClick}
disabled={disabled}
>{t(name)}
</button>)}</>;
return (
<>
{options.map(({ name, onClick, disabled }) => (
<button
key={name}
className="button-action--arrow-option px-4 py-2"
onClick={onClick}
disabled={disabled}
>
{t(name)}
</button>
))}
</>
);
};
const content = getOptions(BUTTON_OPTIONS);
@@ -125,45 +135,70 @@ const ClientCell = ({
'button-action__container--detailed': isDetailed,
});
return <div className={containerClass}>
<button type="button"
return (
<div className={containerClass}>
<button
type="button"
className={buttonClass}
onClick={onClick}
disabled={processingRules}
>
{t(buttonType)}
</button>
{content && <button className={buttonArrowClass} disabled={processingRules}>
<IconTooltip
className='h-100'
tooltipClass='button-action--arrow-option-container'
xlinkHref='chevron-down'
triggerClass='button-action--icon'
content={content} placement="bottom-end" trigger="click"
onVisibilityChange={setOptionsOpened}
/>
</button>}
</div>;
>
{t(buttonType)}
</button>
{content && (
<button className={buttonArrowClass} disabled={processingRules}>
<IconTooltip
className="h-100"
tooltipClass="button-action--arrow-option-container"
xlinkHref="chevron-down"
triggerClass="button-action--icon"
content={content}
placement="bottom-end"
trigger="click"
onVisibilityChange={setOptionsOpened}
/>
</button>
)}
</div>
);
};
return <div className="o-hidden h-100 logs__cell logs__cell--client" role="gridcell">
<IconTooltip className={hintClass} columnClass='grid grid--limited' tooltipClass='px-5 pb-5 pt-4 mw-75'
xlinkHref='question' contentItemClass="contentItemClass" title="client_details"
content={processedData} placement="bottom" />
<div className={nameClass}>
<div data-tip={true} data-for={id}>
{renderFormattedClientCell(client, info, isDetailed, true)}
return (
<div
className="o-hidden h-100 logs__cell logs__cell--client"
role="gridcell"
>
<IconTooltip
className={hintClass}
columnClass="grid grid--limited"
tooltipClass="px-5 pb-5 pt-4"
xlinkHref="question"
contentItemClass="text-truncate key-colon o-hidden"
title="client_details"
content={processedData}
placement="bottom"
/>
<div className={nameClass}>
<div data-tip={true} data-for={id}>
{renderFormattedClientCell(client, clientInfo, isDetailed, true)}
</div>
{isDetailed && clientName && !whoisAvailable && (
<div
className="detailed-info d-none d-sm-block logs__text"
title={clientName}
>
{clientName}
</div>
)}
</div>
{isDetailed && name && !whoisAvailable
&& <div className="detailed-info d-none d-sm-block logs__text"
title={name}>{name}</div>}
{renderBlockingButton(isFiltered, domain)}
</div>
{renderBlockingButton(isFiltered, domain)}
</div>;
);
};
ClientCell.propTypes = {
client: propTypes.string.isRequired,
client_id: propTypes.string,
domain: propTypes.string.isRequired,
info: propTypes.oneOfType([
propTypes.string,

View File

@@ -35,7 +35,7 @@
}
.grid--title {
font-weight: bold;
font-weight: 600;
}
.grid--title:not(:first-child) {
@@ -65,12 +65,12 @@
}
.grid .key-colon, .grid .title--border {
font-weight: bold;
font-weight: 600;
}
}
.grid .key-colon:nth-child(odd)::after {
content: ':';
content: ":";
}
.grid__one-row {
@@ -95,7 +95,7 @@
}
.title--border:before {
content: '';
content: "";
position: absolute;
left: 0;
border-top: 0.5px solid var(--gray-d8) !important;

View File

@@ -4,8 +4,9 @@ import classNames from 'classnames';
import React from 'react';
import propTypes from 'prop-types';
import {
getRulesToFilterList,
formatElapsedMs,
getFilterName,
getFilterNames,
getServiceName,
} from '../../../helpers/helpers';
import { FILTERED_STATUS, FILTERED_STATUS_TO_META_MAP } from '../../../helpers/constants';
@@ -18,8 +19,7 @@ const ResponseCell = ({
response,
status,
upstream,
rule,
filterId,
rules,
service_name,
}) => {
const { t } = useTranslation();
@@ -36,7 +36,6 @@ const ResponseCell = ({
const statusLabel = t(isBlockedByResponse ? 'blocked_by_cname_or_ip' : FILTERED_STATUS_TO_META_MAP[reason]?.LABEL || reason);
const boldStatusLabel = <span className="font-weight-bold">{statusLabel}</span>;
const filter = getFilterName(filters, whitelistFilters, filterId);
const renderResponses = (responseArr) => {
if (!responseArr || responseArr.length === 0) {
@@ -57,13 +56,17 @@ const ResponseCell = ({
install_settings_dns: upstream,
elapsed: formattedElapsedMs,
response_code: status,
...(service_name ? { service_name: getServiceName(service_name) } : { filter }),
rule_label: rule,
...(service_name
&& { service_name: getServiceName(service_name) }
),
...(rules.length > 0
&& { rule_label: getRulesToFilterList(rules, filters, whitelistFilters) }
),
response_table_header: renderResponses(response),
original_response: renderResponses(originalResponse),
};
const content = rule
const content = rules.length > 0
? Object.entries(COMMON_CONTENT)
: Object.entries({
...COMMON_CONTENT,
@@ -78,7 +81,8 @@ const ResponseCell = ({
}
return getServiceName(service_name);
case FILTERED_STATUS.FILTERED_BLACK_LIST:
return filter;
case FILTERED_STATUS.NOT_FILTERED_WHITE_LIST:
return getFilterNames(rules, filters, whitelistFilters).join(', ');
default:
return formattedElapsedMs;
}
@@ -113,8 +117,10 @@ ResponseCell.propTypes = {
response: propTypes.array.isRequired,
status: propTypes.string.isRequired,
upstream: propTypes.string.isRequired,
rule: propTypes.string,
filterId: propTypes.number,
rules: propTypes.arrayOf(propTypes.shape({
text: propTypes.string.isRequired,
filter_list_id: propTypes.number.isRequired,
})),
service_name: propTypes.string,
};

View File

@@ -6,11 +6,11 @@ import propTypes from 'prop-types';
import {
captitalizeWords,
checkFiltered,
getRulesToFilterList,
formatDateTime,
formatElapsedMs,
formatTime,
getBlockingClientName,
getFilterName,
getServiceName,
processContent,
} from '../../../helpers/helpers';
@@ -70,8 +70,8 @@ const Row = memo(({
upstream,
type,
client_proto,
filterId,
rule,
client_id,
rules,
originalResponse,
status,
service_name,
@@ -107,8 +107,6 @@ const Row = memo(({
const sourceData = getSourceData(tracker);
const filter = getFilterName(filters, whitelistFilters, filterId);
const {
confirmMessage,
buttonKey: blockingClientKey,
@@ -172,13 +170,14 @@ const Row = memo(({
response_details: 'title',
install_settings_dns: upstream,
elapsed: formattedElapsedMs,
filter: rule ? filter : null,
rule_label: rule,
...(rules.length > 0
&& { rule_label: getRulesToFilterList(rules, filters, whitelistFilters) }
),
response_table_header: response?.join('\n'),
response_code: status,
client_details: 'title',
ip_address: client,
name: info?.name,
name: info?.name || client_id,
country,
city,
network,
@@ -235,8 +234,11 @@ Row.propTypes = {
upstream: propTypes.string.isRequired,
type: propTypes.string.isRequired,
client_proto: propTypes.string.isRequired,
filterId: propTypes.number,
rule: propTypes.string,
client_id: propTypes.string,
rules: propTypes.arrayOf(propTypes.shape({
text: propTypes.string.isRequired,
filter_list_id: propTypes.number.isRequired,
})),
originalResponse: propTypes.array,
status: propTypes.string.isRequired,
service_name: propTypes.string,

View File

@@ -9,21 +9,18 @@
--size-response: 150;
--size-client: 123;
--gray-216: rgba(216, 216, 216, 0.23);
--gray-4d: #4D4D4D;
--gray-f3: #F3F3F3;
--gray-4d: #4d4d4d;
--gray-f3: #f3f3f3;
--gray-8: #888;
--gray-3: #333;
--danger: #DF3812;
--danger: #df3812;
--white80: rgba(255, 255, 255, 0.8);
--btn-block: #C23814;
--btn-block-disabled: #E3B3A6;
--btn-block-active: #A62200;
--btn-block: #c23814;
--btn-block-disabled: #e3b3a6;
--btn-block-active: #a62200;
--btn-unblock: #888888;
--btn-unblock-disabled: #D8D8D8;
--btn-unblock-active: #4D4D4D;
--btn-unblock-disabled: #d8d8d8;
--btn-unblock-active: #4d4d4d;
--option-border-radius: 4px;
}
@@ -40,7 +37,7 @@
}
.logs__text--bold {
font-weight: bold;
font-weight: 600;
}
.logs__time {
@@ -87,7 +84,7 @@
}
.custom-select__arrow--left {
background: var(--white) url('../ui/svg/chevron-down.svg') no-repeat;
background: var(--white) url("../ui/svg/chevron-down.svg") no-repeat;
background-position: 5px 9px;
background-size: 22px;
}
@@ -167,12 +164,13 @@
}
.logs__refresh {
--size: 2.5rem;
position: relative;
top: 3px;
display: inline-flex;
align-items: center;
justify-content: center;
--size: 2.5rem;
width: var(--size);
height: var(--size);
padding: 0;
@@ -360,7 +358,7 @@
color: var(--gray-4d);
background-color: var(--white80);
pointer-events: none;
font-weight: bold;
font-weight: 600;
text-align: center;
padding-top: 21rem;
display: block;
@@ -431,3 +429,13 @@
margin-right: 1px;
opacity: 0.5;
}
.filteringRules__rule {
margin-bottom: 0;
}
.filteringRules__filter {
font-style: italic;
font-weight: normal;
margin-bottom: 1rem;
}

View File

@@ -259,7 +259,7 @@ let Form = (props) => {
</div>
<div className="form__desc mt-0 mb-2">
<Trans components={[
<a href="https://github.com/AdguardTeam/AdGuardHome/wiki/Hosts-Blocklists#ctag"
<a target="_blank" rel="noopener noreferrer" href="https://github.com/AdguardTeam/AdGuardHome/wiki/Hosts-Blocklists#ctag"
key="0">link</a>,
]}>
tags_desc
@@ -282,7 +282,7 @@ let Form = (props) => {
<div className="form__desc mt-0">
<Trans
components={[
<a href="#dhcp" key="0">
<a href="https://github.com/AdguardTeam/AdGuardHome/wiki/Clients#idclient" key="0" target="_blank" rel="noopener noreferrer">
link
</a>,
]}

View File

@@ -113,9 +113,6 @@ const Dhcp = () => {
const enteredSomeValue = enteredSomeV4Value || enteredSomeV6Value || interfaceName;
const getToggleDhcpButton = () => {
const otherDhcpFound = check && (check.v4.other_server.found === STATUS_RESPONSE.YES
|| check.v6.other_server.found === STATUS_RESPONSE.YES);
const filledConfig = interface_name && (Object.values(v4)
.every(Boolean) || Object.values(v6)
.every(Boolean));
@@ -141,7 +138,7 @@ const Dhcp = () => {
className={className}
onClick={enabled ? onClickDisable : onClickEnable}
disabled={processingDhcp || processingConfig
|| (!enabled && (!filledConfig || !check || otherDhcpFound))}
|| (!enabled && (!filledConfig || !check))}
>
<Trans>{enabled ? 'dhcp_disable' : 'dhcp_enable'}</Trans>
</button>;

View File

@@ -50,7 +50,7 @@ const CertificateStatus = ({
{dnsNames && (
<li>
<Trans>encryption_hostnames</Trans>:&nbsp;
{dnsNames}
{dnsNames.join(', ')}
</li>
)}
</Fragment>
@@ -65,7 +65,7 @@ CertificateStatus.propTypes = {
subject: PropTypes.string,
issuer: PropTypes.string,
notAfter: PropTypes.string,
dnsNames: PropTypes.string,
dnsNames: PropTypes.arrayOf(PropTypes.string),
};
export default withTranslation()(CertificateStatus);

View File

@@ -12,7 +12,7 @@ import {
toNumber,
} from '../../../helpers/form';
import {
validateIsSafePort, validatePort, validatePortQuic, validatePortTLS,
validateServerName, validateIsSafePort, validatePort, validatePortQuic, validatePortTLS,
} from '../../../helpers/validators';
import i18n from '../../../i18n';
import KeyStatus from './KeyStatus';
@@ -127,6 +127,7 @@ let Form = (props) => {
placeholder={t('encryption_server_enter')}
onChange={handleChange}
disabled={!isEnabled}
validate={validateServerName}
/>
<div className="form__desc">
<Trans>encryption_server_desc</Trans>
@@ -232,7 +233,7 @@ let Form = (props) => {
<Trans
values={{ link: 'letsencrypt.org' }}
components={[
<a href="https://letsencrypt.org/" key="0">
<a target="_blank" rel="noopener noreferrer" href="https://letsencrypt.org/" key="0">
link
</a>,
]}
@@ -413,7 +414,7 @@ Form.propTypes = {
valid_key: PropTypes.bool,
valid_cert: PropTypes.bool,
valid_pair: PropTypes.bool,
dns_names: PropTypes.string,
dns_names: PropTypes.arrayOf(PropTypes.string),
key_type: PropTypes.string,
issuer: PropTypes.string,
subject: PropTypes.string,

View File

@@ -7,7 +7,7 @@ import flow from 'lodash/flow';
import { CheckboxField, toNumber } from '../../../helpers/form';
import {
FILTERS_INTERVALS_HOURS,
FILTERS_LINK,
FILTERS_RELATIVE_LINK,
FORM_NAME,
} from '../../../helpers/constants';
@@ -45,7 +45,7 @@ const Form = (props) => {
} = props;
const components = {
a: <a href={FILTERS_LINK} rel="noopener noreferrer" />,
a: <a href={FILTERS_RELATIVE_LINK} rel="noopener noreferrer" />,
};
return (

View File

@@ -6,6 +6,50 @@ import { useSelector } from 'react-redux';
import Topline from './Topline';
import { EMPTY_DATE } from '../../helpers/constants';
const EXPIRATION_ENUM = {
VALID: 'VALID',
EXPIRED: 'EXPIRED',
EXPIRING: 'EXPIRING',
};
const EXPIRATION_STATE = {
[EXPIRATION_ENUM.EXPIRED]: {
toplineType: 'danger',
i18nKey: 'topline_expired_certificate',
},
[EXPIRATION_ENUM.EXPIRING]: {
toplineType: 'warning',
i18nKey: 'topline_expiring_certificate',
},
};
const getExpirationFlags = (not_after) => {
const DAYS_BEFORE_EXPIRATION = 5;
const now = Date.now();
const isExpiring = isAfter(addDays(now, DAYS_BEFORE_EXPIRATION), not_after);
const isExpired = isAfter(now, not_after);
return {
isExpiring,
isExpired,
};
};
const getExpirationEnumKey = (not_after) => {
const { isExpiring, isExpired } = getExpirationFlags(not_after);
if (isExpired) {
return EXPIRATION_ENUM.EXPIRED;
}
if (isExpiring) {
return EXPIRATION_ENUM.EXPIRING;
}
return EXPIRATION_ENUM.VALID;
};
const EncryptionTopline = () => {
const not_after = useSelector((state) => state.encryption.not_after);
@@ -13,30 +57,21 @@ const EncryptionTopline = () => {
return null;
}
const isAboutExpire = isAfter(addDays(Date.now(), 30), not_after);
const isExpired = isAfter(Date.now(), not_after);
const expirationStateKey = getExpirationEnumKey(not_after);
if (isExpired) {
return (
<Topline type="danger">
<Trans components={[<a href="#encryption" key="0">link</a>]}>
topline_expired_certificate
</Trans>
</Topline>
);
if (expirationStateKey === EXPIRATION_ENUM.VALID) {
return null;
}
if (isAboutExpire) {
return (
<Topline type="warning">
const { toplineType, i18nKey } = EXPIRATION_STATE[expirationStateKey];
return (
<Topline type={toplineType}>
<Trans components={[<a href="#encryption" key="0">link</a>]}>
topline_expiring_certificate
{i18nKey}
</Trans>
</Topline>
);
}
return false;
);
};
export default EncryptionTopline;

View File

@@ -2,25 +2,13 @@ import React, { useState } from 'react';
import PropTypes from 'prop-types';
import { Trans, useTranslation } from 'react-i18next';
import i18next from 'i18next';
import Tabs from './Tabs';
import Icons from './Icons';
import { useSelector } from 'react-redux';
const MOBILE_CONFIG_LINKS = {
DOT: '/apple/dot.mobileconfig',
DOH: '/apple/doh.mobileconfig',
};
import { MOBILE_CONFIG_LINKS } from '../../../helpers/constants';
const renderMobileconfigInfo = ({ label, components }) => <li key={label}>
<Trans components={components}>{label}</Trans>
<ul>
<li>
<a href={MOBILE_CONFIG_LINKS.DOT} download>{i18next.t('download_mobileconfig_dot')}</a>
</li>
<li>
<a href={MOBILE_CONFIG_LINKS.DOH} download>{i18next.t('download_mobileconfig_doh')}</a>
</li>
</ul>
</li>;
import Tabs from '../Tabs';
import Icons from '../Icons';
import MobileConfigForm from './MobileConfigForm';
const renderLi = ({ label, components }) => <li key={label}>
<Trans components={components?.map((props) => {
@@ -38,140 +26,135 @@ const renderLi = ({ label, components }) => <li key={label}>
</Trans>
</li>;
const dnsPrivacyList = [{
title: 'Android',
list: [
{
label: 'setup_dns_privacy_android_1',
},
{
label: 'setup_dns_privacy_android_2',
components: [
{
key: 0,
href: 'https://adguard.com/adguard-android/overview.html',
},
<code key="1">text</code>,
],
},
{
label: 'setup_dns_privacy_android_3',
components: [
{
key: 0,
href: 'https://getintra.org/',
},
<code key="1">text</code>,
],
},
],
},
{
title: 'iOS',
list: [
{
label: 'setup_dns_privacy_ios_2',
components: [
{
key: 0,
href: 'https://adguard.com/adguard-ios/overview.html',
},
<code key="1">text</code>,
],
},
{
label: 'setup_dns_privacy_4',
components: {
highlight: <code />,
const getDnsPrivacyList = () => [
{
title: 'Android',
list: [
{
label: 'setup_dns_privacy_android_1',
},
renderComponent: renderMobileconfigInfo,
},
{
label: 'setup_dns_privacy_ios_1',
components: [
{
key: 0,
href: 'https://itunes.apple.com/app/id1452162351',
},
{
label: 'setup_dns_privacy_android_2',
components: [
{
key: 0,
href: 'https://adguard.com/adguard-android/overview.html',
},
<code key="1">text</code>,
],
},
{
label: 'setup_dns_privacy_android_3',
components: [
{
key: 0,
href: 'https://getintra.org/',
},
<code key="1">text</code>,
],
},
],
},
{
title: 'iOS',
list: [
{
label: 'setup_dns_privacy_ios_2',
components: [
{
key: 0,
href: 'https://adguard.com/adguard-ios/overview.html',
},
<code key="1">text</code>,
],
},
{
label: 'setup_dns_privacy_ios_1',
components: [
{
key: 0,
href: 'https://itunes.apple.com/app/id1452162351',
},
<code key="1">text</code>,
{
key: 2,
href: 'https://dnscrypt.info/stamps',
},
],
},
],
},
{
title: 'setup_dns_privacy_other_title',
list: [
{
label: 'setup_dns_privacy_other_1',
},
{
label: 'setup_dns_privacy_other_2',
components: [
{
key: 0,
href: 'https://github.com/AdguardTeam/dnsproxy',
},
],
},
{
href: 'https://github.com/jedisct1/dnscrypt-proxy',
label: 'setup_dns_privacy_other_3',
components: [
{
key: 0,
href: 'https://github.com/jedisct1/dnscrypt-proxy',
},
<code key="1">text</code>,
],
},
{
label: 'setup_dns_privacy_other_4',
components: [
{
key: 0,
href: 'https://support.mozilla.org/kb/firefox-dns-over-https',
},
<code key="1">text</code>,
],
},
{
label: 'setup_dns_privacy_other_5',
components: [
{
key: 0,
href: 'https://dnscrypt.info/implementations',
},
{
key: 1,
href: 'https://dnsprivacy.org/wiki/display/DP/DNS+Privacy+Clients',
},
],
},
],
},
],
},
],
},
{
title: 'setup_dns_privacy_other_title',
list: [
{
label: 'setup_dns_privacy_other_1',
},
{
label: 'setup_dns_privacy_other_2',
components: [
{
key: 0,
href: 'https://github.com/AdguardTeam/dnsproxy',
},
],
},
{
href: 'https://github.com/jedisct1/dnscrypt-proxy',
label: 'setup_dns_privacy_other_3',
components: [
{
key: 0,
href: 'https://github.com/jedisct1/dnscrypt-proxy',
},
<code key="1">text</code>,
],
},
{
label: 'setup_dns_privacy_other_4',
components: [
{
key: 0,
href: 'https://support.mozilla.org/kb/firefox-dns-over-https',
},
<code key="1">text</code>,
],
},
{
label: 'setup_dns_privacy_other_5',
components: [
{
key: 0,
href: 'https://dnscrypt.info/implementations',
},
{
key: 1,
href: 'https://dnsprivacy.org/wiki/display/DP/DNS+Privacy+Clients',
},
],
},
],
},
];
const renderDnsPrivacyList = ({ title, list }) => <div className="tab__paragraph" key={title}>
<strong><Trans>{title}</Trans></strong>
<ul>{list.map(
({
label,
components,
renderComponent = renderLi,
}) => renderComponent({ label, components }),
)}
</ul>
</div>;
const renderDnsPrivacyList = ({ title, list }) => (
<div className="tab__paragraph" key={title}>
<strong>
<Trans>{title}</Trans>
</strong>
<ul>
{list.map(({ label, components, renderComponent = renderLi }) => (
renderComponent({ label, components })
))}
</ul>
</div>
);
const getTabs = ({
tlsAddress,
httpsAddress,
showDnsPrivacyNotice,
server_name,
t,
}) => ({
Router: {
@@ -253,8 +236,8 @@ const getTabs = ({
</Trans>
</div>
)}
{showDnsPrivacyNotice
? <div className="tab__paragraph">
{showDnsPrivacyNotice ? (
<div className="tab__paragraph">
<Trans
components={[
<a
@@ -271,34 +254,64 @@ const getTabs = ({
setup_dns_notice
</Trans>
</div>
: <>
) : (
<>
<div className="tab__paragraph">
<Trans components={[<p key="0">text</p>]}>
setup_dns_privacy_3
</Trans>
</div>
{dnsPrivacyList.map(renderDnsPrivacyList)}
</>}
{getDnsPrivacyList().map(renderDnsPrivacyList)}
<div>
<strong>
<Trans>
setup_dns_privacy_ioc_mac
</Trans>
</strong>
</div>
<div className="mb-3">
<Trans components={{ highlight: <code /> }}>
setup_dns_privacy_4
</Trans>
</div>
<MobileConfigForm
initialValues={{
host: server_name,
clientId: '',
protocol: MOBILE_CONFIG_LINKS.DOH,
}}
/>
</>
)}
</div>
</div>;
},
},
});
const renderContent = ({ title, list, getTitle }) => <div key={title} label={i18next.t(title)}>
<div className="tab__title">{i18next.t(title)}</div>
<div className="tab__text">
{getTitle?.()}
{list
&& <ol>{list.map((item) => <li key={item}>
<Trans>{item}</Trans>
</li>)}
</ol>}
const renderContent = ({ title, list, getTitle }) => (
<div key={title} label={i18next.t(title)}>
<div className="tab__title">
{i18next.t(title)}
</div>
<div className="tab__text">
{getTitle?.()}
{list && (
<ol>
{list.map((item) => (
<li key={item}>
<Trans>{item}</Trans>
</li>
))}
</ol>
)}
</div>
</div>
</div>;
);
const Guide = ({ dnsAddresses }) => {
const { t } = useTranslation();
const server_name = useSelector((state) => state.encryption?.server_name);
const tlsAddress = dnsAddresses?.filter((item) => item.includes('tls://')) ?? '';
const httpsAddress = dnsAddresses?.filter((item) => item.includes('https://')) ?? '';
const showDnsPrivacyNotice = httpsAddress.length < 1 && tlsAddress.length < 1;
@@ -309,6 +322,7 @@ const Guide = ({ dnsAddresses }) => {
tlsAddress,
httpsAddress,
showDnsPrivacyNotice,
server_name,
t,
});
@@ -316,9 +330,14 @@ const Guide = ({ dnsAddresses }) => {
return (
<div>
<Tabs
tabs={tabs}
activeTabLabel={activeTabLabel}
setActiveTabLabel={setActiveTabLabel}
>
{activeTab}
</Tabs>
<Icons />
<Tabs tabs={tabs} activeTabLabel={activeTabLabel}
setActiveTabLabel={setActiveTabLabel}>{activeTab}</Tabs>
</div>
);
};
@@ -348,6 +367,4 @@ renderLi.propTypes = {
components: PropTypes.string,
};
renderMobileconfigInfo.propTypes = renderLi.propTypes;
export default Guide;

View File

@@ -0,0 +1,131 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Trans } from 'react-i18next';
import { useSelector } from 'react-redux';
import { Field, reduxForm } from 'redux-form';
import i18next from 'i18next';
import cn from 'classnames';
import { getPathWithQueryString } from '../../../helpers/helpers';
import { FORM_NAME, MOBILE_CONFIG_LINKS } from '../../../helpers/constants';
import {
renderInputField,
renderSelectField,
} from '../../../helpers/form';
import {
validateClientId,
validateServerName,
} from '../../../helpers/validators';
const getDownloadLink = (host, clientId, protocol, invalid) => {
if (!host || invalid) {
return (
<button
type="button"
className="btn btn-success btn-standard btn-large disabled"
>
<Trans>download_mobileconfig</Trans>
</button>
);
}
const linkParams = { host };
if (clientId) {
linkParams.client_id = clientId;
}
return (
<a
href={getPathWithQueryString(protocol, linkParams)}
className={cn('btn btn-success btn-standard btn-large')}
download
>
<Trans>download_mobileconfig</Trans>
</a>
);
};
const MobileConfigForm = ({ invalid }) => {
const formValues = useSelector((state) => state.form[FORM_NAME.MOBILE_CONFIG]?.values);
if (!formValues) {
return null;
}
const { host, clientId, protocol } = formValues;
const githubLink = (
<a
href="https://github.com/AdguardTeam/AdGuardHome/wiki/Clients#idclient"
target="_blank"
rel="noopener noreferrer"
>
text
</a>
);
return (
<form onSubmit={(e) => e.preventDefault()}>
<div>
<div className="form__group form__group--settings">
<label htmlFor="host" className="form__label">
{i18next.t('dhcp_table_hostname')}
</label>
<Field
name="host"
type="text"
component={renderInputField}
className="form-control"
placeholder={i18next.t('form_enter_hostname')}
validate={validateServerName}
/>
</div>
<div className="form__group form__group--settings">
<label htmlFor="clientId" className="form__label form__label--with-desc">
{i18next.t('client_id')}
</label>
<div className="form__desc form__desc--top">
<Trans components={{ a: githubLink }}>
client_id_desc
</Trans>
</div>
<Field
name="clientId"
type="text"
component={renderInputField}
className="form-control"
placeholder={i18next.t('client_id_placeholder')}
validate={validateClientId}
/>
</div>
<div className="form__group form__group--settings">
<label htmlFor="protocol" className="form__label">
{i18next.t('protocol')}
</label>
<Field
name="protocol"
type="text"
component={renderSelectField}
className="form-control"
>
<option value={MOBILE_CONFIG_LINKS.DOT}>
{i18next.t('dns_over_tls')}
</option>
<option value={MOBILE_CONFIG_LINKS.DOH}>
{i18next.t('dns_over_https')}
</option>
</Field>
</div>
</div>
{getDownloadLink(host, clientId, protocol, invalid)}
</form>
);
};
MobileConfigForm.propTypes = {
invalid: PropTypes.bool.isRequired,
};
export default reduxForm({ form: FORM_NAME.MOBILE_CONFIG })(MobileConfigForm);

View File

@@ -0,0 +1 @@
export { default } from './Guide';

View File

@@ -6,18 +6,21 @@
.icon--24 {
--size: 1.5rem;
width: var(--size);
height: var(--size);
}
.icon--20 {
--size: 1.25rem;
width: var(--size);
height: var(--size);
}
.icon--18 {
--size: 1.125rem;
width: var(--size);
height: var(--size);
}

View File

@@ -13,6 +13,8 @@ export const R_MAC = /^((([a-fA-F0-9][a-fA-F0-9]+[-]){5}|([a-fA-F0-9][a-fA-F0-9]
export const R_CIDR_IPV6 = /^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*(\/(12[0-8]|1[0-1][0-9]|[1-9][0-9]|[0-9]))$/;
export const R_DOMAIN = /^([a-zA-Z0-9][a-zA-Z0-9-_]*\.)*[a-zA-Z0-9]*[a-zA-Z0-9-_]*[[a-zA-Z0-9]+$/;
export const R_PATH_LAST_PART = /\/[^/]*$/;
// eslint-disable-next-line no-control-regex
@@ -21,6 +23,8 @@ export const R_UNIX_ABSOLUTE_PATH = /^(\/[^/\x00]+)+$/;
// eslint-disable-next-line no-control-regex
export const R_WIN_ABSOLUTE_PATH = /^([a-zA-Z]:)?(\\|\/)(?:[^\\/:*?"<>|\x00]+\\)*[^\\/:*?"<>|\x00]*$/;
export const R_CLIENT_ID = /^[a-z0-9-]{1,64}$/;
export const HTML_PAGES = {
INSTALL: '/install.html',
LOGIN: '/login.html',
@@ -53,10 +57,10 @@ export const REPOSITORY = {
export const PRIVACY_POLICY_LINK = 'https://adguard.com/privacy/home.html';
export const PORT_53_FAQ_LINK = 'https://github.com/AdguardTeam/AdGuardHome/wiki/FAQ#bindinuse';
export const UPSTREAM_CONFIGURATION_WIKI_LINK = 'https://github.com/AdguardTeam/AdGuardHome/wiki/Configuration#upstreams';
export const FILTERS_LINK = '#filters';
export const GETTING_STARTED_LINK = 'https://github.com/AdguardTeam/AdGuardHome/wiki/Getting-Started#update';
export const FILTERS_RELATIVE_LINK = '#filters';
export const ADDRESS_IN_USE_TEXT = 'address already in use';
export const INSTALL_FIRST_STEP = 1;
@@ -339,6 +343,7 @@ export const FILTERED_STATUS = {
FILTERED_BLOCKED_SERVICE: 'FilteredBlockedService',
REWRITE: 'Rewrite',
REWRITE_HOSTS: 'RewriteEtcHosts',
REWRITE_RULE: 'RewriteRule',
FILTERED_SAFE_SEARCH: 'FilteredSafeSearch',
FILTERED_SAFE_BROWSING: 'FilteredSafeBrowsing',
FILTERED_PARENTAL: 'FilteredParental',
@@ -430,6 +435,10 @@ export const FILTERED_STATUS_TO_META_MAP = {
LABEL: RESPONSE_FILTER.REWRITTEN.LABEL,
COLOR: QUERY_STATUS_COLORS.BLUE,
},
[FILTERED_STATUS.REWRITE_RULE]: {
LABEL: RESPONSE_FILTER.REWRITTEN.LABEL,
COLOR: QUERY_STATUS_COLORS.BLUE,
},
[FILTERED_STATUS.FILTERED_SAFE_BROWSING]: {
LABEL: RESPONSE_FILTER.BLOCKED_THREATS.LABEL,
COLOR: QUERY_STATUS_COLORS.YELLOW,
@@ -509,6 +518,7 @@ export const FORM_NAME = {
INSTALL: 'install',
LOGIN: 'login',
CACHE: 'cache',
MOBILE_CONFIG: 'mobileConfig',
...DHCP_FORM_NAMES,
};
@@ -569,6 +579,7 @@ export const TOAST_TIMEOUTS = {
export const ADDRESS_TYPES = {
IP: 'IP',
CIDR: 'CIDR',
CLIENT_ID: 'CLIENT_ID',
UNKNOWN: 'UNKNOWN',
};
@@ -580,3 +591,8 @@ export const CACHE_CONFIG_FIELDS = {
export const isFirefox = navigator.userAgent.indexOf('Firefox') !== -1;
export const COMMENT_LINE_DEFAULT_TOKEN = '#';
export const MOBILE_CONFIG_LINKS = {
DOT: '/apple/dot.mobileconfig',
DOH: '/apple/doh.mobileconfig',
};

View File

@@ -4,9 +4,9 @@ import dateFormat from 'date-fns/format';
import round from 'lodash/round';
import axios from 'axios';
import i18n from 'i18next';
import uniqBy from 'lodash/uniqBy';
import ipaddr from 'ipaddr.js';
import queryString from 'query-string';
import React from 'react';
import { getTrackerData } from './trackers/trackers';
import {
@@ -21,6 +21,7 @@ import {
DHCP_VALUES_PLACEHOLDERS,
FILTERED,
FILTERED_STATUS,
R_CLIENT_ID,
SERVICES_ID_NAME_MAP,
STANDARD_DNS_PORT,
STANDARD_HTTPS_PORT,
@@ -61,6 +62,7 @@ export const normalizeLogs = (logs) => logs.map((log) => {
answer_dnssec,
client,
client_proto,
client_id,
elapsedMs,
question,
reason,
@@ -68,6 +70,7 @@ export const normalizeLogs = (logs) => logs.map((log) => {
time,
filterId,
rule,
rules,
service_name,
original_answer,
upstream,
@@ -80,6 +83,15 @@ export const normalizeLogs = (logs) => logs.map((log) => {
return `${type}: ${value} (ttl=${ttl})`;
}) : []);
let newRules = rules;
/* TODO 'filterId' and 'rule' are deprecated, will be removed in 0.106 */
if (rule !== undefined && filterId !== undefined && rules !== undefined && rules.length === 0) {
newRules = {
filter_list_id: filterId,
text: rule,
};
}
return {
time,
domain,
@@ -88,8 +100,11 @@ export const normalizeLogs = (logs) => logs.map((log) => {
reason,
client,
client_proto,
client_id,
/* TODO 'filterId' and 'rule' are deprecated, will be removed in 0.106 */
filterId,
rule,
rules: newRules,
status,
service_name,
originalAnswer: original_answer,
@@ -113,12 +128,21 @@ export const normalizeTopStats = (stats) => (
}))
);
export const addClientInfo = (data, clients, param) => data.map((row) => {
const clientIp = row[param];
const info = clients.find((item) => item[clientIp]) || '';
export const addClientInfo = (data, clients, ...params) => data.map((row) => {
let info = '';
params.find((param) => {
const id = row[param];
if (id) {
const client = clients.find((item) => item[id]) || '';
info = client?.[id] ?? '';
}
return info;
});
return {
...row,
info: info?.[clientIp] ?? '',
info,
};
});
@@ -190,7 +214,12 @@ export const getIpList = (interfaces) => Object.values(interfaces)
.reduce((acc, curr) => acc.concat(curr.ip_addresses), [])
.sort();
export const getDnsAddress = (ip, port = '') => {
/**
* @param {string} ip
* @param {number} [port]
* @returns {string}
*/
export const getDnsAddress = (ip, port = 0) => {
const isStandardDnsPort = port === STANDARD_DNS_PORT;
let address = ip;
@@ -205,7 +234,12 @@ export const getDnsAddress = (ip, port = '') => {
return address;
};
export const getWebAddress = (ip, port = '') => {
/**
* @param {string} ip
* @param {number} [port]
* @returns {string}
*/
export const getWebAddress = (ip, port = 0) => {
const isStandardWebPort = port === STANDARD_WEB_PORT;
let address = `http://${ip}`;
@@ -391,14 +425,21 @@ export const getPathWithQueryString = (path, params) => {
return `${path}?${searchParams.toString()}`;
};
export const getParamsForClientsSearch = (data, param) => {
const uniqueClients = uniqBy(data, param);
return uniqueClients
.reduce((acc, item, idx) => {
const key = `ip${idx}`;
acc[key] = item[param];
return acc;
}, {});
export const getParamsForClientsSearch = (data, param, additionalParam) => {
const clients = new Set();
data.forEach((e) => {
clients.add(e[param]);
if (e[additionalParam]) {
clients.add(e[additionalParam]);
}
});
const params = {};
const ids = Array.from(clients.values());
ids.forEach((id, i) => {
params[`ip${i}`] = id;
});
return params;
};
/**
@@ -511,7 +552,7 @@ export const isIpInCidr = (ip, cidr) => {
/**
*
* @param ipOrCidr
* @returns {'IP' | 'CIDR' | 'UNKNOWN'}
* @returns {'IP' | 'CIDR' | 'CLIENT_ID' | 'UNKNOWN'}
*
*/
export const findAddressType = (address) => {
@@ -524,6 +565,9 @@ export const findAddressType = (address) => {
if (cidrMaybe && ipaddr.parseCIDR(address)) {
return ADDRESS_TYPES.CIDR;
}
if (R_CLIENT_ID.test(address)) {
return ADDRESS_TYPES.CLIENT_ID;
}
return ADDRESS_TYPES.UNKNOWN;
} catch (e) {
@@ -544,20 +588,31 @@ export const separateIpsAndCidrs = (ids) => ids.reduce((acc, curr) => {
if (addressType === ADDRESS_TYPES.CIDR) {
acc.cidrs.push(curr);
}
if (addressType === ADDRESS_TYPES.CLIENT_ID) {
acc.clientIds.push(curr);
}
return acc;
}, { ips: [], cidrs: [] });
}, { ips: [], cidrs: [], clientIds: [] });
export const countClientsStatistics = (ids, autoClients) => {
const { ips, cidrs } = separateIpsAndCidrs(ids);
const { ips, cidrs, clientIds } = separateIpsAndCidrs(ids);
const ipsCount = ips.reduce((acc, curr) => {
const count = autoClients[curr] || 0;
return acc + count;
}, 0);
const clientIdsCount = clientIds.reduce((acc, curr) => {
const count = autoClients[curr] || 0;
return acc + count;
}, 0);
const cidrsCount = Object.entries(autoClients)
.reduce((acc, curr) => {
const [id, count] = curr;
if (!ipaddr.isValid(id)) {
return false;
}
if (cidrs.some((cidr) => isIpInCidr(id, cidr))) {
// eslint-disable-next-line no-param-reassign
acc += count;
@@ -565,7 +620,7 @@ export const countClientsStatistics = (ids, autoClients) => {
return acc;
}, 0);
return ipsCount + cidrsCount;
return ipsCount + cidrsCount + clientIdsCount;
};
/**
@@ -687,7 +742,7 @@ export const sortIp = (a, b) => {
return 0;
} catch (e) {
console.error(e);
console.warn(e);
return 0;
}
};
@@ -716,6 +771,75 @@ export const getFilterName = (
return resolveFilterName(filter);
};
/**
* @param {array} rules
* @param {array} filters
* @param {array} whitelistFilters
* @returns {string[]}
*/
export const getFilterNames = (rules, filters, whitelistFilters) => rules.map(
({ filter_list_id }) => getFilterName(filters, whitelistFilters, filter_list_id),
);
/**
* @param {array} rules
* @returns {string[]}
*/
export const getRuleNames = (rules) => rules.map(({ text }) => text);
/**
* @param {array} rules
* @param {array} filters
* @param {array} whitelistFilters
* @returns {object}
*/
export const getFilterNameToRulesMap = (rules, filters, whitelistFilters) => rules.reduce(
(acc, { text, filter_list_id }) => {
const filterName = getFilterName(filters, whitelistFilters, filter_list_id);
acc[filterName] = (acc[filterName] || []).concat(text);
return acc;
}, {},
);
/**
* @param {array} rules
* @param {array} filters
* @param {array} whitelistFilters
* @param {object} classes
* @returns {JSXElement}
*/
export const getRulesToFilterList = (rules, filters, whitelistFilters, classes = {
list: 'filteringRules',
rule: 'filteringRules__rule font-monospace',
filter: 'filteringRules__filter',
}) => {
const filterNameToRulesMap = getFilterNameToRulesMap(rules, filters, whitelistFilters);
return <dl className={classes.list}>
{Object.entries(filterNameToRulesMap).reduce(
(acc, [filterName, rulesArr]) => acc
.concat(rulesArr.map((rule, i) => <dd key={i} className={classes.rule}>{rule}</dd>))
.concat(<dt className={classes.filter} key={classes.filter}>{filterName}</dt>),
[],
)}
</dl>;
};
/**
* @param {array} rules
* @param {array} filters
* @param {array} whitelistFilters
* @returns {string}
*/
export const getRulesAndFilterNames = (rules, filters, whitelistFilters) => {
const filterNameToRulesMap = getFilterNameToRulesMap(rules, filters, whitelistFilters);
return Object.entries(filterNameToRulesMap).map(
([filterName, filterRules]) => filterRules.concat(filterName).join('\n'),
).join('\n\n');
};
/**
* @param ip {string}
* @param gateway_ip {string}

View File

@@ -31,7 +31,7 @@ const getFormattedWhois = (whois) => {
* @param {object} info.whois_info
* @param {boolean} [isDetailed]
* @param {boolean} [isLogs]
* @returns {JSX.Element}
* @returns {JSXElement}
*/
export const renderFormattedClientCell = (value, info, isDetailed = false, isLogs = false) => {
let whoisContainer = null;

View File

@@ -9,6 +9,8 @@ import {
R_URL_REQUIRES_PROTOCOL,
STANDARD_WEB_PORT,
UNSAFE_PORTS,
R_CLIENT_ID,
R_DOMAIN,
} from './constants';
import { getLastIpv4Octet, isValidAbsolutePath } from './form';
@@ -16,7 +18,7 @@ import { getLastIpv4Octet, isValidAbsolutePath } from './form';
// https://redux-form.com/8.3.0/examples/fieldlevelvalidation/
// If the value is valid, the validation function should return undefined.
/**
* @param value {string}
* @param value {string|number}
* @returns {undefined|string}
*/
export const validateRequiredValue = (value) => {
@@ -64,19 +66,35 @@ export const validateClientId = (value) => {
if (!value) {
return undefined;
}
const formattedValue = value ? value.trim() : value;
const formattedValue = value.trim();
if (formattedValue && !(
R_IPV4.test(formattedValue)
|| R_IPV6.test(formattedValue)
|| R_MAC.test(formattedValue)
|| R_CIDR.test(formattedValue)
|| R_CIDR_IPV6.test(formattedValue)
|| R_CLIENT_ID.test(formattedValue)
)) {
return 'form_error_client_id_format';
}
return undefined;
};
/**
* @param value {string}
* @returns {undefined|string}
*/
export const validateServerName = (value) => {
if (!value) {
return undefined;
}
const formattedValue = value ? value.trim() : value;
if (formattedValue && !R_DOMAIN.test(formattedValue)) {
return 'form_error_server_name';
}
return undefined;
};
/**
* @param value {string}
* @returns {undefined|string}

View File

@@ -12,7 +12,7 @@ const renderItem = ({
return <li key={ip}>{isDns
? <strong>{dnsAddress}</strong>
: <a href={webAddress}>{webAddress}</a>
: <a href={webAddress} target="_blank" rel="noopener noreferrer">{webAddress}</a>
}
</li>;
};
@@ -41,16 +41,13 @@ const AddressList = ({
AddressList.propTypes = {
interfaces: PropTypes.object.isRequired,
address: PropTypes.string.isRequired,
port: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
]),
port: PropTypes.number.isRequired,
isDns: PropTypes.bool,
};
renderItem.propTypes = {
ip: PropTypes.string.isRequired,
port: PropTypes.string.isRequired,
port: PropTypes.number.isRequired,
isDns: PropTypes.bool.isRequired,
};

View File

@@ -1,3 +1,9 @@
@media screen and (max-width: 767px) {
input, select, textarea {
font-size: 16px !important;
}
}
.setup {
min-height: calc(100vh - 71px);
line-height: 1.48;

View File

@@ -1,3 +1,9 @@
@media screen and (max-width: 767px) {
input, select, textarea {
font-size: 16px !important;
}
}
.login {
display: flex;
flex-direction: column;

View File

@@ -24,13 +24,7 @@ const access = handleActions(
[actions.setAccessListRequest]: (state) => ({ ...state, processingSet: true }),
[actions.setAccessListFailure]: (state) => ({ ...state, processingSet: false }),
[actions.setAccessListSuccess]: (state) => {
const newState = {
...state,
processingSet: false,
};
return newState;
},
[actions.setAccessListSuccess]: (state) => ({ ...state, processingSet: false }),
[actions.toggleClientBlockRequest]: (state) => ({ ...state, processingSet: true }),
[actions.toggleClientBlockFailure]: (state) => ({ ...state, processingSet: false }),

View File

@@ -9,6 +9,8 @@ const encryption = handleActions({
const newState = {
...state,
...payload,
/* TODO: handle property delete on api refactor */
server_name: payload.server_name || '',
processing: false,
};
return newState;
@@ -20,6 +22,7 @@ const encryption = handleActions({
const newState = {
...state,
...payload,
server_name: payload.server_name || '',
processingConfig: false,
};
return newState;
@@ -49,6 +52,7 @@ const encryption = handleActions({
subject,
warning_validation,
dns_names,
server_name: payload.server_name || '',
processingValidate: false,
};
return newState;

6
client2/.eslintignore Normal file
View File

@@ -0,0 +1,6 @@
scripts
node_modules
postcss.config.js
src/lib/entities
src/lib/apis
openApi

5
client2/.eslintrc Normal file
View File

@@ -0,0 +1,5 @@
{
"extends": [
"./scripts/lint/dev.js"
]
}

18
client2/declaration.d.ts vendored Normal file
View File

@@ -0,0 +1,18 @@
declare module '*.pcss' {
const content: {[className: string]: string};
export default content;
}
declare module '*.css' {
const content: {[className: string]: string};
export default content;
}
declare module '*.png'
declare module '*.jpg'
declare let AUTH_TOKEN: string;
declare let MAIN_TOKEN: string | undefined;
declare let NO_CAPTCHA: boolean | undefined;
declare module 'dygraphs';
declare module '@novnc/novnc/core/rfb';
// cp - CloudPayments script
declare let cp: any;
declare const DEV: any;

92
client2/package.json Normal file
View File

@@ -0,0 +1,92 @@
{
"author": "Performix",
"private": true,
"name": "adguard-home",
"version": "0.1.0",
"scripts": {
"build": "rm -rf ../build2 && yarn install && webpack --config ./scripts/webpack/webpack.config.prod.js",
"start": "webpack serve --config ./scripts/webpack/webpack.config.dev.js",
"generate": "rm -rf ./src/lib/entities ./src/lib/apis && ts-node --compiler-options '{ \"module\": \"CommonJS\" }' ./scripts/generator/index.ts",
"translations:check": "ts-node --compiler-options '{ \"module\": \"CommonJS\" }' ./scripts/plugins/checkTranslations.ts",
"lint": "eslint -c ./scripts/lint/prod.js --ext .tsx --ext .ts ./",
"go:build": "cd .. && make REBUILD_CLIENT=0 build",
"go:run": "sudo ../AdguardHome"
},
"husky": {
"hooks": {
"pre-commit": "yarn lint"
}
},
"license": "ISC",
"dependencies": {
"@sentry/react": "^5.27.0",
"antd": "^4.7.2",
"classnames": "^2.2.6",
"dayjs": "^1.9.3",
"formik": "^2.2.0",
"mobx": "^6.0.1",
"mobx-react-lite": "^3.0.1",
"qs": "^6.9.4",
"react": "^17.0.0",
"react-dom": "^17.0.0",
"react-router-dom": "^5.2.0"
},
"devDependencies": {
"@types/classnames": "^2.2.10",
"@types/qs": "^6.9.5",
"@types/react": "^16.9.53",
"@types/react-dom": "^16.9.8",
"@types/react-redux": "^7.1.9",
"@types/react-router-dom": "^5.1.6",
"@typescript-eslint/eslint-plugin": "^4.5.0",
"@typescript-eslint/parser": "^4.5.0",
"antd-dayjs-webpack-plugin": "^1.0.1",
"autoprefixer": "^10.0.1",
"connect-history-api-fallback": "^1.6.0",
"copy-webpack-plugin": "^6.2.1",
"css-loader": "^5.0.0",
"eslint": "^7.11.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-config-airbnb-typescript": "^12.0.0",
"eslint-import-resolver-typescript": "^2.3.0",
"eslint-loader": "^4.0.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react-hooks": "^4.2.0",
"file-loader": "^6.1.1",
"html-webpack-plugin": "^4.5.0",
"http-proxy-middleware": "^1.0.6",
"husky": "^4.3.0",
"less": "^3.12.2",
"less-loader": "^5.0.0",
"mini-css-extract-plugin": "^1.1.1",
"optimize-css-assets-webpack-plugin": "^5.0.4",
"postcss": "^8.1.2",
"postcss-calc": "^7.0.5",
"postcss-css-variables": "^0.17.0",
"postcss-custom-media": "^7.0.8",
"postcss-import": "^13.0.0",
"postcss-inline-svg": "^4.1.0",
"postcss-loader": "^4.0.4",
"postcss-mixins": "^7.0.1",
"postcss-modules": "^3.2.2",
"postcss-nested": "^5.0.1",
"postcss-preset-env": "^6.7.0",
"postcss-reporter": "^7.0.1",
"postcss-variables": "^1.1.1",
"style-loader": "^2.0.0",
"stylelint": "^13.7.2",
"stylelint-webpack-plugin": "^2.1.1",
"terser-webpack-plugin": "^5.0.0",
"ts-loader": "^8.0.6",
"ts-morph": "^8.1.2",
"ts-node": "^9.0.0",
"typescript": "^4.0.3",
"url-loader": "^4.1.1",
"webpack": "^5.10.0",
"webpack-cli": "^4.2.0",
"webpack-dev-server": "^3.11.0",
"webpack-merge": "^5.2.0",
"yaml": "^1.10.0"
}
}

17
client2/postcss.config.js Normal file
View File

@@ -0,0 +1,17 @@
module.exports = {
plugins: [
['postcss-import', {}],
['postcss-nested', {}],
['postcss-custom-media', {}],
['postcss-variables', {}],
['postcss-calc', {}],
['postcss-mixins', {}],
['postcss-preset-env', { stage: 3, features: { 'nesting-rules': true } }],
['postcss-reporter', { clearMessages: true }],
['postcss-inline-svg', {
paths: ['frontend/icons', 'vendor/adguard/utils-bundle/src/Resources/frontend/icons'],
svgo: { plugins: [{ cleanupAttrs: true }] }
}],
['autoprefixer'],
]
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16pt" height="16pt"
viewBox="0 0 16 16" version="1.1">
<g id="surface1">
<path style=" stroke:none;fill-rule:evenodd;fill:rgb(0%,0%,0%);fill-opacity:1;"
d="M 8 0 C 10.5 0 13.515625 0.574219 16 1.835938 L 15.996094 2.542969 C 15.957031 5.605469 15.410156 11.71875 8 16 C 0.5 11.667969 0.03125 5.460938 0.00390625 2.433594 L 0 1.835938 C 2.484375 0.574219 5.5 0 8 0 Z M 11.769531 4.203125 L 11.761719 4.203125 L 7.890625 8.160156 L 6.433594 6.4375 C 5.738281 5.644531 4.792969 6.25 4.570312 6.40625 L 7.929688 10.285156 L 12.570312 4.136719 C 12.230469 3.867188 11.933594 4.054688 11.769531 4.203125 Z M 11.769531 4.203125 "/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 801 B

23
client2/public/index.html Normal file
View File

@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<meta name="google" content="notranslate">
<meta http-equiv="x-dns-prefetch-control" content="off">
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<link rel="apple-touch-icon" sizes="180x180" href="assets/apple-touch-icon-180x180.png" />
<link rel="mask-icon" href="assets/safari-pinned-tab.svg" color="#67B279">
<link rel="icon" type="image/png" href="assets/favicon.png" sizes="48x48">
<title>AdGuard Home</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="app"></div>
</body>
</html>

View File

@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<meta name="google" content="notranslate">
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<link rel="apple-touch-icon" sizes="180x180" href="assets/apple-touch-icon-180x180.png" />
<link rel="mask-icon" href="assets/safari-pinned-tab.svg" color="#67B279">
<link rel="icon" type="image/png" href="assets/favicon.png" sizes="48x48">
<title>Setup AdGuard Home</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="app"></div>
</body>
</html>

22
client2/public/login.html Normal file
View File

@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<meta name="google" content="notranslate">
<link rel="apple-touch-icon" sizes="180x180" href="assets/apple-touch-icon-180x180.png" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<link rel="mask-icon" href="assets/safari-pinned-tab.svg" color="#67B279">
<link rel="icon" type="image/png" href="assets/favicon.png" sizes="48x48">
<title>Login</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="app"></div>
</body>
</html>

12
client2/scripts/consts.ts Normal file
View File

@@ -0,0 +1,12 @@
export const OPEN_API_PATH = '../openapi/openapi.yaml';
export const ENT_DIR = './src/lib/entities';
export const API_DIR = './src/lib/apis';
export const LOCALE_FOLDER_PATH = './src/lib/intl/__locales';
export const TRANSLATOR_CLASS_NAME = 'Translator';
export const USE_INTL_NAME = 'useIntl';
export const trimQuotes = (str: string) => {
return str.replace(/\'|\"/g, '');
};
export const GENERATOR_ENTITY_ALLIAS = 'Entities/';

View File

@@ -0,0 +1,18 @@
import * as fs from 'fs';
import * as YAML from 'yaml';
import { OPEN_API_PATH } from '../consts';
import EntitiesGenerator from './src/generateEntities';
import ApisGenerator from './src/generateApis';
const generateApi = (openApi: Record<string, any>) => {
const ent = new EntitiesGenerator(openApi);
ent.save();
const api = new ApisGenerator(openApi);
api.save();
}
const openApiFile = fs.readFileSync(OPEN_API_PATH, 'utf8');
generateApi(YAML.parse(openApiFile));

View File

@@ -0,0 +1,317 @@
/* eslint-disable no-template-curly-in-string */
/* eslint-disable @typescript-eslint/no-unused-expressions */
import * as fs from 'fs';
import * as path from 'path';
import { stringify } from 'qs';
// eslint-disable-next-line import/no-extraneous-dependencies
import * as morph from 'ts-morph';
import {
API_DIR as API_DIR_CONST,
GENERATOR_ENTITY_ALLIAS,
} from '../../consts';
import { toCamel, capitalize, schemaParamParser } from './utils';
const API_DIR = path.resolve(API_DIR_CONST);
if (!fs.existsSync(API_DIR)) {
fs.mkdirSync(API_DIR);
}
const { Project, QuoteKind } = morph;
class ApiGenerator {
project = new Project({
tsConfigFilePath: './tsconfig.json',
addFilesFromTsConfig: false,
manipulationSettings: {
quoteKind: QuoteKind.Single,
usePrefixAndSuffixTextForRename: false,
useTrailingCommas: true,
},
});
openapi: Record<string, any>;
serverUrl: string;
paths: any;
/* interface Controllers {
[controller: string]: {
[operationId: string]: { parameters - from opneApi, responses - from opneApi, method }
}
} */
controllers: Record<string, any> = {};
apis: morph.SourceFile[] = [];
constructor(openapi: Record<string, any>) {
this.openapi = openapi;
this.paths = openapi.paths;
this.serverUrl = openapi.servers[0].url;
Object.keys(this.paths).forEach((pathKey) => {
Object.keys(this.paths[pathKey]).forEach((method) => {
const {
tags, operationId, parameters, responses, requestBody, security,
} = this.paths[pathKey][method];
const controller = toCamel((tags ? tags[0] : pathKey.split('/')[1]).replace('-controller', ''));
if (this.controllers[controller]) {
this.controllers[controller][operationId] = {
parameters,
responses,
method,
requestBody,
security,
pathKey: pathKey.replace(/{/g, '${'),
};
} else {
this.controllers[controller] = { [operationId]: {
parameters,
responses,
method,
requestBody,
security,
pathKey: pathKey.replace(/{/g, '${'),
} };
}
});
});
this.generateApiFiles();
}
generateApiFiles = () => {
Object.keys(this.controllers).forEach(this.generateApiFile);
};
generateApiFile = (cName: string) => {
const apiFile = this.project.createSourceFile(`${API_DIR}/${cName}.ts`);
apiFile.addStatements([
'// This file was autogenerated. Please do not change.',
'// All changes will be overwrited on commit.',
'',
]);
// const schemaProperties = schemas[schemaName].properties;
const importEntities: any[] = [];
// add api class to file
const apiClass = apiFile.addClass({
name: `${capitalize(cName)}Api`,
isDefaultExport: true,
});
// get operations of controller
const controllerOperations = this.controllers[cName];
const operationList = Object.keys(controllerOperations).sort();
// for each operation add fetcher
operationList.forEach((operation) => {
const {
requestBody, responses, parameters, method, pathKey, security,
} = controllerOperations[operation];
const queryParams: any[] = []; // { name, type }
const bodyParam: any[] = []; // { name, type }
let hasResponseBodyType: /* boolean | ReturnType<schemaParamParser> */ false | [string, boolean, boolean, boolean, boolean] = false;
let contentType = '';
if (parameters) {
parameters.forEach((p: any) => {
const [
pType, isArray, isClass, isImport,
] = schemaParamParser(p.schema, this.openapi);
if (isImport) {
importEntities.push({ type: pType, isClass });
}
if (p.in === 'query') {
queryParams.push({
name: p.name, type: `${pType}${isArray ? '[]' : ''}`, hasQuestionToken: !p.required });
}
});
}
if (queryParams.length > 0) {
const imp = apiFile.getImportDeclaration((i) => {
return i.getModuleSpecifierValue() === 'qs';
}); if (!imp) {
apiFile.addImportDeclaration({
moduleSpecifier: 'qs',
defaultImport: 'qs',
});
}
}
if (requestBody) {
let content = requestBody.content;
const { $ref }: { $ref: string } = requestBody;
if (!content && $ref) {
const name = $ref.split('/').pop() as string;
content = this.openapi.components.requestBodies[name].content;
}
[contentType] = Object.keys(content);
const data = content[contentType];
const [
pType, isArray, isClass, isImport,
] = schemaParamParser(data.schema, this.openapi);
if (isImport) {
importEntities.push({ type: pType, isClass });
bodyParam.push({ name: pType.toLowerCase(), type: `${isClass ? 'I' : ''}${pType}${isArray ? '[]' : ''}`, isClass, pType });
} else {
bodyParam.push({ name: 'data', type: `${pType}${isArray ? '[]' : ''}` });
}
}
if (responses['200']) {
const { content, headers } = responses['200'];
if (content && (content['*/*'] || content['application/json'])) {
const { schema, examples } = content['*/*'] || content['application/json'];
if (!schema) {
process.exit(0);
}
const propType = schemaParamParser(schema, this.openapi);
const [pType, , isClass, isImport] = propType;
if (isImport) {
importEntities.push({ type: pType, isClass });
}
hasResponseBodyType = propType;
}
}
let returnType = '';
if (hasResponseBodyType) {
const [pType, isArray, isClass] = hasResponseBodyType as any;
let data = `Promise<${isClass ? 'I' : ''}${pType}${isArray ? '[]' : ''}`;
returnType = data;
} else {
returnType = 'Promise<number';
}
const shouldValidate = bodyParam.filter(b => b.isClass);
if (shouldValidate.length > 0) {
returnType += ' | string[]';
}
// append Error to default type return;
returnType += ' | Error>';
const fetcher = apiClass.addMethod({
isAsync: true,
isStatic: true,
name: operation,
returnType,
});
const params = [...queryParams, ...bodyParam].sort((a, b) => (Number(!!a.hasQuestionToken) - Number(!!b.hasQuestionToken)));
fetcher.addParameters(params);
fetcher.setBodyText((w) => {
// Add data to URLSearchParams
if (contentType === 'text/plain') {
bodyParam.forEach((b) => {
w.writeLine(`const params = String(${b.name});`);
});
} else {
if (shouldValidate.length > 0) {
w.writeLine(`const haveError: string[] = [];`);
shouldValidate.forEach((b) => {
w.writeLine(`const ${b.name}Valid = new ${b.pType}(${b.name});`);
w.writeLine(`haveError.push(...${b.name}Valid.validate());`);
});
w.writeLine(`if (haveError.length > 0) {`);
w.writeLine(` return Promise.resolve(haveError);`)
w.writeLine(`}`);
}
}
// Switch return of fetch in case on queryParams
if (queryParams.length > 0) {
w.writeLine('const queryParams = {');
queryParams.forEach((q) => {
w.writeLine(` ${q.name}: ${q.name},`);
});
w.writeLine('}');
w.writeLine(`return await fetch(\`${this.serverUrl}${pathKey}?\${qs.stringify(queryParams, { arrayFormat: 'comma' })}\`, {`);
} else {
w.writeLine(`return await fetch(\`${this.serverUrl}${pathKey}\`, {`);
}
// Add method
w.writeLine(` method: '${method.toUpperCase()}',`);
// add Fetch options
if (contentType && contentType !== 'multipart/form-data') {
w.writeLine(' headers: {');
w.writeLine(` 'Content-Type': '${contentType}',`);
w.writeLine(' },');
}
if (contentType) {
switch (contentType) {
case 'text/plain':
w.writeLine(' body: params,');
break;
default:
w.writeLine(` body: JSON.stringify(${bodyParam.map((b) => b.isClass ? `${b.name}Valid.serialize()` : b.name).join(', ')}),`);
break;
}
}
// Handle response
if (hasResponseBodyType) {
w.writeLine('}).then(async (res) => {');
w.writeLine(' if (res.status === 200) {');
w.writeLine(' return res.json();');
} else {
w.writeLine('}).then(async (res) => {');
w.writeLine(' if (res.status === 200) {');
w.writeLine(' return res.status;');
}
// Handle Error
w.writeLine(' } else {');
w.writeLine(' return new Error(String(res.status));');
w.writeLine(' }');
w.writeLine('})');
});
});
const imports: any[] = [];
const types: string[] = [];
importEntities.forEach((i) => {
const { type } = i;
if (!types.includes(type)) {
imports.push(i);
types.push(type);
}
});
imports.sort((a,b) => a.type > b.type ? 1 : -1).forEach((ie) => {
const { type: pType, isClass } = ie;
if (isClass) {
apiFile.addImportDeclaration({
moduleSpecifier: `${GENERATOR_ENTITY_ALLIAS}${pType}`,
defaultImport: pType,
namedImports: [`I${pType}`],
});
} else {
apiFile.addImportDeclaration({
moduleSpecifier: `${GENERATOR_ENTITY_ALLIAS}${pType}`,
namedImports: [pType],
});
}
});
this.apis.push(apiFile);
};
save = () => {
this.apis.forEach(async (e) => {
await e.saveSync();
});
};
}
export default ApiGenerator;

View File

@@ -0,0 +1,519 @@
import * as fs from 'fs';
import * as path from 'path';
// eslint-disable-next-line import/no-extraneous-dependencies
import * as morph from 'ts-morph';
import { ENT_DIR } from '../../consts';
import { TYPES, toCamel, schemaParamParser } from './utils';
const { Project, QuoteKind } = morph;
const EntDir = path.resolve(ENT_DIR);
if (!fs.existsSync(EntDir)) {
fs.mkdirSync(EntDir);
}
class EntitiesGenerator {
project = new Project({
tsConfigFilePath: './tsconfig.json',
addFilesFromTsConfig: false,
manipulationSettings: {
quoteKind: QuoteKind.Single,
usePrefixAndSuffixTextForRename: false,
useTrailingCommas: true,
},
});
openapi: Record<string, any>;
schemas: Record<string, any>;
schemaNames: string[];
entities: morph.SourceFile[] = [];
constructor(openapi: Record<string, any>) {
this.openapi = openapi;
this.schemas = openapi.components.schemas;
this.schemaNames = Object.keys(this.schemas);
this.generateEntities();
}
generateEntities = () => {
this.schemaNames.forEach(this.generateEntity);
};
generateEntity = (sName: string) => {
const { properties, type, oneOf } = this.schemas[sName];
const notAClass = !properties && TYPES[type as keyof typeof TYPES];
if (oneOf) {
this.generateOneOf(sName);
return;
}
if (notAClass) {
this.generateEnum(sName);
} else {
this.generateClass(sName);
}
};
generateEnum = (sName: string) => {
const entityFile = this.project.createSourceFile(`${EntDir}/${sName}.ts`);
entityFile.addStatements([
'// This file was autogenerated. Please do not change.',
'// All changes will be overwrited on commit.',
'',
]);
const { enum: enumMembers } = this.schemas[sName];
entityFile.addEnum({
name: sName,
members: enumMembers.map((e: string) => ({ name: e.toUpperCase(), value: e })),
isExported: true,
});
this.entities.push(entityFile);
};
generateOneOf = (sName: string) => {
const entityFile = this.project.createSourceFile(`${EntDir}/${sName}.ts`);
entityFile.addStatements([
'// This file was autogenerated. Please do not change.',
'// All changes will be overwrited on commit.',
'',
]);
const importEntities: { type: string, isClass: boolean }[] = [];
const entities = this.schemas[sName].oneOf.map((elem: any) => {
const [
pType, isArray, isClass, isImport,
] = schemaParamParser(elem, this.openapi);
importEntities.push({ type: pType, isClass });
return { type: pType, isArray };
});
entityFile.addTypeAlias({
name: sName,
isExported: true,
type: entities.map((e: any) => e.isArray ? `I${e.type}[]` : `I${e.type}`).join(' | '),
})
// add import
importEntities.sort((a, b) => a.type > b.type ? 1 : -1).forEach((ie) => {
const { type: pType, isClass } = ie;
if (isClass) {
entityFile.addImportDeclaration({
moduleSpecifier: `./${pType}`,
namedImports: [`I${pType}`],
});
} else {
entityFile.addImportDeclaration({
moduleSpecifier: `./${pType}`,
namedImports: [pType],
});
}
});
this.entities.push(entityFile);
}
generateClass = (sName: string) => {
const entityFile = this.project.createSourceFile(`${EntDir}/${sName}.ts`);
entityFile.addStatements([
'// This file was autogenerated. Please do not change.',
'// All changes will be overwrited on commit.',
'',
]);
const { properties: sProps, required } = this.schemas[sName];
const importEntities: { type: string, isClass: boolean }[] = [];
const entityInterface = entityFile.addInterface({
name: `I${sName}`,
isExported: true,
});
const sortedSProps = Object.keys(sProps || {}).sort();
// add server response interface to entityFile
sortedSProps.forEach((sPropName) => {
const [
pType, isArray, isClass, isImport, isAdditional
] = schemaParamParser(sProps[sPropName], this.openapi);
if (isImport) {
importEntities.push({ type: pType, isClass });
}
const propertyType = isAdditional
? `{ [key: string]: ${isClass ? 'I' : ''}${pType}${isArray ? '[]' : ''} }`
: `${isClass ? 'I' : ''}${pType}${isArray ? '[]' : ''}`;
entityInterface.addProperty({
name: sPropName,
type: propertyType,
hasQuestionToken: !(
(required && required.includes(sPropName)) || sProps[sPropName].required
),
});
});
// add import
const imports: { type: string, isClass: boolean }[] = [];
const types: string[] = [];
importEntities.forEach((i) => {
const { type } = i;
if (!types.includes(type)) {
imports.push(i);
types.push(type);
}
});
imports.sort((a, b) => a.type > b.type ? 1 : -1).forEach((ie) => {
const { type: pType, isClass } = ie;
if (isClass) {
entityFile.addImportDeclaration({
defaultImport: pType,
moduleSpecifier: `./${pType}`,
namedImports: [`I${pType}`],
});
} else {
entityFile.addImportDeclaration({
moduleSpecifier: `./${pType}`,
namedImports: [pType],
});
}
});
const entityClass = entityFile.addClass({
name: sName,
isDefaultExport: true,
});
// addProperties to class;
sortedSProps.forEach((sPropName) => {
const [pType, isArray, isClass, isImport, isAdditional] = schemaParamParser(sProps[sPropName], this.openapi);
const isRequred = (required && required.includes(sPropName))
|| sProps[sPropName].required;
const propertyType = isAdditional
? `{ [key: string]: ${pType}${isArray ? '[]' : ''}${isRequred ? '' : ' | undefined'} }`
: `${pType}${isArray ? '[]' : ''}${isRequred ? '' : ' | undefined'}`;
entityClass.addProperty({
name: `_${sPropName}`,
isReadonly: true,
type: propertyType,
});
const getter = entityClass.addGetAccessor({
name: toCamel(sPropName),
returnType: propertyType,
statements: [`return this._${sPropName};`],
});
const { description, example, minItems, maxItems, maxLength, minLength, maximum, minimum } = sProps[sPropName];
if (description || example) {
getter.addJsDoc(`${example ? `Description: ${description}` : ''}${example ? `\nExample: ${example}` : ''}`);
}
if (minItems) {
entityClass.addGetAccessor({
isStatic: true,
name: `${toCamel(sPropName)}MinItems`,
statements: [`return ${minItems};`],
});
}
if (maxItems) {
entityClass.addGetAccessor({
isStatic: true,
name: `${toCamel(sPropName)}MaxItems`,
statements: [`return ${maxItems};`],
});
}
if (typeof minLength === 'number') {
entityClass.addGetAccessor({
isStatic: true,
name: `${toCamel(sPropName)}MinLength`,
statements: [`return ${minLength};`],
});
}
if (maxLength) {
entityClass.addGetAccessor({
isStatic: true,
name: `${toCamel(sPropName)}MaxLength`,
statements: [`return ${maxLength};`],
});
}
if (typeof minimum === 'number') {
entityClass.addGetAccessor({
isStatic: true,
name: `${toCamel(sPropName)}MinValue`,
statements: [`return ${minimum};`],
});
}
if (maximum) {
entityClass.addGetAccessor({
isStatic: true,
name: `${toCamel(sPropName)}MaxValue`,
statements: [`return ${maximum};`],
});
}
if (!(isArray && isClass) && !isClass) {
const isEnum = !isClass && isImport;
const isRequired = (required && required.includes(sPropName)) || sProps[sPropName].required;
const { maxLength, minLength, maximum, minimum } = sProps[sPropName];
const haveValidationFields = maxLength || typeof minLength === 'number' || maximum || typeof minimum === 'number';
if (isRequired || haveValidationFields) {
const prop = toCamel(sPropName);
const validateField = entityClass.addMethod({
isStatic: true,
name: `${prop}Validate`,
returnType: `boolean`,
parameters: [{
name: prop,
type: `${pType}${isArray ? '[]' : ''}${isRequred ? '' : ' | undefined'}`,
}],
})
validateField.setBodyText((w) => {
w.write('return ');
const nonRequiredCall = isRequired ? prop : `!${prop} ? true : ${prop}`;
if (pType === 'string') {
if (isArray) {
w.write(`${nonRequiredCall}.reduce<boolean>((result, p) => result && (typeof p === 'string' && !!p.trim()), true)`);
} else {
if (typeof minLength === 'number' && maxLength) {
w.write(`(${nonRequiredCall}.length >${minLength > 0 ? '=' : ''} ${minLength}) && (${nonRequiredCall}.length <= ${maxLength})`);
}
if (typeof minLength !== 'number' || !maxLength) {
w.write(`${isRequired ? `typeof ${prop} === 'string'` : `!${prop} ? true : typeof ${prop} === 'string'`} && !!${nonRequiredCall}.trim()`);
}
}
} else if (pType === 'number') {
if (isArray) {
w.write(`${nonRequiredCall}.reduce<boolean>((result, p) => result && typeof p === 'number', true)`);
} else {
if (typeof minimum === 'number' && maximum) {
w.write(`${isRequired ? `${prop} >= ${minimum} && ${prop} <= ${maximum}` : `!${prop} ? true : ((${prop} >= ${minimum}) && (${prop} <= ${maximum}))`}`);
}
if (typeof minimum !== 'number' || !maximum) {
w.write(`${isRequired ? `typeof ${prop} === 'number'` : `!${prop} ? true : typeof ${prop} === 'number'`}`);
}
}
} else if (pType === 'boolean') {
w.write(`${isRequired ? `typeof ${prop} === 'boolean'` : `!${prop} ? true : typeof ${prop} === 'boolean'`}`);
} else if (isEnum) {
if (isArray){
w.write(`${nonRequiredCall}.reduce<boolean>((result, p) => result && Object.keys(${pType}).includes(${prop}), true)`);
} else {
w.write(`${isRequired ? `Object.keys(${pType}).includes(${prop})` : `!${prop} ? true : typeof ${prop} === 'boolean'`}`);
}
}
w.write(';');
});
}
}
});
// add constructor;
const ctor = entityClass.addConstructor({
parameters: [{
name: 'props',
type: `I${sName}`,
}],
});
ctor.setBodyText((w) => {
sortedSProps.forEach((sPropName) => {
const [
pType, isArray, isClass, , isAdditional
] = schemaParamParser(sProps[sPropName], this.openapi);
const req = (required && required.includes(sPropName))
|| sProps[sPropName].required;
if (!req) {
if ((pType === 'boolean' || pType === 'number' || pType ==='string') && !isClass && !isArray) {
w.writeLine(`if (typeof props.${sPropName} === '${pType}') {`);
} else {
w.writeLine(`if (props.${sPropName}) {`);
}
}
if (isAdditional) {
if (isArray && isClass) {
w.writeLine(`${!req ? ' ' : ''}this._${sPropName} = props.${sPropName}.map((p) => Object.keys(p).reduce((prev, key) => {
return { ...prev, [key]: new ${pType}(p[key])};
},{}))`);
} else if (isClass) {
w.writeLine(`${!req ? ' ' : ''}this._${sPropName} = Object.keys(props.${sPropName}).reduce((prev, key) => {
return { ...prev, [key]: new ${pType}(props.${sPropName}[key])};
},{})`);
} else {
if (pType === 'string' && !isArray) {
w.writeLine(`${!req ? ' ' : ''}this._${sPropName} = Object.keys(props.${sPropName}).reduce((prev, key) => {
return { ...prev, [key]: props.${sPropName}[key].trim()};
},{})`);
} else {
w.writeLine(`${!req ? ' ' : ''}this._${sPropName} = Object.keys(props.${sPropName}).reduce((prev, key) => {
return { ...prev, [key]: props.${sPropName}[key]};
},{})`);
}
}
} else {
if (isArray && isClass) {
w.writeLine(`${!req ? ' ' : ''}this._${sPropName} = props.${sPropName}.map((p) => new ${pType}(p));`);
} else if (isClass) {
w.writeLine(`${!req ? ' ' : ''}this._${sPropName} = new ${pType}(props.${sPropName});`);
} else {
if (pType === 'string' && !isArray) {
w.writeLine(`${!req ? ' ' : ''}this._${sPropName} = props.${sPropName}.trim();`);
} else {
w.writeLine(`${!req ? ' ' : ''}this._${sPropName} = props.${sPropName};`);
}
}
}
if (!req) {
w.writeLine('}');
}
});
});
// add serialize method;
const serialize = entityClass.addMethod({
isStatic: false,
name: 'serialize',
returnType: `I${sName}`,
});
serialize.setBodyText((w) => {
w.writeLine(`const data: I${sName} = {`);
const unReqFields: string[] = [];
sortedSProps.forEach((sPropName) => {
const req = (required && required.includes(sPropName))
|| sProps[sPropName].required;
const [, isArray, isClass, , isAdditional] = schemaParamParser(sProps[sPropName], this.openapi);
if (!req) {
unReqFields.push(sPropName);
return;
}
if (isAdditional) {
if (isArray && isClass) {
w.writeLine(` ${sPropName}: this._${sPropName}.map((p) => Object.keys(p).reduce((prev, key) => ({ ...prev, [key]: p[key].serialize() }))),`);
} else if (isClass) {
w.writeLine(` ${sPropName}: Object.keys(this._${sPropName}).reduce<Record<string, any>>((prev, key) => ({ ...prev, [key]: this._${sPropName}[key].serialize() }), {}),`);
} else {
w.writeLine(` ${sPropName}: Object.keys(this._${sPropName}).reduce((prev, key) => ({ ...prev, [key]: this._${sPropName}[key] })),`);
}
} else {
if (isArray && isClass) {
w.writeLine(` ${sPropName}: this._${sPropName}.map((p) => p.serialize()),`);
} else if (isClass) {
w.writeLine(` ${sPropName}: this._${sPropName}.serialize(),`);
} else {
w.writeLine(` ${sPropName}: this._${sPropName},`);
}
}
});
w.writeLine('};');
unReqFields.forEach((sPropName) => {
const [, isArray, isClass, , isAdditional] = schemaParamParser(sProps[sPropName], this.openapi);
w.writeLine(`if (typeof this._${sPropName} !== 'undefined') {`);
if (isAdditional) {
if (isArray && isClass) {
w.writeLine(` data.${sPropName} = this._${sPropName}.map((p) => Object.keys(p).reduce((prev, key) => ({ ...prev, [key]: p[key].serialize() }), {}));`);
} else if (isClass) {
w.writeLine(` data.${sPropName} = Object.keys(this._${sPropName}).reduce((prev, key) => ({ ...prev, [key]: this._${sPropName}[key].serialize() }), {});`);
} else {
w.writeLine(` data.${sPropName} = Object.keys(this._${sPropName}).reduce((prev, key) => ({ ...prev, [key]: this._${sPropName}[key] }), {});`);
}
} else {
if (isArray && isClass) {
w.writeLine(` data.${sPropName} = this._${sPropName}.map((p) => p.serialize());`);
} else if (isClass) {
w.writeLine(` data.${sPropName} = this._${sPropName}.serialize();`);
} else {
w.writeLine(` data.${sPropName} = this._${sPropName};`);
}
}
w.writeLine(`}`);
});
w.writeLine('return data;');
});
// add validate method
const validate = entityClass.addMethod({
isStatic: false,
name: 'validate',
returnType: `string[]`,
})
validate.setBodyText((w) => {
w.writeLine('const validate = {');
Object.keys(sProps || {}).forEach((sPropName) => {
const [pType, isArray, isClass, , isAdditional] = schemaParamParser(sProps[sPropName], this.openapi);
const { maxLength, minLength, maximum, minimum } = sProps[sPropName];
const isRequired = (required && required.includes(sPropName)) || sProps[sPropName].required;
const nonRequiredCall = isRequired ? `this._${sPropName}` : `!this._${sPropName} ? true : this._${sPropName}`;
if (isArray && isClass) {
w.writeLine(` ${sPropName}: ${nonRequiredCall}.reduce((result, p) => result && p.validate().length === 0, true),`);
} else if (isClass && !isAdditional) {
w.writeLine(` ${sPropName}: ${nonRequiredCall}.validate().length === 0,`);
} else {
if (pType === 'string') {
if (isArray) {
w.writeLine(` ${sPropName}: ${nonRequiredCall}.reduce((result, p) => result && typeof p === 'string', true),`);
} else {
if (typeof minLength === 'number' && maxLength) {
w.writeLine(` ${sPropName}: (${nonRequiredCall}.length >${minLength > 0 ? '=' : ''} ${minLength}) && (${nonRequiredCall}.length <= ${maxLength}),`);
}
if (typeof minLength !== 'number' || !maxLength) {
w.writeLine(` ${sPropName}: ${isRequired ? `typeof this._${sPropName} === 'string'` : `!this._${sPropName} ? true : typeof this._${sPropName} === 'string'`} && !this._${sPropName} ? true : this._${sPropName},`);
}
}
} else if (pType === 'number') {
if (isArray) {
w.writeLine(` ${sPropName}: ${nonRequiredCall}.reduce((result, p) => result && typeof p === 'number', true),`);
} else {
if (typeof minimum === 'number' && maximum) {
w.writeLine(` ${sPropName}: ${isRequired ? `this._${sPropName} >= ${minimum} && this._${sPropName} <= ${maximum}` : `!this._${sPropName} ? true : ((this._${sPropName} >= ${minimum}) && (this._${sPropName} <= ${maximum}))`},`);
}
if (typeof minimum !== 'number' || !maximum) {
w.writeLine(` ${sPropName}: ${isRequired ? `typeof this._${sPropName} === 'number'` : `!this._${sPropName} ? true : typeof this._${sPropName} === 'number'`},`);
}
}
} else if (pType === 'boolean') {
w.writeLine(` ${sPropName}: ${isRequired ? `typeof this._${sPropName} === 'boolean'` : `!this._${sPropName} ? true : typeof this._${sPropName} === 'boolean'`},`);
}
}
});
w.writeLine('};');
w.writeLine('const isError: string[] = [];')
w.writeLine('Object.keys(validate).forEach((key) => {');
w.writeLine(' if (!(validate as any)[key]) {');
w.writeLine(' isError.push(key);');
w.writeLine(' }');
w.writeLine('});');
w.writeLine('return isError;');
});
// add update method;
const update = entityClass.addMethod({
isStatic: false,
name: 'update',
returnType: `${sName}`,
});
update.addParameter({
name: 'props',
type: `Partial<I${sName}>`,
});
update.setBodyText((w) => { w.writeLine(`return new ${sName}({ ...this.serialize(), ...props });`); });
this.entities.push(entityFile);
};
save = () => {
this.entities.forEach(async (e) => {
await e.saveSync();
});
};
}
export default EntitiesGenerator;

View File

@@ -0,0 +1,74 @@
const toCamel = (s: string) => {
return s.replace(/([-_][a-z])/ig, ($1) => {
return $1.toUpperCase()
.replace('-', '')
.replace('_', '');
});
};
const capitalize = (s: string) => {
return s[0].toUpperCase() + s.slice(1);
};
const TYPES = {
integer: 'number',
float: 'number',
number: 'number',
string: 'string',
boolean: 'boolean',
};
/**
* @param schemaProp: valueof shema.properties[key]
* @param openApi: openapi object
* @returns [propType - basicType or import one, isArray, isClass, isImport]
*/
const schemaParamParser = (schemaProp: any, openApi: any): [string, boolean, boolean, boolean, boolean] => {
let type = '';
let isImport = false;
let isClass = false;
let isArray = false;
let isAdditional = false;
if (schemaProp.$ref || schemaProp.additionalProperties?.$ref) {
const temp = (schemaProp.$ref || schemaProp.additionalProperties?.$ref).split('/');
if (schemaProp.additionalProperties) {
isAdditional = true;
}
type = `${temp[temp.length - 1]}`;
const cl = openApi ? openApi.components.schemas[temp[temp.length - 1]] : {};
if (cl.type === 'string' && cl.enum) {
isImport = true;
}
if (cl.type === 'object' && !cl.oneOf) {
isClass = true;
isImport = true;
} else if (cl.type === 'array') {
const temp: any = schemaParamParser(cl.items, openApi);
type = `${temp[0]}`;
isArray = true;
isClass = isClass || temp[2];
isImport = isImport || temp[3];
}
} else if (schemaProp.type === 'array') {
const temp: any = schemaParamParser(schemaProp.items, openApi);
type = `${temp[0]}`;
isArray = true;
isClass = isClass || temp[2];
isImport = isImport || temp[3];
} else {
type = (TYPES as Record<any, string>)[schemaProp.type];
}
if (!type) {
// TODO: Fix bug with Error fields.
type = 'any';
// throw new Error('Failed to find entity type');
}
return [type, isArray, isClass, isImport, isAdditional];
};
export { TYPES, toCamel, capitalize, schemaParamParser };

View File

@@ -0,0 +1,226 @@
import * as fs from 'fs';
import {
Project,
VariableStatement,
SyntaxKind,
Node,
Statement,
ts,
Identifier,
SourceFile,
} from 'ts-morph';
import {
LOCALE_FOLDER_PATH,
TRANSLATOR_CLASS_NAME,
USE_INTL_NAME,
trimQuotes,
} from '../consts';
import { checkForms, AvailableLocales } from '../../src/localization/Translator';
const project = new Project({
tsConfigFilePath: './tsconfig.json',
});
let lang = 'ru';
let option = '';
if (process.argv.length > 2) {
lang = process.argv[2];
option = process.argv[3];
}
const usedTranslations: string[] = [];
const usedPluralTranslations: string[] = [];
const problemFiles: string[] = [];
const sourceFiles = project.getSourceFiles();
const sourceFilesWithIntl = sourceFiles.filter((sf) => {
return !!sf.getImportDeclarations().find((id) => {
return !!id.getNamedImports().find((ni) => ni.getName() === USE_INTL_NAME)
})
});
const getFileUsedIntl = (statements: Statement<ts.Statement>[]) => {
statements.forEach((s) => {
if (s instanceof VariableStatement) {
s.forEachDescendant((node) => {
let intVariableDeclaration: Identifier = null;
switch (node.getKind()) {
case SyntaxKind.VariableDeclaration:
if (node.getSymbol()) {
const name = node.getSymbol().getName();
const callExp = node.getChildren().find((n) => n.getKind() === SyntaxKind.CallExpression);
if (callExp) {
const callExpIden = callExp.getChildren().find(n => n.getKind() === SyntaxKind.Identifier);
if (callExpIden && callExpIden.getSymbol().getName() === USE_INTL_NAME) {
intVariableDeclaration = node as Identifier;
}
}
}
break;
default:
break;
}
if (intVariableDeclaration) {
intVariableDeclaration.findReferencesAsNodes().forEach((fr) => {
if (fr instanceof Node) {
const parent = fr.getParentIfKind(SyntaxKind.PropertyAccessExpression);
if (parent && (parent.getName() === 'getMessage' || parent.getName() === 'getPlural')) {
const syntaxList = parent.getNextSiblings().find((n) => n.getKind() === SyntaxKind.SyntaxList);
if (syntaxList) {
const id = syntaxList.getChildren()[0];
if (id && id.getKind() !== SyntaxKind.StringLiteral) {
problemFiles.push(fr.getSourceFile().getFilePath());
}
if (id) {
usedTranslations.push(trimQuotes(id.getText()));
if (parent.getName() === 'getPlural') {
usedPluralTranslations.push(trimQuotes(id.getText()));
}
}
}
}
}
})
}
});
}
})
}
const getFileUsedTranslations = (file: SourceFile) => {
const namedImport = file.getImportDeclarations().find((id) => !!id.getNamedImports().find((ni) => ni.getName() === TRANSLATOR_CLASS_NAME));
if (namedImport) {
const identifier = namedImport.getImportClause().getNamedImports().find((iden) => iden.getName() === TRANSLATOR_CLASS_NAME);
const translateReferences = identifier.getNodeProperty('name').findReferencesAsNodes();
if (translateReferences.length > 0) {
translateReferences.forEach((identifierNode) => {
if (identifierNode.getParentIfKind(SyntaxKind.TypeReference)) {
const translatorVariable = identifierNode.getParent().getPreviousSibling().getPreviousSiblingIfKind(SyntaxKind.Identifier);
if (translatorVariable) {
translatorVariable.findReferencesAsNodes().forEach((node) => {
const parent = node.getParentIfKind(SyntaxKind.PropertyAccessExpression);
if (parent && (parent.getName() === 'getMessage' || parent.getName() === 'getPlural')) {
const syntaxList = parent.getNextSiblings().find((n) => n.getKind() === SyntaxKind.SyntaxList);
if (syntaxList) {
const id = syntaxList.getChildren()[0];
if (id && id.getKind() !== SyntaxKind.StringLiteral) {
problemFiles.push(parent.getSourceFile().getFilePath());
}
if (id) {
usedTranslations.push(trimQuotes(id.getText()));
if (parent.getName() === 'getPlural') {
usedPluralTranslations.push(trimQuotes(id.getText()));
}
}
}
}
})
}
}
})
}
}
}
sourceFilesWithIntl.forEach((file) => {
getFileUsedIntl(file.getStatements());
})
const sourceFilesWithTranslator = project.getSourceFiles().filter((sf) => {
return !!sf.getImportDeclarations().find((id) => {
return !!id.getNamedImports().find((ni) => ni.getName() === TRANSLATOR_CLASS_NAME)
})
});
sourceFilesWithTranslator.forEach((file) => {
getFileUsedTranslations(file);
})
const filteredUsedTranslations = Array.from(new Set(usedTranslations));
const filteredUsedPluralTranslations = Array.from(new Set(usedPluralTranslations));
if (problemFiles.length) {
console.warn(`\n============== Files where translation id provided not as string ==============\n`);
console.log(problemFiles.join('\n'));
process.exit(255);
}
const allFiles = fs.readdirSync(LOCALE_FOLDER_PATH);
// Use ru or needed language
const translationFile = allFiles.find((file) => file.includes(`${lang}.json`));
if (!translationFile) {
console.error('File not found');
process.exit(255);
}
const translationsObject = JSON.parse(fs.readFileSync(`./src/lib/intl/__locales/${translationFile}`, { flag: 'r+' }) as unknown as string);
const translations = {
locale: translationFile,
messages: Object.keys(translationsObject),
};
const someMessagesNotFound: string[] = [];
const notUsed: string[] = [];
const notFound: string[] = [];
const checkLocaleMessages = (locale: string, messages: string[]) => {
filteredUsedTranslations.forEach(f => {
if (!messages.includes(f)) {
notFound.push(f);
}
});
messages.forEach(t => {
if (!filteredUsedTranslations.includes(t)) {
notUsed.push(t);
}
});
if (notFound.length > 0) {
someMessagesNotFound.push(locale);
}
}
const render = (data: string[], title: string) => {
console.log(`============ ${title} ============`);
console.table(data);
console.log(`============ ${title} ============`);
}
checkLocaleMessages(translations.locale, translations.messages);
const checkPluralForm = () => {
const pluralFormWrong: string[] = [];
filteredUsedPluralTranslations.forEach((id) => {
const message = translationsObject[id];
if (!checkForms(message, lang as AvailableLocales, id)) {
pluralFormWrong.push(id)
}
});
return pluralFormWrong;
}
const plural = checkPluralForm();
if (!option && (someMessagesNotFound.length || plural.length > 0 )) {
someMessagesNotFound.forEach(locale => console.error(`\nSome translatins for ${locale} was not found!\n`));
plural.forEach(id => console.error(`\nTranslation with id: "${id}" - have wrong number of plural forms!\n`));
process.exit(255);
}
if (option) {
switch (option) {
case '--show-missing': {
render(notFound, 'NotFound')
break;
}
case '--show-unused': {
render(notUsed, 'notUsed')
break;
}
case '--check-plurals': {
render(plural, 'Wrong Plural Form')
}
default: {
if (someMessagesNotFound.length) {
someMessagesNotFound.forEach(locale => console.error(`\nSome translatins for ${locale} was not found!\n\n`));
process.exit(255);
}
}
}
}

View File

@@ -0,0 +1,79 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
ecmaFeatures: {
jsx: true
},
extraFileExtensions: ['mjs', 'tsx', 'ts'],
ecmaVersion: 2020,
sourceType: 'module'
},
plugins: ['react', '@typescript-eslint', 'import'],
env: {
browser: true,
commonjs: true,
es6: true,
es2020: true,
jest: true,
},
settings: {
react: {
pragma: 'React',
version: 'detect',
},
'import/resolver': {
typescript: {
alwaysTryTypes: true
}
},
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
},
rules: {
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/explicit-function-return-type': [0, { allowExpressions: true }],
'@typescript-eslint/indent': ['error', 4],
'@typescript-eslint/interface-name-prefix': [0, { prefixWithI: 'never' }],
'@typescript-eslint/no-explicit-any': [0],
'@typescript-eslint/naming-convention': [2, {
selector: 'enum', format: ['UPPER_CASE', 'PascalCase'],
}],
'@typescript-eslint/no-non-null-assertion': 0,
'arrow-body-style': 'off',
'consistent-return': 0,
curly: [2, 'all'],
'default-case': 0,
'import/no-cycle': 0,
'import/prefer-default-export': 'off',
'import/no-named-as-default': 0,
indent: [0, 4],
'no-alert': 2,
'no-console': 2,
'no-debugger': 2,
'no-underscore-dangle': 'off',
'no-useless-escape': 'off',
'object-curly-newline': 'off',
'react-hooks/exhaustive-deps': 0,
'react/display-name': 0,
'react/jsx-indent-props': ['error', 4],
'react/jsx-indent': ['error', 4],
'react/jsx-one-expression-per-line': 'off',
'react/jsx-props-no-spreading': 0,
'react/prop-types': 'off',
'react/state-in-constructor': 'off',
},
extends: [
'airbnb-base',
'airbnb-typescript/base',
'airbnb/hooks',
'plugin:react/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
],
globals: {},
};

View File

@@ -0,0 +1,10 @@
module.exports = {
rules: {
'no-alert': 0,
'no-debugger': 0,
'no-console': 0,
},
extends: [
'./common',
],
};

View File

@@ -0,0 +1,5 @@
module.exports = {
extends: [
'./common.js',
],
};

View File

@@ -0,0 +1,40 @@
const yaml = require('yaml');
const fs = require('fs');
const ZERO_HOST = '0.0.0.0';
const LOCALHOST = '127.0.0.1';
const DEFAULT_PORT = 80;
const importConfig = () => {
try {
const doc = yaml.parse(fs.readFileSync('../AdguardHome.yaml', 'utf8'));
const { bind_host, bind_port } = doc;
return {
bind_host,
bind_port,
};
} catch (e) {
return {
bind_host: ZERO_HOST,
bind_port: DEFAULT_PORT,
};
}
};
const getDevServerConfig = () => {
const { bind_host: host, bind_port: port } = importConfig();
const { DEV_SERVER_PORT } = process.env;
const devServerHost = host === ZERO_HOST ? LOCALHOST : host;
const devServerPort = 3000 || port + 8000;
return {
host: devServerHost,
port: devServerPort
};
};
module.exports = {
importConfig,
getDevServerConfig
};

View File

@@ -0,0 +1,74 @@
const path = require('path');
const AntdDayjsWebpackPlugin = require('antd-dayjs-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const tsconfig = require('../../tsconfig.json');
const RESOURCES_PATH = path.resolve(__dirname, '../../');
const HTML_PATH = path.resolve(RESOURCES_PATH, 'public/index.html');
const HTML_INSTALL_PATH = path.resolve(RESOURCES_PATH, 'public/install.html');
module.exports = {
entry: {
install: './src/Install.tsx',
main: './src/App.tsx'
},
resolve: {
extensions: ['.tsx', '.ts', '.js', '.pcss'],
alias: Object.keys(tsconfig.compilerOptions.paths).reduce((aliases, key) => {
// Reduce to load aliases from ./tsconfig.json in appropriate for webpack form
const paths = tsconfig.compilerOptions.paths[key].map(p => p.replace('/*', ''));
aliases[key.replace('/*', '')] = path.resolve(
__dirname,
'../../',
tsconfig.compilerOptions.baseUrl,
...paths,
);
return aliases;
}, {}),
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.(woff|woff2)$/,
use: [{
loader: 'file-loader',
options:{
outputPath:'./',
}
}],
},
{
test:/\.(png|jpe?g|gif)$/,
exclude: /(node_modules)/,
use:[{
loader:'file-loader',
options:{
outputPath:'./images',
}
}]
}
],
},
plugins: [
// new AntdDayjsWebpackPlugin()
new HtmlWebpackPlugin({
inject: true,
cache: false,
chunks: ['main'],
template: HTML_PATH,
}),
new HtmlWebpackPlugin({
inject: true,
cache: false,
chunks: ['install'],
filename: 'install.html',
template: HTML_INSTALL_PATH,
}),
],
};

View File

@@ -0,0 +1,113 @@
const history = require('connect-history-api-fallback');
const { merge } = require('webpack-merge');
const path = require('path');
const proxy = require('http-proxy-middleware');
const Webpack = require('webpack');
const { getDevServerConfig } = require('./helpers');
const baseConfig = require('./webpack.config.base');
const target = getDevServerConfig();
const options = {
target: `http://${target.host}:${target.port}`, // target host
changeOrigin: true, // needed for virtual hosted sites
};
const apiProxy = proxy.createProxyMiddleware(options);
module.exports = merge(baseConfig, {
mode: 'development',
output: {
path: path.resolve(__dirname, '../../build2'),
filename: '[name].bundle.js',
},
optimization: {
noEmitOnErrors: true,
},
devServer: {
port: 4000,
historyApiFallback: true,
before: (app) => {
app.use('/control', apiProxy);
app.use(history({
rewrites: [
{
from: /\.(png|jpe?g|gif)$/,
to: (context) => {
const name = context.parsedUrl.pathname.split('/');
return `/images/${name[name.length - 1]}`
}
}, {
from: /\.(woff|woff2)$/,
to: (context) => {
const name = context.parsedUrl.pathname.split('/');
return `/${name[name.length - 1]}`
}
}, {
from: /\.(js|css)$/,
to: (context) => {
const name = context.parsedUrl.pathname.split('/');
return `/${name[name.length - 1]}`
}
}
],
}));
}
},
devtool: 'eval-source-map',
module: {
rules: [
{
enforce: 'pre',
test: /\.tsx?$/,
exclude: /node_modules/,
loader: 'eslint-loader',
options: {
configFile: path.resolve(__dirname, '../lint/dev.js'),
}
},
{
test: (resource) => {
return (
resource.indexOf('.pcss')+1
|| resource.indexOf('.css')+1
|| resource.indexOf('.less')+1
) && !(resource.indexOf('.module.')+1);
},
use: ['style-loader', 'css-loader', 'postcss-loader', {
loader: 'less-loader',
options: {
javascriptEnabled: true,
},
}],
},
{
test: /\.module\.p?css$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
modules: true,
sourceMap: true,
importLoaders: 1,
modules: {
localIdentName: "[name]__[local]___[hash:base64:5]",
}
},
},
'postcss-loader',
],
exclude: /node_modules/,
},
]
},
plugins: [
new Webpack.DefinePlugin({
DEV: true,
'process.env.DEV_SERVER_PORT': JSON.stringify(3000),
}),
new Webpack.HotModuleReplacementPlugin(),
new Webpack.ProgressPlugin(),
],
});

View File

@@ -0,0 +1,91 @@
const path = require('path');
const { merge } = require('webpack-merge');
const baseConfig = require('./webpack.config.base');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const TerserJSPlugin = require('terser-webpack-plugin');
const Webpack = require('webpack');
const CopyPlugin = require('copy-webpack-plugin');
module.exports = merge(baseConfig, {
mode: 'production',
devtool: 'source-map',
output: {
path: path.resolve(__dirname, '../../../build2/static'),
filename: '[name].bundle.[hash:5].js',
publicPath: '/'
},
optimization: {
minimizer: [new TerserJSPlugin({terserOptions: {
output: {
comments: false,
},
},
extractComments: false,
}), new OptimizeCSSAssetsPlugin({})],
splitChunks: {
cacheGroups: {
styles: {
name: 'styles',
test: /\.css$/,
chunks: 'all',
enforce: true,
},
},
},
},
module: {
rules: [
{
test: (resource) => {
return (
resource.indexOf('.pcss')+1
|| resource.indexOf('.css')+1
|| resource.indexOf('.less')+1
) && !(resource.indexOf('.module.')+1);
},
use: [{
loader: MiniCssExtractPlugin.loader,
options: {
esModules: true,
}
}, 'css-loader', 'postcss-loader', {
loader: 'less-loader',
options: {
javascriptEnabled: true,
},
}],
exclude: /node_modules/,
},
{
test: /\.module\.p?css$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
esModules: true,
}
},
{
loader: 'css-loader',
options: {
modules: true,
sourceMap: true,
importLoaders: 1,
},
},
'postcss-loader',
],
exclude: /node_modules/,
}
]
},
plugins: [
new Webpack.DefinePlugin({
DEV: false,
}),
new MiniCssExtractPlugin({
filename: '[name].[hash:5].css',
}),
]
});

18
client2/src/App.tsx Normal file
View File

@@ -0,0 +1,18 @@
import './main.pcss';
import './lib/ant/ant.less';
import React from 'react';
import ReactDOM from 'react-dom';
import Store, { storeValue } from 'Store';
import './lib/ant';
import App from './components/App';
const Container = () => {
return (
<Store.Provider value={storeValue}>
<App/>
</Store.Provider>
);
};
ReactDOM.render(<Container />, document.getElementById('app'));

18
client2/src/Install.tsx Normal file
View File

@@ -0,0 +1,18 @@
import './main.pcss';
import './lib/ant/ant.less';
import React from 'react';
import ReactDOM from 'react-dom';
import Store, { storeValue } from 'Store/installStore';
import './lib/ant';
import Install from './components/Install';
const Container = () => {
return (
<Store.Provider value={storeValue}>
<Install/>
</Store.Provider>
);
};
ReactDOM.render(<Container />, document.getElementById('app'));

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -0,0 +1,16 @@
import { observer } from 'mobx-react-lite';
import React, { FC, useContext } from 'react';
import Store from 'Store';
import Icons from 'Lib/theme/Icons';
const App: FC = observer(() => {
const store = useContext(Store);
return (
<div>
{store.ui.currentLang}
<Icons/>
</div>
);
});
export default App;

View File

@@ -0,0 +1,121 @@
import React, { FC } from 'react';
import { Layout } from 'antd';
import { Formik, FormikHelpers } from 'formik';
import { observer } from 'mobx-react-lite';
import { IInitialConfigurationBeta } from 'Entities/InitialConfigurationBeta';
import Icons from 'Lib/theme/Icons';
import {
DEFAULT_DNS_ADDRESS,
DEFAULT_DNS_PORT,
DEFAULT_IP_ADDRESS,
DEFAULT_IP_PORT,
} from 'Consts/install';
import { notifyError } from 'Common/ui';
import InstallStore from 'Store/stores/Install';
import theme from 'Lib/theme';
import AdminInterface from './components/AdminInterface';
import Auth from './components/Auth';
import DnsServer from './components/DnsServer';
import Stepper from './components/Stepper';
import Welcome from './components/Welcome';
import ConfigureDevices from './components/ConfigureDevices';
const { Content } = Layout;
export type FormValues = IInitialConfigurationBeta & { step: number };
const InstallForm: FC = observer(() => {
const initialValues: FormValues = {
step: 0,
web: {
ip: [DEFAULT_IP_ADDRESS],
port: DEFAULT_IP_PORT,
},
dns: {
ip: [DEFAULT_DNS_ADDRESS],
port: DEFAULT_DNS_PORT,
},
password: '',
username: '',
};
const onNext = async (values: FormValues, { setFieldValue }: FormikHelpers<FormValues>) => {
const currentStep = values.step;
const checker = (condition: boolean, message: string) => {
if (condition) {
setFieldValue('step', currentStep + 1);
} else {
notifyError(message);
}
};
switch (currentStep) {
case 1: {
// web
const check = await InstallStore.checkConfig(values);
checker(check?.web?.status === '', check?.web?.status || '');
break;
}
case 3: {
// dns
const check = await InstallStore.checkConfig(values);
checker(check?.dns?.status === '', check?.dns?.status || '');
break;
}
case 4: {
// configure
const config = await InstallStore.configure(values);
if (config) {
const { web } = values;
window.location.href = `http://${web.ip[0]}:${web.port}`;
}
break;
}
default:
setFieldValue('step', currentStep + 1);
break;
}
};
return (
<Formik
initialValues={initialValues}
onSubmit={onNext}
>
{({ values, handleSubmit, setFieldValue }) => (
<form noValidate onSubmit={handleSubmit}>
<Stepper currentStep={values.step} />
{values.step === 0 && (
<Welcome onNext={() => setFieldValue('step', 1)}/>
)}
{values.step === 1 && (
<AdminInterface values={values} setFieldValue={setFieldValue} />
)}
{values.step === 2 && (
<Auth values={values} setFieldValue={setFieldValue} />
)}
{values.step === 3 && (
<DnsServer values={values} setFieldValue={setFieldValue} />
)}
{values.step === 4 && (
<ConfigureDevices values={values} setFieldValue={setFieldValue} />
)}
</form>
)}
</Formik>
);
});
const Install: FC = () => {
return (
<Layout className={theme.install.layout}>
<Content className={theme.install.container}>
<InstallForm />
</Content>
<Icons/>
</Layout>
);
};
export default Install;

View File

@@ -0,0 +1,142 @@
import React, { FC, useContext } from 'react';
import cn from 'classnames';
import { observer } from 'mobx-react-lite';
import { FormikHelpers } from 'formik';
import { Input, Radio, Switch } from 'Common/controls';
import { DEFAULT_IP_ADDRESS } from 'Consts/install';
import { chechNetworkType, NETWORK_TYPE } from 'Helpers/installHelpers';
import theme from 'Lib/theme';
import Store from 'Store/installStore';
import { FormValues } from '../../Install';
import StepButtons from '../StepButtons';
enum NETWORK_OPTIONS {
ALL = 'all',
CUSTOM = 'custom',
}
interface AdminInterfaceProps {
values: FormValues;
setFieldValue: FormikHelpers<FormValues>['setFieldValue'];
}
const AdminInterface: FC<AdminInterfaceProps> = observer(({
values,
setFieldValue,
}) => {
const { ui: { intl }, install: { addresses } } = useContext(Store);
const { web: { ip } } = values;
const radioValue = ip.length === 1 && ip[0] === DEFAULT_IP_ADDRESS
? NETWORK_OPTIONS.ALL : NETWORK_OPTIONS.CUSTOM;
const onSelectRadio = (v: string | number) => {
const value = v === NETWORK_OPTIONS.ALL
? [DEFAULT_IP_ADDRESS] : [];
setFieldValue('web.ip', value);
};
const getManualBlock = () => (
<div className={theme.install.options}>
{addresses?.interfaces.map((a) => {
let name = '';
const type = chechNetworkType(a.name);
switch (type) {
case NETWORK_TYPE.ETHERNET:
name = `${intl.getMessage('ethernet')} (${a.name}) `;
break;
case NETWORK_TYPE.LOCAL:
name = `${intl.getMessage('localhost')} (${a.name}) `;
break;
default:
name = a.name || '';
break;
}
return (
<div key={a.name}>
<div className={theme.install.name}>
{name}
</div>
{a.ipAddresses?.map((addrIp) => (
<div key={addrIp} className={theme.install.option}>
<div className={theme.install.address}>
http://{addrIp}
</div>
<Switch
checked={values.web.ip.includes(addrIp)}
onChange={() => {
const temp = new Set(ip);
if (temp.has(addrIp)) {
temp.delete(addrIp);
} else {
temp.add(addrIp);
}
setFieldValue('web.ip', Array.from(temp.values()));
}}/>
</div>
))}
</div>
);
})}
</div>
);
return (
<>
<div className={theme.install.title}>
{intl.getMessage('install_admin_interface_title')}
</div>
<div className={cn(theme.install.text, theme.install.text_block)}>
{intl.getMessage('install_admin_interface_title_decs')}
</div>
<div className={theme.install.subtitle}>
{intl.getMessage('install_admin_interface_where_interface')}
</div>
<div className={cn(theme.install.text, theme.install.text_base)}>
{intl.getMessage('install_admin_interface_where_interface_desc')}
</div>
<Radio
value={radioValue}
onSelect={onSelectRadio}
options={[
{
value: NETWORK_OPTIONS.ALL,
label: intl.getMessage('install_all_networks'),
desc: intl.getMessage('install_all_networks_description'),
},
{
value: NETWORK_OPTIONS.CUSTOM,
label: intl.getMessage('install_choose_networks'),
desc: intl.getMessage('install_choose_networks_desc'),
},
]}
/>
{ radioValue !== NETWORK_OPTIONS.ALL && getManualBlock()}
<div className={theme.install.subtitle}>
{intl.getMessage('install_admin_interface_port')}
</div>
<div className={cn(theme.install.text, theme.install.text_base)}>
{intl.getMessage('install_admin_interface_port_desc')}
</div>
<Input
label={`${intl.getMessage('port')}:`}
placeholder={intl.getMessage('port')}
type="number"
name="webPort"
value={values.web.port}
onChange={(v) => {
const port = v === '' ? '' : parseInt(v, 10);
setFieldValue('web.port', port);
}}
/>
<StepButtons
setFieldValue={setFieldValue}
currentStep={1}
values={values}
/>
</>
);
});
export default AdminInterface;

View File

@@ -0,0 +1 @@
export { default } from './AdminInterface';

View File

@@ -0,0 +1,55 @@
import React, { FC, useContext } from 'react';
import cn from 'classnames';
import { observer } from 'mobx-react-lite';
import { FormikHelpers } from 'formik';
import { Input } from 'Common/controls';
import theme from 'Lib/theme';
import Store from 'Store/installStore';
import StepButtons from '../StepButtons';
import { FormValues } from '../../Install';
interface AuthProps {
values: FormValues;
setFieldValue: FormikHelpers<FormValues>['setFieldValue'];
}
const Auth: FC<AuthProps> = observer(({
values,
setFieldValue,
}) => {
const { ui: { intl } } = useContext(Store);
return (
<>
<div className={theme.install.title}>
{intl.getMessage('install_auth_title')}
</div>
<div className={cn(theme.install.text, theme.install.text_block)}>
{intl.getMessage('install_auth_description')}
</div>
<Input
placeholder={intl.getMessage('login')}
type="username"
name="username"
value={values.username}
onChange={(v) => setFieldValue('username', v)}
/>
<Input
placeholder={intl.getMessage('password')}
type="password"
name="password"
value={values.password}
onChange={(v) => setFieldValue('password', v)}
/>
<StepButtons
setFieldValue={setFieldValue}
currentStep={2}
values={values}
/>
</>
);
});
export default Auth;

View File

@@ -0,0 +1 @@
export { default } from './Auth';

View File

@@ -0,0 +1,152 @@
import React, { FC, useContext } from 'react';
import { Tabs, Grid } from 'antd';
import cn from 'classnames';
import { FormikHelpers } from 'formik';
import Store from 'Store/installStore';
import theme from 'Lib/theme';
import { danger, p } from 'Common/formating';
import { DEFAULT_DNS_PORT, DEFAULT_IP_ADDRESS, DEFAULT_IP_PORT } from 'Consts/install';
import { FormValues } from '../../Install';
import StepButtons from '../StepButtons';
const { useBreakpoint } = Grid;
const { TabPane } = Tabs;
interface ConfigureDevicesProps {
values: FormValues;
setFieldValue: FormikHelpers<FormValues>['setFieldValue'];
}
const ConfigureDevices: FC<ConfigureDevicesProps> = ({
values, setFieldValue,
}) => {
const { ui: { intl }, install: { addresses } } = useContext(Store);
const screens = useBreakpoint();
const tabsPosition = screens.md ? 'left' : 'top';
const dhcp = (e: string) => (
<a
href="https://github.com/AdguardTeam/AdGuardHome/wiki/DHCP"
target="_blank"
rel="noopener noreferrer"
className={theme.link.link}
>
{e}
</a>
);
const allIps = addresses?.interfaces.reduce<string[]>((all, data) => {
const { ipAddresses } = data;
if (ipAddresses) {
all.push(...ipAddresses);
}
return all;
}, [] as string[]);
const { web: { ip: webIp }, dns: { ip: dnsIp } } = values;
const selectedWebIps = webIp.length === 1 && webIp[0] === DEFAULT_IP_ADDRESS
? allIps : webIp;
const selectedDnsIps = dnsIp.length === 1 && dnsIp[0] === DEFAULT_IP_ADDRESS
? allIps : dnsIp;
return (
<>
<div className={theme.install.title}>
{intl.getMessage('install_configure_title')}
</div>
<div className={cn(theme.install.text, theme.install.text_block)}>
{intl.getMessage('install_configure_danger_notice', { danger })}
</div>
<Tabs defaultActiveKey="1" tabPosition={tabsPosition} className={theme.install.tabs}>
<TabPane tab={intl.getMessage('router')} key="1">
<div className={theme.install.subtitle}>
{intl.getMessage('install_configure_how_to_title', { value: intl.getMessage('router') })}
</div>
<div className={cn(theme.install.text, theme.install.text_base)}>
{intl.getMessage('install_configure_router', { p })}
</div>
</TabPane>
<TabPane tab="Windows" key="2">
<div className={theme.install.subtitle}>
{intl.getMessage('install_configure_how_to_title', { value: 'Windows' })}
</div>
<div className={cn(theme.install.text, theme.install.text_base)}>
{intl.getMessage('install_configure_windows', { p })}
</div>
</TabPane>
<TabPane tab="macOS" key="3">
<div className={theme.install.subtitle}>
{intl.getMessage('install_configure_how_to_title', { value: 'macOS' })}
</div>
<div className={cn(theme.install.text, theme.install.text_base)}>
{intl.getMessage('install_configure_macos', { p })}
</div>
</TabPane>
<TabPane tab="Linux" key="4">
<div className={theme.install.subtitle}>
{intl.getMessage('install_configure_how_to_title', { value: 'Linux' })}
</div>
<div className={cn(theme.install.text, theme.install.text_base)}>
{/* TODO: add linux setup */}
{intl.getMessage('install_configure_router', { p })}
</div>
</TabPane>
<TabPane tab="Android" key="5">
<div className={theme.install.subtitle}>
{intl.getMessage('install_configure_how_to_title', { value: 'Android' })}
</div>
<div className={cn(theme.install.text, theme.install.text_base)}>
{intl.getMessage('install_configure_android', { p })}
</div>
</TabPane>
<TabPane tab="iOS" key="6">
<div className={theme.install.subtitle}>
{intl.getMessage('install_configure_how_to_title', { value: 'iOS' })}
</div>
<div className={cn(theme.install.text, theme.install.text_base)}>
{intl.getMessage('install_configure_ios', { p })}
</div>
</TabPane>
</Tabs>
<div className={theme.install.subtitle}>
{intl.getMessage('install_configure_adresses')}
</div>
<div className={cn(theme.install.text, theme.install.text_block)}>
<div className={cn(theme.install.text, theme.install.text_base)}>
{intl.getMessage('install_admin_interface_title')}
</div>
<div className={cn(theme.install.text, theme.install.text_base)}>
{selectedWebIps?.map((ip) => (
<div key={ip} className={theme.install.ip}>
{ip}{values.web.port !== DEFAULT_IP_PORT && `:${values.web.port}`}
</div>
))}
</div>
<div className={cn(theme.install.text, theme.install.text_base)}>
{intl.getMessage('install_dns_server_title')}
</div>
<div className={cn(theme.install.text, theme.install.text_base)}>
{selectedDnsIps?.map((ip) => (
<div key={ip} className={theme.install.ip}>
{ip}{values.dns.port !== DEFAULT_DNS_PORT && `:${values.dns.port}`}
</div>
))}
</div>
</div>
<div className={cn(theme.install.text, theme.install.text_base)}>
{intl.getMessage('install_configure_dhcp', { dhcp })}
</div>
<StepButtons
setFieldValue={setFieldValue}
currentStep={4}
values={values}
/>
</>
);
};
export default ConfigureDevices;

View File

@@ -0,0 +1 @@
export { default } from './ConfigureDevices';

View File

@@ -0,0 +1,142 @@
import React, { FC, useContext } from 'react';
import cn from 'classnames';
import { observer } from 'mobx-react-lite';
import { FormikHelpers } from 'formik';
import { Input, Radio, Switch } from 'Common/controls';
import { DEFAULT_IP_ADDRESS } from 'Consts/install';
import { chechNetworkType, NETWORK_TYPE } from 'Helpers/installHelpers';
import theme from 'Lib/theme';
import Store from 'Store/installStore';
import { FormValues } from '../../Install';
import StepButtons from '../StepButtons';
enum NETWORK_OPTIONS {
ALL = 'all',
CUSTOM = 'custom',
}
interface DnsServerProps {
values: FormValues;
setFieldValue: FormikHelpers<FormValues>['setFieldValue'];
}
const DnsServer: FC<DnsServerProps> = observer(({
values,
setFieldValue,
}) => {
const { ui: { intl }, install: { addresses } } = useContext(Store);
const { dns: { ip } } = values;
const radioValue = ip.length === 1 && ip[0] === DEFAULT_IP_ADDRESS
? NETWORK_OPTIONS.ALL : NETWORK_OPTIONS.CUSTOM;
const onSelectRadio = (v: string | number) => {
const value = v === NETWORK_OPTIONS.ALL
? [DEFAULT_IP_ADDRESS] : [];
setFieldValue('dns.ip', value);
};
const getManualBlock = () => (
<div className={theme.install.options}>
{addresses?.interfaces.map((a) => {
let name = '';
const type = chechNetworkType(a.name);
switch (type) {
case NETWORK_TYPE.ETHERNET:
name = `${intl.getMessage('ethernet')} (${a.name}) `;
break;
case NETWORK_TYPE.LOCAL:
name = `${intl.getMessage('localhost')} (${a.name}) `;
break;
default:
name = a.name || '';
break;
}
return (
<div key={a.name}>
<div className={theme.install.name}>
{name}
</div>
{a.ipAddresses?.map((addrIp) => (
<div key={addrIp} className={theme.install.option}>
<div className={theme.install.address}>
{addrIp}
</div>
<Switch
checked={values.dns.ip.includes(addrIp)}
onChange={() => {
const temp = new Set(ip);
if (temp.has(addrIp)) {
temp.delete(addrIp);
} else {
temp.add(addrIp);
}
setFieldValue('dns.ip', Array.from(temp.values()));
}}/>
</div>
))}
</div>
);
})}
</div>
);
return (
<div>
<div className={theme.install.title}>
{intl.getMessage('install_dns_server_title')}
</div>
<div className={cn(theme.install.text, theme.install.text_block)}>
{intl.getMessage('install_dns_server_desc')}
</div>
<div className={theme.install.subtitle}>
{intl.getMessage('install_dns_server_network_interfaces')}
</div>
<div className={cn(theme.install.text, theme.install.text_base)}>
{intl.getMessage('install_dns_server_network_interfaces_desc')}
</div>
<Radio
value={radioValue}
onSelect={onSelectRadio}
options={[
{
value: NETWORK_OPTIONS.ALL,
label: intl.getMessage('install_all_networks'),
desc: intl.getMessage('install_all_networks_description'),
},
{
value: NETWORK_OPTIONS.CUSTOM,
label: intl.getMessage('install_choose_networks'),
desc: intl.getMessage('install_choose_networks_desc'),
},
]}
/>
{ radioValue !== NETWORK_OPTIONS.ALL && getManualBlock()}
<div className={theme.install.subtitle}>
{intl.getMessage('install_dns_server_port')}
</div>
<div className={cn(theme.install.text, theme.install.text_base)}>
{intl.getMessage('install_dns_server_port_desc')}
</div>
<Input
label={`${intl.getMessage('port')}:`}
placeholder={intl.getMessage('port')}
type="number"
name="dnsPort"
value={values.dns.port}
onChange={(v) => {
const port = v === '' ? '' : parseInt(v, 10);
setFieldValue('dns.port', port);
}}
/>
<StepButtons
setFieldValue={setFieldValue}
currentStep={3}
values={values}
/>
</div>
);
});
export default DnsServer;

View File

@@ -0,0 +1 @@
export { default } from './DnsServer';

View File

@@ -0,0 +1,44 @@
import React, { FC, useContext } from 'react';
import { Button } from 'antd';
import { observer } from 'mobx-react-lite';
import { FormikHelpers } from 'formik';
import Store from 'Store/installStore';
import theme from 'Lib/theme';
import { FormValues } from '../../Install';
interface StepButtonsProps {
setFieldValue: FormikHelpers<FormValues>['setFieldValue'];
currentStep: number;
values: FormValues;
}
const StepButtons: FC<StepButtonsProps> = observer(({
setFieldValue,
currentStep,
}) => {
const { ui: { intl } } = useContext(Store);
return (
<div className={theme.install.actions}>
<Button
size="large"
type="ghost"
className={theme.install.button}
onClick={() => setFieldValue('step', currentStep - 1)}
>
{intl.getMessage('back')}
</Button>
<Button
size="large"
type="primary"
htmlType="submit"
className={theme.install.button}
>
{intl.getMessage('next')}
</Button>
</div>
);
});
export default StepButtons;

View File

@@ -0,0 +1 @@
export { default } from './StepButtons';

View File

@@ -0,0 +1,66 @@
.stepper {
position: relative;
display: flex;
align-items: center;
justify-content: space-between;
height: 16px;
margin-bottom: 32px;
@media (--m-viewport) {
margin-bottom: 48px;
}
}
.wrap {
flex: 1;
position: relative;
display: inline-flex;
align-items: center;
justify-content: flex-end;
height: 16px;
&:before {
content: "";
position: absolute;
left: 0;
bottom: 7px;
width: 100%;
height: 1px;
background-color: var(--gray400);
}
&:first-child {
flex: 0;
&:before {
display: none;
}
}
&.current .circle {
transform: scale(2);
background-color: var(--green400);
border-color: var(--green400);
}
&.active .circle {
background-color: var(--green400);
border-color: var(--green400);
}
&.current:before,
&.active:before {
background-color: var(--green400);
}
}
.circle {
position: relative;
z-index: 1;
width: 8px;
height: 8px;
background-color: var(--white);
border-radius: 50%;
border: 1px solid var(--gray400);
transition: var(--transition) transform, var(--transition) background, var(--transition) border;
}

View File

@@ -0,0 +1,35 @@
import React, { FC } from 'react';
import cn from 'classnames';
import s from './Stepper.module.pcss';
interface StepProps {
active: boolean;
current: boolean;
}
const Step: FC<StepProps> = ({ active, current }) => {
return (
<div className={cn(s.wrap, { [s.active]: active, [s.current]: current })}>
<div className={s.circle} />
</div>
);
};
interface StepperProps {
currentStep: number;
}
const Stepper: FC<StepperProps> = ({ currentStep }) => {
return (
<div className={s.stepper}>
<Step current={currentStep === 0} active={currentStep >= 0} />
<Step current={currentStep === 1} active={currentStep >= 1} />
<Step current={currentStep === 2} active={currentStep >= 2} />
<Step current={currentStep === 3} active={currentStep >= 3} />
<Step current={currentStep === 4} active={currentStep >= 4} />
</div>
);
};
export default Stepper;

View File

@@ -0,0 +1 @@
export { default } from './Stepper';

View File

@@ -0,0 +1,38 @@
import React, { FC, useContext } from 'react';
import { Button } from 'antd';
import { observer } from 'mobx-react-lite';
import Store from 'Store/installStore';
import Icon from 'Common/ui/Icon';
import theme from 'Lib/theme';
interface WelcomeProps {
onNext: () => void;
}
const Welcome: FC<WelcomeProps> = observer(({ onNext }) => {
const { ui: { intl } } = useContext(Store);
return (
<>
<Icon icon="logo" className={theme.install.logo} />
<div className={theme.install.title}>
{intl.getMessage('install_wellcome_title')}
</div>
<div className={theme.install.text}>
{intl.getMessage('install_wellcome_desc')}
</div>
<div className={theme.install.actions}>
<Button
size="large"
type="primary"
className={theme.install.button}
onClick={onNext}
>
{intl.getMessage('install_wellcome_button')}
</Button>
</div>
</>
);
});
export default Welcome;

View File

@@ -0,0 +1 @@
export { default } from './Welcome';

View File

@@ -0,0 +1 @@
export { default } from './Install';

Some files were not shown because too many files have changed in this diff Show More