Allow videos in posts, simplify post image view

This commit is contained in:
Christoph Hagen
2025-01-17 23:24:56 +01:00
parent 60716fca20
commit bc3f21e7e4
10 changed files with 175 additions and 172 deletions

View File

@ -35,7 +35,7 @@ final class FeedPageGenerator {
linkPrefix: String) -> String {
var headers = content.postPageHeaders
var footer = ""
if posts.contains(where: { $0.images.count > 1 }) {
if posts.contains(where: { $0.requiresSwiper }) {
// Sort swiper style sheet before default style sheet
includeSwiper(in: &headers)
footer = swiperInitScript(posts: posts)
@ -82,7 +82,7 @@ final class FeedPageGenerator {
func swiperInitScript(posts: [FeedEntryData]) -> String {
var result = "<script> window.onload = () => { "
for post in posts {
guard post.images.count > 1 else {
guard post.requiresSwiper else {
continue
}
result += ImageGallery.swiperInit(id: post.entryId)