refactor: modernize Go idioms across codebase
Replace map[string]interface{} with map[string]any, ioutil.ReadAll with
io.ReadAll, and simplify redundant fmt.Sprintf/w.Write calls.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8933055358
commit
439dc2cd07
7 changed files with 28 additions and 34 deletions
10
addy.go
10
addy.go
|
|
@ -12,6 +12,7 @@ import (
|
|||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"slices"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
|
@ -134,14 +135,7 @@ func addyAliasAPI(w http.ResponseWriter, r *http.Request) {
|
|||
http.Error(w, "Alias creation is not configured", http.StatusServiceUnavailable)
|
||||
return
|
||||
}
|
||||
domainAllowed := false
|
||||
for _, d := range allowedAliasDomains {
|
||||
if body.Domain == d {
|
||||
domainAllowed = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !domainAllowed {
|
||||
if !slices.Contains(allowedAliasDomains, body.Domain) {
|
||||
http.Error(w, "Domain not allowed", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue