diff options
author | FChannel <> | 2021-07-31 12:10:31 -0700 |
---|---|---|
committer | FChannel <> | 2021-07-31 12:10:31 -0700 |
commit | 4a9452985a127a53572358c3b86a425a5df616e1 (patch) | |
tree | f83f0a0ee92e8167195f06f286bff28fe892581d /client.go | |
parent | ac288d40da3235b9382d685c9958ad167a758bcd (diff) |
removed javascript causing errors and updated readme with xmpp room
Diffstat (limited to 'client.go')
-rw-r--r-- | client.go | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -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 +} |