diff --git a/src/main.rs b/src/main.rs index a3b7f7d..0d6200e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -61,6 +61,10 @@ fn try_main(path: &Path) -> Result<(), BoxError> { let mut posts = Vec::with_capacity(activities.ordered_items.len()); for item in &activities.ordered_items { + if item.direct_message { + continue; + } + match &item.object { pleroma::activity::ObjectUnion::ObjectClass(activity) => { let id: Url = item.id.parse()?; @@ -170,6 +174,14 @@ markup::define! { " " } @markup::raw(&activity.content) + + @if !activity.attachment.is_empty() { + ul[class="activity-attachments"] { + @for attachment in activity.attachment.iter() { + li { @Attachment { attachment } } + } + } + } } } hr; @@ -182,6 +194,17 @@ markup::define! { } } } + + Attachment<'a>(attachment: &'a pleroma::activity::Attachment) { + @match attachment.media_type.as_str() { + "image/gif" |"image/jpeg" | "image/png" => { + img[src=&attachment.url, loading="lazy"]; + } + _ => { + a[href=&attachment.url] { @attachment.media_type " attachment" } + } + } + } } fn activity_class(object_type: &pleroma::activity::OneOfType) -> &'static str { diff --git a/style.css b/style.css index 6d28804..fd5c479 100644 --- a/style.css +++ b/style.css @@ -11,6 +11,15 @@ hr { background: linear-gradient(to right in oklab, #ffffffff 0%, #d9d9d9ff 51%, #ffffffff 100%); } +img { + max-width: calc(min(100%, 600px)); +} + +time { + float: right; + margin-left: 1em; +} + footer { margin-top: 2em; text-align: center; @@ -34,16 +43,17 @@ footer { } +.activity-attachments { + list-style-type: none; + margin: 1em 0 0; + padding: 0; +} + .actor-icon { width: 48px; float: left; } -time { - float: right; - margin-left: 1em; -} - @media screen and (max-width: 640px) { body { margin: 1rem;