AdguardTeam / AdguardTeam/AdGuardHome

Add some sanity checking and functionality for rewriteAdd and rewriteRemove

Offen
#4,585 0 Kommentare 0 Reaktionen 1 zugewiesene Person Beansprucht von @ainar-g Auf GitHub ansehen
enhancement P3: Medium
Vorherrschende Sprache
TypeScript
Sterne
36.9k
Forks
2.5k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

### Prerequisites

Please answer the following questions for yourself before submitting an issue. **YOU MAY DELETE THE PREREQUISITES SECTION.**

- [x] I am running the latest version
- [x] I checked the documentation and found no answer
- [x] I checked to make sure that this issue has not already been filed

### Problem Description

When adding a new rewrite through /control/rewriteAdd it always adds it no matter what. Even if the same domain:answer rule already exists.
Also when removing a rule, /control/rewriteDelete always expects a full domain:answer struct.

### Proposed Solution

It would be much better to do atleast a bit of sanitychecking. Like `if domain:answer exists return "error: already exists"` instead of adding a duplicate rule.
Also a /control/rewriteDelete with only a domain entry should remove all rules that share the domain; no matter the attached "answers". Same goes for /control/rewriteDelete with only a answer. This should delete all rules where the answer matches, no matter the attached domains.
Bonus points if the response of those contains the added/removed entries for clientside sanity checking without the need for additional requests.

- [ ] Add duplicate checking for /control/rewriteAdd (return duplicate error and dont save rule)
- [ ] Return added entries for /control/rewriteAdd

- [ ] Allow requests to /control/rewriteDelete to bulk delete entries for only the specified domain/answer
- [ ] Return deleted entries for /control/rewriteDelete

### Alternatives Considered

### Additional Information

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.