From 45f44acfc7f1d11412e0d95d51adac8620edeac6 Mon Sep 17 00:00:00 2001 From: pluja Date: Mon, 4 Mar 2024 08:51:34 +0100 Subject: [PATCH] allow tor-only services --- src/frontend/templates/service.html | 437 +++++++++------------------- src/server/api_generic.go | 6 +- 2 files changed, 141 insertions(+), 302 deletions(-) diff --git a/src/frontend/templates/service.html b/src/frontend/templates/service.html index f586870..bcb4927 100644 --- a/src/frontend/templates/service.html +++ b/src/frontend/templates/service.html @@ -1,215 +1,133 @@
{{if .Service.Pending}} -
- {{end}}
- + {{.Service.Name}} {{if .Service.Verified}} - - - - - - + + + + + + {{end}}
-
-
- - - - - - - - - - - - - - Website - - {{if ne (len .Service.TosUrls) 0}} - - - - - - - - - - - - ToS - - {{end}} {{if ne .Service.Referral ""}} - - - - - - - - - - {{end}} {{if ne (len .Service.OnionUrls) 0}} - - - - - - - - Tor - +
+
+ {{if ne (len .Service.Urls) 0}} +
+ + + + + + + + + + + + + + Website + + + {{if ne .Service.Referral ""}} + + + + + + + + + + {{end}} +
{{end}} - + {{end}} + + {{if ne (len .Service.TosUrls) 0}} + + + + + + + + + + + + ToS + + {{end}} + + @@ -234,73 +152,41 @@
-

- {{if ne .Service.Description ""}} {{.Service.Description | safe}} {{else}} - This {{.Service.Type}} does not have a description. {{end}} -

+

{{if ne .Service.Description ""}} {{.Service.Description | safe}} {{else}} This {{.Service.Type}} does not have a description. {{end}}

-
- {{partial "partials/kyc_level" .Service.KycLevel}} -
+
{{partial "partials/kyc_level" .Service.KycLevel}}
{{if .Attributes}} -
- {{range .Attributes}} {{partial "partials/attribute_line" .}} {{end}} -
+
{{range .Attributes}} {{partial "partials/attribute_line" .}} {{end}}
{{end}} {{if .Service.Comments}}
{{range .Service.Comments}} -

- * {{.}} -

+

* {{.}}

{{end}}
{{end}} - - (updated {{humanizePbTimeString .Service.Updated}}) - + (updated {{humanizePbTimeString .Service.Updated}})
-
+
- + - + @@ -315,99 +201,48 @@ ToS Review ? -

- Automated, ai-driven monthly ToS reviews. -

-

- Last Check: {{ dateString .Service.LastTosReview }} -

+

Automated, ai-driven monthly ToS reviews.

+

Last Check: {{ dateString .Service.LastTosReview }}

{{if .Service.TosReviews}}
{{if eq 0 (len .Service.TosReviews)}} -

- Not ToS reviews for this service (yet). -

+

Not ToS reviews for this service (yet).

{{else if eq (len .Service.TosUrls) 0}} -

- This service has no ToS. -

- {{else}} {{range .Service.TosReviews}} {{if .Warning}} {{partial - "partials/tos_check" .}} {{end}} {{end}} +

This service has no ToS.

+ {{else}} {{range .Service.TosReviews}} {{if .Warning}} {{partial "partials/tos_check" .}} {{end}} {{end}}
- - Show non-conflictive ToS reviews - - {{range .Service.TosReviews}} {{if ne .Warning true}} {{partial - "partials/tos_check" .}} {{end}} {{end}} + Show non-conflictive ToS reviews + {{range .Service.TosReviews}} {{if ne .Warning true}} {{partial "partials/tos_check" .}} {{end}} {{end}}
{{end}}
{{else}} -

- Not ToS reviews for this service (yet). -

+

Not ToS reviews for this service (yet).

{{end}}
-
+
-
+
- + - + Nostr Comments ?

-

- Beware of fake reviews and accounts. Verify user profiles and conduct your - own research. -

+

Beware of fake reviews and accounts. Verify user profiles and conduct your own research.

diff --git a/src/server/api_generic.go b/src/server/api_generic.go index 7495b52..249a334 100644 --- a/src/server/api_generic.go +++ b/src/server/api_generic.go @@ -60,7 +60,11 @@ func (s *Server) handleApiPicture(c iris.Context) { req, _ := http.NewRequest("GET", service.LogoURL, nil) req.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.3") - req.Header.Set("Referer", service.Urls[0]) + if len(service.Urls) > 0 { + req.Header.Set("Referer", service.Urls[0]) + } else if len(service.OnionUrls) > 0 { + req.Header.Set("Referer", service.OnionUrls[0]) + } resp, err := s.HttpClient.Do(req) if err != nil || resp.StatusCode != http.StatusOK {