aboutsummaryrefslogtreecommitdiff
path: root/client.go
diff options
context:
space:
mode:
Diffstat (limited to 'client.go')
-rw-r--r--client.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/client.go b/client.go
index c157416..c3e89cd 100644
--- a/client.go
+++ b/client.go
@@ -203,6 +203,9 @@ func OutboxGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection Co
"convertSize": func(size int64) string {
return ConvertSize(size)
},
+ "isOnion": func(url string) bool {
+ return IsOnion(url)
+ },
"parseReplyLink": func(actorId string, op string, id string, content string) template.HTML {
actor := FingerActor(actorId)
title := strings.ReplaceAll(ParseLinkTitle(actor.Id, op, content), `/\<`, ">")
@@ -276,6 +279,9 @@ func CatalogGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection C
"parseAttachment": func(obj ObjectBase, catalog bool) template.HTML {
return ParseAttachment(obj, catalog)
},
+ "isOnion": func(url string) bool {
+ return IsOnion(url)
+ },
"sub": func (i, j int) int { return i - j }}).ParseFiles("./static/main.html", "./static/ncatalog.html", "./static/top.html"))
actor := collection.Actor
@@ -377,6 +383,9 @@ func PostGet(w http.ResponseWriter, r *http.Request, db *sql.DB){
"convertSize": func(size int64) string {
return ConvertSize(size)
},
+ "isOnion": func(url string) bool {
+ return IsOnion(url)
+ },
"parseReplyLink": func(actorId string, op string, id string, content string) template.HTML {
actor := FingerActor(actorId)
title := strings.ReplaceAll(ParseLinkTitle(actor.Id, op, content), `/\<`, ">")
@@ -1017,3 +1026,12 @@ func ShortExcerpt(post ObjectBase) string {
return returnString
}
+
+func IsOnion(url string) bool {
+ re := regexp.MustCompile(`\.onion$`)
+ if(re.MatchString(url)) {
+ return true;
+ }
+
+ return false
+}