From c2184d6add23d9b0ca44dbbc5d026ab4f482dceb Mon Sep 17 00:00:00 2001 From: FChannel <> Date: Sat, 31 Jul 2021 16:35:42 -0700 Subject: added pop route for removing archived posts. removed seeing archive page when not archived posts. --- client.go | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'client.go') diff --git a/client.go b/client.go index c3e89cd..5ccdade 100644 --- a/client.go +++ b/client.go @@ -206,6 +206,14 @@ func OutboxGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection Co "isOnion": func(url string) bool { return IsOnion(url) }, + "showArchive": func() bool { + col := GetActorCollectionDBTypeLimit(db, collection.Actor.Id, "Archive", 1) + + if len(col.OrderedItems) > 0 { + return true + } + return false; + }, "parseReplyLink": func(actorId string, op string, id string, content string) template.HTML { actor := FingerActor(actorId) title := strings.ReplaceAll(ParseLinkTitle(actor.Id, op, content), `/\<`, ">") @@ -282,6 +290,14 @@ func CatalogGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection C "isOnion": func(url string) bool { return IsOnion(url) }, + "showArchive": func() bool { + col := GetActorCollectionDBTypeLimit(db, collection.Actor.Id, "Archive", 1) + + if len(col.OrderedItems) > 0 { + return true + } + return false; + }, "sub": func (i, j int) int { return i - j }}).ParseFiles("./static/main.html", "./static/ncatalog.html", "./static/top.html")) actor := collection.Actor @@ -1008,7 +1024,7 @@ func ShortExcerpt(post ObjectBase) string { returnString = post.Content; } - re := regexp.MustCompile(`(^.{100})`) + re := regexp.MustCompile(`(^(.|\r\n|\n){100})`) match := re.FindStringSubmatch(returnString) @@ -1028,7 +1044,7 @@ func ShortExcerpt(post ObjectBase) string { } func IsOnion(url string) bool { - re := regexp.MustCompile(`\.onion$`) + re := regexp.MustCompile(`\.onion`) if(re.MatchString(url)) { return true; } -- cgit v1.2.3