URL mime hosted completeness
Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
@@ -8,7 +8,7 @@ use egui::{Color32, Hyperlink, Image, RichText};
|
||||
use nostrdb::{BlockType, Mention, Ndb, Note, NoteKey, Transaction};
|
||||
use tracing::warn;
|
||||
|
||||
use notedeck::{Images, NoteCache};
|
||||
use notedeck::{supported_mime_hosted_at_url, Images, NoteCache};
|
||||
|
||||
pub struct NoteContents<'a> {
|
||||
ndb: &'a Ndb,
|
||||
@@ -127,10 +127,6 @@ pub fn render_note_preview(
|
||||
.inner
|
||||
}
|
||||
|
||||
fn is_image_link(url: &str) -> bool {
|
||||
url.ends_with("png") || url.ends_with("jpg") || url.ends_with("jpeg")
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn render_note_contents(
|
||||
ui: &mut egui::Ui,
|
||||
@@ -212,9 +208,12 @@ fn render_note_contents(
|
||||
}
|
||||
|
||||
BlockType::Url => {
|
||||
let lower_url = block.as_str().to_lowercase();
|
||||
if !hide_media && is_image_link(&lower_url) {
|
||||
images.push(block.as_str().to_string());
|
||||
if !hide_media {
|
||||
let url = block.as_str().to_string();
|
||||
|
||||
if supported_mime_hosted_at_url(&mut img_cache.urls, &url) {
|
||||
images.push(url);
|
||||
}
|
||||
} else {
|
||||
#[cfg(feature = "profiling")]
|
||||
puffin::profile_scope!("url contents");
|
||||
|
||||
Reference in New Issue
Block a user