Compare commits
2 commits
88a6048dc2
...
5dc2674955
Author | SHA1 | Date | |
---|---|---|---|
5dc2674955 | |||
0badc71c92 |
2 changed files with 13 additions and 3 deletions
|
@ -55,7 +55,7 @@ pub fn App() -> impl IntoView {
|
||||||
view! {
|
view! {
|
||||||
<nav class="w-100 mt-1 mb-1 pb-s">
|
<nav class="w-100 mt-1 mb-1 pb-s">
|
||||||
<code class="color ml-3" ><a class="upub-title" href={title_target} >μpub</a></code>
|
<code class="color ml-3" ><a class="upub-title" href={title_target} >μpub</a></code>
|
||||||
<small class="ml-1 mr-1 hidden-on-tiny" ><a class="clean" href={title_target} >micro social network, federated</a></small>
|
<small class="ml-1 mr-1 hidden-on-tiny" ><a class="clean" href="/web/server" >micro social network, federated</a></small>
|
||||||
/* TODO kinda jank with the float but whatever, will do for now */
|
/* TODO kinda jank with the float but whatever, will do for now */
|
||||||
<input type="submit" class="mr-2 rev" on:click=move |_| set_menu.set(!menu.get()) value="menu" style="float: right" />
|
<input type="submit" class="mr-2 rev" on:click=move |_| set_menu.set(!menu.get()) value="menu" style="float: right" />
|
||||||
</nav>
|
</nav>
|
||||||
|
|
|
@ -3,7 +3,7 @@ use std::sync::Arc;
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use crate::{prelude::*, URL_SENSITIVE};
|
use crate::{prelude::*, URL_SENSITIVE};
|
||||||
|
|
||||||
use apb::{target::Addressed, ActivityMut, Base, Collection, CollectionMut, Object, ObjectMut};
|
use apb::{target::Addressed, ActivityMut, Base, Collection, CollectionMut, Document, Object, ObjectMut};
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn Attachment(
|
pub fn Attachment(
|
||||||
|
@ -17,12 +17,22 @@ pub fn Attachment(
|
||||||
let media_type = object.media_type()
|
let media_type = object.media_type()
|
||||||
.unwrap_or("image/png") // TODO weird defaulting to png?????
|
.unwrap_or("image/png") // TODO weird defaulting to png?????
|
||||||
.to_string();
|
.to_string();
|
||||||
let kind = media_type
|
let mut kind = media_type
|
||||||
.split('/')
|
.split('/')
|
||||||
.next()
|
.next()
|
||||||
.unwrap_or("image")
|
.unwrap_or("image")
|
||||||
.to_string();
|
.to_string();
|
||||||
|
|
||||||
|
// TODO in theory we should match on document_type, but mastodon and misskey send all attachments
|
||||||
|
// as "Documents" regardless of type, so we're forced to ignore the actual AP type and just match
|
||||||
|
// using media_type, uffff
|
||||||
|
//
|
||||||
|
// those who correctly send Image type objects without a media type get shown as links here, this
|
||||||
|
// is a dirty fix to properly display as images
|
||||||
|
if kind == "link" && matches!(object.document_type(), Some(apb::DocumentType::Image)) {
|
||||||
|
kind = "image".to_string();
|
||||||
|
}
|
||||||
|
|
||||||
match kind.as_str() {
|
match kind.as_str() {
|
||||||
"image" =>
|
"image" =>
|
||||||
view! {
|
view! {
|
||||||
|
|
Loading…
Reference in a new issue