notes
This commit is contained in:
parent
f2e00c7034
commit
2a40fe9beb
3 changed files with 13 additions and 4 deletions
|
@ -1,8 +1,8 @@
|
||||||
use std::{fs,io};
|
use std::{fs,io};
|
||||||
use directories::ProjectDirs;
|
use directories::ProjectDirs;
|
||||||
|
|
||||||
|
// OS neutral path for application data
|
||||||
pub fn get_data_directory() -> std::path::PathBuf {
|
pub fn get_data_directory() -> std::path::PathBuf {
|
||||||
|
|
||||||
let dirs = ProjectDirs::from("rocks","gabe","RSSCar").expect("Failed to get paths");
|
let dirs = ProjectDirs::from("rocks","gabe","RSSCar").expect("Failed to get paths");
|
||||||
match fs::create_dir(dirs.data_dir()){
|
match fs::create_dir(dirs.data_dir()){
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
|
|
13
src/html.rs
13
src/html.rs
|
@ -2,13 +2,20 @@ use html2md;
|
||||||
use regex::Regex;
|
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...
|
/* this works, but...
|
||||||
- images are omitted
|
- images are omitted
|
||||||
- Blockquotes don't display
|
- Blockquotes don't display
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pub fn process(content: String) -> String {
|
pub fn process(content: String) -> String {
|
||||||
let re = Regex::new(r"(?s)<iframe[^>]*>.*?</iframe>").unwrap();
|
let re = Regex::new(r"(?s)<iframe[^>]*>.*?</iframe>").unwrap();
|
||||||
let cleaned = re.replace_all(&content,"");
|
let cleaned = re.replace_all(&content,"");
|
||||||
|
|
|
@ -4,6 +4,8 @@ use iced::widget::image::Handle;
|
||||||
use rss::{Channel};
|
use rss::{Channel};
|
||||||
use reqwest::{self, blocking::Client, header::USER_AGENT};
|
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>{
|
pub fn load_rss(url: &str) -> Option<Channel>{
|
||||||
let client = Client::new();
|
let client = Client::new();
|
||||||
let res = client.get(url)
|
let res = client.get(url)
|
||||||
|
|
Loading…
Reference in a new issue