Update to 0.19.5 and include optional thumbnail

This commit is contained in:
Neshura 2024-07-15 22:15:19 +02:00
parent 7dcc7bfee2
commit 2ecfe88cb9
Signed by: Neshura
GPG key ID: 4E2D47B1374C297D
5 changed files with 378 additions and 109 deletions

View file

@ -5,14 +5,13 @@ use lemmy_api_common::community::{ListCommunities, ListCommunitiesResponse};
use lemmy_api_common::lemmy_db_views::structs::PostView;
use lemmy_api_common::person::{Login, LoginResponse};
use lemmy_api_common::post::{CreatePost, FeaturePost, GetPosts, GetPostsResponse};
use lemmy_api_common::sensitive::Sensitive;
use lemmy_db_schema::newtypes::{CommunityId, LanguageId, PostId};
use lemmy_db_schema::{ListingType, PostFeatureType};
use reqwest::StatusCode;
use std::collections::HashMap;
use std::sync::{RwLock};
use lemmy_db_schema::sensitive::SensitiveString;
use serde::{Deserialize, Serialize};
use url::Url;
use systemd_journal_logger::connected_to_journal;
macro_rules! debug {
@ -34,7 +33,7 @@ macro_rules! error {
}
pub(crate) struct Lemmy {
jwt_token: Sensitive<String>,
jwt_token: SensitiveString,
instance: String,
communities: HashMap<String, CommunityId>,
}
@ -43,7 +42,8 @@ pub(crate) struct Lemmy {
#[derive(Debug, Clone)]
pub(crate) struct PostInfoInner {
pub(crate) title: String,
pub(crate) url: Url,
pub(crate) url: String,
pub(crate) thumbnail: Option<String>
}
#[derive(Debug, Copy, Clone)]
@ -161,7 +161,9 @@ impl PostInfo {
name: self.get_info().title.clone(),
community_id,
url: Some(self.get_info().url),
custom_thumbnail: self.get_info().thumbnail,
body: post_body,
alt_text: None,
honeypot: None,
nsfw: None,
language_id: Some(LanguageId(37)), // TODO get this id once every few hours per API request, the ordering of IDs suggests that the EN Id might change in the future