diff --git a/server/src/lib.rs b/server/src/lib.rs index 79a1437e..5566ca69 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -198,8 +198,8 @@ fn fetch_iframely_and_pictshare_data( Option, ) { // Fetch iframely data - let (iframely_title, iframely_description, iframely_thumbnail_url, iframely_html) = match url { - Some(url) => match fetch_iframely(&url) { + let (iframely_title, iframely_description, iframely_thumbnail_url, iframely_html) = match &url { + Some(url) => match fetch_iframely(url) { Ok(res) => (res.title, res.description, res.thumbnail_url, res.html), Err(e) => { error!("iframely err: {}", e); @@ -218,7 +218,18 @@ fn fetch_iframely_and_pictshare_data( None } }, - None => None, + + None => match url { + Some(url) => match fetch_pictshare(&url) { + // Try to generate a small thumbnail if iframely is not supported + Ok(res) => Some(res.url), + Err(e) => { + error!("pictshare err: {}", e); + None + } + }, + None => None, + }, }; ( diff --git a/ui/src/components/post-listing.tsx b/ui/src/components/post-listing.tsx index d0efa043..36a1e282 100644 --- a/ui/src/components/post-listing.tsx +++ b/ui/src/components/post-listing.tsx @@ -150,9 +150,9 @@ export class PostListing extends Component { let post = this.props.post; return ( ); @@ -163,6 +163,8 @@ export class PostListing extends Component { if (isImage(post.url)) { if (post.url.includes('pictshare')) { return pictshareImage(post.url, thumbnail); + } else if (post.thumbnail_url) { + return pictshareImage(post.thumbnail_url, thumbnail); } else { return post.url; } @@ -542,8 +544,9 @@ export class PostListing extends Component { } > @@ -586,8 +589,9 @@ export class PostListing extends Component { } > @@ -618,8 +622,9 @@ export class PostListing extends Component { data-tippy-content={i18n.t('view_source')} > @@ -639,8 +644,9 @@ export class PostListing extends Component { } > @@ -657,8 +663,9 @@ export class PostListing extends Component { } >