Fix some issue
This commit is contained in:
parent
233c5aafed
commit
8a6336b70c
4 changed files with 9 additions and 12 deletions
|
|
@ -45,9 +45,9 @@ pub async fn add_feed(url: &str) -> Result<Feed, Error> {
|
|||
Feed::add(title, &feed.url, &feed.feed_url, icon)
|
||||
}
|
||||
None => {
|
||||
return Err(Error::MissingField(
|
||||
Err(Error::MissingField(
|
||||
"No RSS/Atom/JSON feed found at this URL".into(),
|
||||
));
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -60,7 +60,7 @@ pub async fn get_feeds() -> Result<Vec<Feed>, Error> {
|
|||
|
||||
#[tauri::command]
|
||||
pub async fn remove_feed(website_url: &str) -> Result<Feed, Error> {
|
||||
Ok(Feed::remove(website_url)?)
|
||||
Feed::remove(website_url)
|
||||
}
|
||||
// =======================================================
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ pub async fn get_feed_item(website_url: String) -> Result<Vec<FeedItem>, Error>
|
|||
.await?;
|
||||
FeedItem::from_feed(&xml)
|
||||
} else {
|
||||
return Err(Error::MissingField("no feed found in the settings.".into()));
|
||||
Err(Error::MissingField("no feed found in the settings.".into()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -91,6 +91,6 @@ pub async fn get_entry(website_url: String, target_url: String) -> Result<FeedEn
|
|||
|
||||
FeedEntry::from_feed(&xml, &target_url)
|
||||
} else {
|
||||
return Err(Error::MissingField("no feed found in the settings.".into()));
|
||||
Err(Error::MissingField("no feed found in the settings.".into()))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ pub mod feed_config {
|
|||
fs::write(path, "[]")?;
|
||||
}
|
||||
|
||||
let data = fs::read_to_string(&path)?;
|
||||
let data = fs::read_to_string(path)?;
|
||||
Ok(serde_json::from_str(&data)?)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use commands::feed::{add_feed, get_entry, get_feed_item, get_feeds, remove_feed}
|
|||
pub fn run() {
|
||||
tauri::Builder::default()
|
||||
.setup(|app| {
|
||||
config::init_config_path(&app.handle())?;
|
||||
config::init_config_path(app.handle())?;
|
||||
Ok(())
|
||||
})
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
|
|
|
|||
|
|
@ -184,11 +184,8 @@ fn resolve_url(base: &str, href: &str) -> String {
|
|||
format!("https:{}", href)
|
||||
} else if href.starts_with('/') {
|
||||
// رابط مطلق نسبي
|
||||
let base = if base.ends_with('/') {
|
||||
&base[..base.len() - 1]
|
||||
} else {
|
||||
base
|
||||
};
|
||||
let base = base.strip_suffix('/').unwrap_or(base);
|
||||
|
||||
format!("{}{}", base, href)
|
||||
} else {
|
||||
// رابط نسبي
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue