Skip to content

Add ABP-support for /api/search#1649

Merged
DL6ER merged 5 commits into
development-v6from
tweak/search_abp
Oct 8, 2023
Merged

Add ABP-support for /api/search#1649
DL6ER merged 5 commits into
development-v6from
tweak/search_abp

Conversation

@DL6ER

@DL6ER DL6ER commented Sep 30, 2023

Copy link
Copy Markdown
Member

What does this implement/fix?

This PR adds support for ABP-blocking in /api/search. So far, ABP blocking was only kind-of available via partial matching but this did not work in all cases.

Example for a domain that is ABP-blocked (searched for a.b.c.d.e.000dn.com):

{
  "search": {
    "domains": [],
    "gravity": [
      {
        "domain": "||000dn.com^",
        "type": "block",
        "address": "https://big.oisd.nl/",
        "comment": null,
        "enabled": true,
        "id": 4,
        "date_added": 1680173138,
        "date_modified": 1680173138,
        "date_updated": 1696090045,
        "number": 212157,
        "invalid_domains": 0,
        "abp_entries": 212157,
        "status": 1,
        "groups": [
          0
        ]
      }
    ],
    "total": 1,
    "parameters": {
      "N": 20,
      "partial": false,
      "domain": "a.b.c.d.e.000dn.com",
      "debug": false
    }
  },
  "took": 0.00480961799621582
}

Example for an antigravity match (searched for x.y.z.a.189.cn):

{
  "search": {
    "domains": [],
    "gravity": [
      {
        "domain": "@@||a.189.cn^",
        "type": "allow",
        "address": "https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/whitelist-urlshortener.txt",
        "comment": null,
        "enabled": true,
        "id": 13,
        "date_added": 1695923490,
        "date_modified": 1695923495,
        "date_updated": 1696090047,
        "number": 1895,
        "invalid_domains": 1,
        "abp_entries": 1895,
        "status": 1,
        "groups": [
          0
        ]
      }
    ],
    "total": 0,
    "parameters": {
      "N": 20,
      "partial": false,
      "domain": "x.y.z.a.189.cn",
      "debug": false
    }
  },
  "took": 0.00474715232849121
}

Related issue or feature (if applicable): N/A

Pull request in docs with documentation (if applicable): N/A


By submitting this pull request, I confirm the following:

  1. I have read and understood the contributors guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
  2. I have commented my proposed changes within the code.
  3. I am willing to help maintain this change if there are issues with it later.
  4. It is compatible with the EUPL 1.2 license
  5. I have squashed any insignificant commits. (git rebase)

Checklist:

  • The code change is tested and works locally.
  • I based my code and PRs against the repositories developmental branch.
  • I signed off all commits. Pi-hole enforces the DCO for all contributions
  • I signed all my commits. Pi-hole requires signatures to verify authorship
  • I have read the above and my PR is ready for review.

@DL6ER DL6ER requested a review from a team September 30, 2023 18:16
DL6ER added 3 commits October 7, 2023 21:52
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
@DL6ER DL6ER force-pushed the tweak/search_abp branch from b2e8f20 to db1fa3a Compare October 7, 2023 19:52
@DL6ER

DL6ER commented Oct 7, 2023

Copy link
Copy Markdown
Member Author

Rebased on latest development-v6

Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
@github-actions

github-actions Bot commented Oct 8, 2023

Copy link
Copy Markdown

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions

github-actions Bot commented Oct 8, 2023

Copy link
Copy Markdown

Conflicts have been resolved.

@PromoFaux

Copy link
Copy Markdown
Member

Tested working on both allow and deny type lists.

Web interface probably needs updating to print the distinction

image

image

@DL6ER DL6ER merged commit 2dadecb into development-v6 Oct 8, 2023
@DL6ER DL6ER deleted the tweak/search_abp branch October 8, 2023 17:21
DL6ER added a commit that referenced this pull request Oct 12, 2023
This is a regression of #1649

Signed-off-by: DL6ER <dl6er@dl6er.de>
@PromoFaux PromoFaux mentioned this pull request Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants