Skip to content

Commit

Permalink
fix: content not show
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanglun committed Dec 23, 2024
1 parent 3d31441 commit 922f282
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src-tauri/src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ mod tests {
// "http://www.youtube.com/feeds/videos.xml?channel_id=UCpVm7bg6pXKo1Pr6k5kxG9A".to_string();
// let url = "https://medium.com/feed/google-design".to_string();
// let url = "https://www.ximalaya.com/album/70501228.xml".to_string();
let url = "http://www.ximalaya.com/album/3558668.xml".to_string();
// let url = "http://www.ximalaya.com/album/3558668.xml".to_string();
let url = "https://gapis.money/rss.xml".to_string();

println!("{:?}", url);

Expand All @@ -269,7 +270,7 @@ mod tests {
let feed_uuid = Uuid::new_v4().hyphenated().to_string();
let feed = create_feed_model(&feed_uuid, &url, &res).clone();

println!("{:?}", (Some(feed), String::from("")));
println!("====>S{:?}", (Some(feed), String::from("")));
let articles = create_article_models(&feed_uuid, &url, &res);
println!("{:?}", articles);
}
Expand Down
3 changes: 3 additions & 0 deletions src-tauri/src/feed/article.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ pub struct ArticleDetailResult {
#[diesel(sql_type = Text)]
pub description: String,
#[diesel(sql_type = Text)]
pub content: String,
#[diesel(sql_type = Text)]
pub author: String,
#[diesel(sql_type = Text)]
pub pub_date: String,
Expand Down Expand Up @@ -383,6 +385,7 @@ impl Article {
A.link,
A.title,
A.description as description,
A.content as content,
A.author,
A.pub_date,
A.create_date,
Expand Down
5 changes: 5 additions & 0 deletions src/components/ArticleView/Detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ export const ArticleDetail = (props: ArticleDetailProps) => {
return a;
});

content = content.replace(/<img\s+(?:[^>]*?\s+)?src="([^"]*)"[^>]*>/g, (match, src) => {
const absoluteUrl = new URL(src, article.link).href;
return `<img src="${absoluteUrl}" />`;
});

console.log("%c Line:131 🍭 content", "color:#4fff4B", content);

setPageContent(
Expand Down

0 comments on commit 922f282

Please sign in to comment.