diff options
| author | Xe Iaso <me@christine.website> | 2022-11-12 13:00:01 -0500 |
|---|---|---|
| committer | Xe Iaso <me@christine.website> | 2022-11-12 13:00:01 -0500 |
| commit | ab86d9bf5d9accf681588dd48df581d77126708c (patch) | |
| tree | 81ed60b3980764ae90fa01fe21a2345da93a9bed /lib | |
| parent | 7a8123435b381db82b557d630bdae5df77b86608 (diff) | |
| download | xesite-ab86d9bf5d9accf681588dd48df581d77126708c.tar.xz xesite-ab86d9bf5d9accf681588dd48df581d77126708c.zip | |
rip twitter
Signed-off-by: Xe Iaso <me@christine.website>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/xesite_templates/src/lib.rs | 5 | ||||
| -rw-r--r-- | lib/xesite_types/src/mastodon.rs | 33 |
2 files changed, 23 insertions, 15 deletions
diff --git a/lib/xesite_templates/src/lib.rs b/lib/xesite_templates/src/lib.rs index e744531..5e6fee2 100644 --- a/lib/xesite_templates/src/lib.rs +++ b/lib/xesite_templates/src/lib.rs @@ -190,7 +190,7 @@ pub fn toot_embed(u: User, t: Toot) -> Markup { br; } - a href=(t.url) { "Link" } + a href=(t.url.unwrap_or(t.id)) { "Link" } }; html! { .media { @@ -202,6 +202,9 @@ pub fn toot_embed(u: User, t: Toot) -> Markup { .media-body { .media-heading { (u.name) + @if u.id == "https://pony.social/users/cadey" { + img src="https://cdn.xeiaso.net/file/christine-static/blog/verified.png" style="height=1.5ch;width=1.5ch"; + } " " a href=(u.url) {"@" (u.preferred_username)} br; diff --git a/lib/xesite_types/src/mastodon.rs b/lib/xesite_types/src/mastodon.rs index 942bbc7..80445bd 100644 --- a/lib/xesite_types/src/mastodon.rs +++ b/lib/xesite_types/src/mastodon.rs @@ -25,7 +25,7 @@ pub struct User { pub featured: String, #[serde(rename = "featuredTags")] - pub featured_tags: String, + pub featured_tags: Option<String>, #[serde(rename = "preferredUsername")] pub preferred_username: String, @@ -46,10 +46,10 @@ pub struct User { pub discoverable: bool, #[serde(rename = "published")] - pub published: String, + pub published: Option<String>, #[serde(rename = "devices")] - pub devices: String, + pub devices: Option<String>, #[serde(rename = "icon")] pub icon: Icon, @@ -64,7 +64,7 @@ pub struct Icon { pub icon_type: String, #[serde(rename = "mediaType")] - pub media_type: String, + pub media_type: Option<String>, #[serde(rename = "url")] pub url: String, @@ -85,7 +85,7 @@ pub struct Toot { pub published: DateTime<Utc>, #[serde(rename = "url")] - pub url: String, + pub url: Option<String>, #[serde(rename = "attributedTo")] pub attributed_to: String, @@ -97,13 +97,7 @@ pub struct Toot { pub cc: Vec<String>, #[serde(rename = "sensitive")] - pub sensitive: bool, - - #[serde(rename = "atomUri")] - pub atom_uri: String, - - #[serde(rename = "inReplyToAtomUri")] - pub in_reply_to_atom_uri: Option<String>, + pub sensitive: Option<bool>, #[serde(rename = "conversation")] pub conversation: String, @@ -115,7 +109,7 @@ pub struct Toot { pub content: String, #[serde(rename = "contentMap")] - pub content_map: ContentMap, + pub content_map: Option<ContentMap>, #[serde(rename = "attachment")] pub attachment: Vec<Attachment>, @@ -124,7 +118,10 @@ pub struct Toot { pub tag: Vec<Tag>, #[serde(rename = "replies")] - pub replies: Replies, + pub replies: Option<Replies>, + + #[serde(rename = "source")] + pub source: Option<Source>, } impl Toot { @@ -134,6 +131,14 @@ impl Toot { } #[derive(Serialize, Deserialize)] +pub struct Source { + #[serde(rename = "content")] + pub content: String, + #[serde(rename = "mediaType")] + pub content_type: String, +} + +#[derive(Serialize, Deserialize)] pub struct Tag { #[serde(rename = "type")] pub tag_type: String, |
