Fix some unused stuff

This commit is contained in:
Greg Shuflin 2025-02-16 01:13:29 -08:00
parent 85550c318e
commit 2874d3a885
2 changed files with 6 additions and 15 deletions

View File

@ -1,4 +1,5 @@
use feed_rs;
use feed_rs::model::Feed;
use feed_rs::parser;
use std::time::Duration;
use tracing::{error, info};
use url::Url;
@ -6,7 +7,7 @@ use url::Url;
#[derive(Debug)]
pub struct FeedError;
pub async fn fetch_feed(url: &Url) -> Result<feed_rs::model::Feed, FeedError> {
pub async fn fetch_feed(url: &Url) -> Result<Feed, FeedError> {
info!("Making a request to fetch feed `{url}`");
// Create a client with a 10 second timeout
@ -34,7 +35,7 @@ pub async fn fetch_feed(url: &Url) -> Result<feed_rs::model::Feed, FeedError> {
})?;
// Parse the feed
let feed_data = feed_rs::parser::parse(content.as_bytes()).map_err(|e| {
let feed_data = parser::parse(content.as_bytes()).map_err(|e| {
error!("Failed to parse feed content: {}", e);
FeedError
})?;

View File

@ -1,21 +1,16 @@
// Module for handling OPML feed list imports
use std::io::Cursor;
use std::io::Read;
use quick_xml::de::from_reader;
use rocket::data::ToByteUnit;
use rocket::form::Form;
use rocket::fs::TempFile;
use rocket::http::Status;
use rocket::serde::json::Json;
use rocket::serde::{Deserialize, Serialize};
use rocket::tokio::io::AsyncReadExt;
use rocket::{post, Data, State};
use rocket_db_pools::Connection;
use tokio::spawn;
use tracing::{error, info};
use url::Url;
use tracing::error;
use uuid::Uuid;
use crate::feed_utils::fetch_feed;
@ -75,11 +70,6 @@ impl OpmlOutline {
}
}
#[derive(FromForm)]
pub struct UploadForm<'f> {
file: TempFile<'f>,
}
/// Import feeds from an OPML file
#[post("/import/opml", data = "<file>")]
pub async fn import_opml(
@ -216,7 +206,7 @@ async fn import_feeds_job(
imported_count += 1;
}
}
Err(e) => {
Err(_) => {
error!("Failed to fetch or parse feed from {url}");
}
}