Add web templates and handlers for home, embed card, and admin pages

This commit is contained in:
2025-05-18 12:23:00 +03:30
parent 0854387eb4
commit 7659cca37e
7 changed files with 657 additions and 7 deletions
+2 -3
View File
@@ -64,7 +64,6 @@ func (ps *PostService) GetExistingAccountIds() []string {
return existingAccountIds
}
func (*PostService) GetNewPosts(existingPostIds []string, posts []domain.Post) []domain.Post {
var newPosts []domain.Post = nil
for _, post := range posts {
@@ -108,7 +107,8 @@ func (ps *PostService) GetRandomPost() domain.Post {
var post domain.Post
ps.db.
Preload("Account").
Preload("Attachments", "approved = ?", true).
Preload("Attachments", "Approved = ?", true).
Where("exists (select 1 from media_attachments where post_id = posts.id and approved = ?)", true).
Order("RANDOM()").
First(&post)
if len(post.Attachments) > 0 {
@@ -140,7 +140,6 @@ func (ps *PostService) GetMedia() domain.MediaAttachment {
return media
}
func arrayContains(arr []string, str string) bool {
for _, a := range arr {
if a == str {