AdguardTeam / AdguardTeam/AdGuardHome

Add some sanity checking and functionality for rewriteAdd and rewriteRemove

Aperta
#4,585 0 commenti 0 reazioni 1 assegnatario Rivendicata da @ainar-g Vedi su GitHub
enhancement P3: Medium
Lingua principale
TypeScript
Stelle
36.9k
Fork
2.5k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.