state context: Added proxy-safe-link-tags to proxy <link> tags, use specific LinkTags ranger on templates instead of raw elements

This commit is contained in:
WeebDataHoarder
2025-05-03 04:00:17 +02:00
parent 736c2708e9
commit 1ea19c5a6c
9 changed files with 163 additions and 92 deletions

View File

@@ -6,9 +6,10 @@ import (
"net/http"
"net/http/httptest"
"net/url"
"slices"
)
func FetchTags(backend http.Handler, uri *url.URL, kind string) (result []html.Node) {
func FetchTags(backend http.Handler, uri *url.URL, kinds ...string) (result []html.Node) {
writer := httptest.NewRecorder()
backend.ServeHTTP(writer, &http.Request{
Method: http.MethodGet,
@@ -39,7 +40,7 @@ func FetchTags(backend http.Handler, uri *url.URL, kind string) (result []html.N
}
for n := range node.Descendants() {
if n.Type == html.ElementNode && n.Data == kind {
if n.Type == html.ElementNode && slices.Contains(kinds, n.Data) {
result = append(result, html.Node{
Type: n.Type,
DataAtom: n.DataAtom,