Add attachments; filter out direct messages
This commit is contained in:
parent
efc630a09e
commit
d66f330fd1
2 changed files with 38 additions and 5 deletions
23
src/main.rs
23
src/main.rs
|
@ -61,6 +61,10 @@ fn try_main(path: &Path) -> Result<(), BoxError> {
|
||||||
|
|
||||||
let mut posts = Vec::with_capacity(activities.ordered_items.len());
|
let mut posts = Vec::with_capacity(activities.ordered_items.len());
|
||||||
for item in &activities.ordered_items {
|
for item in &activities.ordered_items {
|
||||||
|
if item.direct_message {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
match &item.object {
|
match &item.object {
|
||||||
pleroma::activity::ObjectUnion::ObjectClass(activity) => {
|
pleroma::activity::ObjectUnion::ObjectClass(activity) => {
|
||||||
let id: Url = item.id.parse()?;
|
let id: Url = item.id.parse()?;
|
||||||
|
@ -170,6 +174,14 @@ markup::define! {
|
||||||
" "
|
" "
|
||||||
}
|
}
|
||||||
@markup::raw(&activity.content)
|
@markup::raw(&activity.content)
|
||||||
|
|
||||||
|
@if !activity.attachment.is_empty() {
|
||||||
|
ul[class="activity-attachments"] {
|
||||||
|
@for attachment in activity.attachment.iter() {
|
||||||
|
li { @Attachment { attachment } }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hr;
|
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 {
|
fn activity_class(object_type: &pleroma::activity::OneOfType) -> &'static str {
|
||||||
|
|
20
style.css
20
style.css
|
@ -11,6 +11,15 @@ hr {
|
||||||
background: linear-gradient(to right in oklab, #ffffffff 0%, #d9d9d9ff 51%, #ffffffff 100%);
|
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 {
|
footer {
|
||||||
margin-top: 2em;
|
margin-top: 2em;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
@ -34,16 +43,17 @@ footer {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.activity-attachments {
|
||||||
|
list-style-type: none;
|
||||||
|
margin: 1em 0 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.actor-icon {
|
.actor-icon {
|
||||||
width: 48px;
|
width: 48px;
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
time {
|
|
||||||
float: right;
|
|
||||||
margin-left: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: 640px) {
|
@media screen and (max-width: 640px) {
|
||||||
body {
|
body {
|
||||||
margin: 1rem;
|
margin: 1rem;
|
||||||
|
|
Loading…
Reference in a new issue