From 4a9452985a127a53572358c3b86a425a5df616e1 Mon Sep 17 00:00:00 2001 From: FChannel <> Date: Sat, 31 Jul 2021 12:10:31 -0700 Subject: removed javascript causing errors and updated readme with xmpp room --- client.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'client.go') 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 +} -- cgit v1.2.3