This commit is contained in:
Gabriel 2025-07-02 20:11:54 -04:00
parent f2e00c7034
commit 2a40fe9beb
3 changed files with 13 additions and 4 deletions

View file

@ -1,8 +1,8 @@
use std::{fs,io};
use directories::ProjectDirs;
// OS neutral path for application data
pub fn get_data_directory() -> std::path::PathBuf {
let dirs = ProjectDirs::from("rocks","gabe","RSSCar").expect("Failed to get paths");
match fs::create_dir(dirs.data_dir()){
Ok(_) => {}

View file

@ -2,13 +2,20 @@ use html2md;
use regex::Regex;
/*
Content needs to be processed in chunks.
Separate out content into blocks that can be used by the UI framework
p -> text
a -> link (does this exist?)
img - > image widget
and so on...
*/
/* this works, but...
- images are omitted
- Blockquotes don't display
*/
pub fn process(content: String) -> String {
let re = Regex::new(r"(?s)<iframe[^>]*>.*?</iframe>").unwrap();
let cleaned = re.replace_all(&content,"");

View file

@ -4,6 +4,8 @@ use iced::widget::image::Handle;
use rss::{Channel};
use reqwest::{self, blocking::Client, header::USER_AGENT};
// needs to support loading over various schemes (such as Tor & I2P) ideally based on the URL but DB may have to store scheme....
pub fn load_rss(url: &str) -> Option<Channel>{
let client = Client::new();
let res = client.get(url)