diff --git a/backend/src/main.rs b/backend/src/main.rs index 3f81b20..8264411 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -11,10 +11,9 @@ mod xmlrpc; use clap::Parser; use rust_embed::RustEmbed; use axum::{ - body::Body, - extract::{Path, State}, + extract::State, http::{header, StatusCode, Uri}, - response::{IntoResponse, Response}, + response::IntoResponse, routing::{get, post}, Router, Json, }; diff --git a/backend/src/scgi.rs b/backend/src/scgi.rs index c1af30f..c44eeb6 100644 --- a/backend/src/scgi.rs +++ b/backend/src/scgi.rs @@ -1,11 +1,13 @@ -use bytes::{BufMut, Bytes, BytesMut}; +use bytes::Bytes; use std::collections::HashMap; use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::UnixStream; #[derive(Debug)] pub enum ScgiError { + #[allow(dead_code)] Io(std::io::Error), + #[allow(dead_code)] Protocol(String), } @@ -30,7 +32,7 @@ impl ScgiRequest { } } - pub fn header(mut self, key: &str, value: &str) -> Self { + pub fn _header(mut self, key: &str, value: &str) -> Self { self.headers.insert(key.to_string(), value.to_string()); self } diff --git a/backend/src/sse.rs b/backend/src/sse.rs index abfca49..fcf03f4 100644 --- a/backend/src/sse.rs +++ b/backend/src/sse.rs @@ -1,6 +1,6 @@ use axum::response::sse::{Event, Sse}; use futures::stream::{self, Stream}; -use std::{convert::Infallible, time::Duration}; +use std::convert::Infallible; use tokio_stream::StreamExt; use crate::models::{AppEvent, Torrent}; use crate::xmlrpc::{RtorrentClient, parse_multicall_response}; @@ -10,11 +10,6 @@ fn parse_size(s: &str) -> i64 { s.parse().unwrap_or(0) } -fn parse_float(s: &str) -> f64 { - // rTorrent usually returns integers for bytes done etc. - // We might need to handle empty strings. - s.parse().unwrap_or(0.0) -} pub async fn fetch_torrents(client: &RtorrentClient) -> Result, String> { // d.multicall2("", "main", ...) diff --git a/backend/src/xmlrpc.rs b/backend/src/xmlrpc.rs index 9091d44..b79e8c1 100644 --- a/backend/src/xmlrpc.rs +++ b/backend/src/xmlrpc.rs @@ -1,7 +1,7 @@ use crate::scgi::{send_request, ScgiRequest}; use quick_xml::events::Event; use quick_xml::reader::Reader; -use serde::Deserialize; + // Simple helper to build an XML-RPC method call pub fn build_method_call(method: &str, params: &[&str]) -> String { @@ -159,7 +159,7 @@ pub fn parse_string_response(xml: &str) -> Result { } Ok(Event::End(ref e)) => { if e.name().as_ref() == b"string" { - inside_string = false; + // inside_string = false; // Assuming only one string in the response which matters break; }