AdguardTeam / AdguardTeam/AdGuardHome

Add some sanity checking and functionality for rewriteAdd and rewriteRemove

Abierto
#4,585 0 comentarios 0 reacciones 1 asignado Reclamado por @ainar-g Ver en GitHub
enhancement P3: Medium
Lenguaje dominante
TypeScript
Estrellas
36.9k
Forks
2.5k
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.