diff --git a/src/client.rs b/src/client.rs index ff3b580..f74ab51 100644 --- a/src/client.rs +++ b/src/client.rs @@ -7,7 +7,7 @@ use hyper::header::HeaderValue; use hyper::{body, body::Buf, header, Body, Client, Method, Request, Response, Uri}; use hyper_rustls::HttpsConnector; use libflate::gzip; -use log::{error, debug, warn}; +use log::{debug, error, warn}; use once_cell::sync::Lazy; use percent_encoding::{percent_encode, CONTROLS}; use serde_json::Value; diff --git a/src/instance_info.rs b/src/instance_info.rs index a3bf32d..00a142f 100644 --- a/src/instance_info.rs +++ b/src/instance_info.rs @@ -148,7 +148,7 @@ impl InstanceInfo { ["Show NSFW", &convert(&self.config.default_show_nsfw)], ["Blur NSFW", &convert(&self.config.default_blur_nsfw)], ["Use HLS", &convert(&self.config.default_use_hls)], - ["Use FFmpeg", &convert(&self.config.default_ffmpeg_video_downloads)], + ["Use FFmpeg", &convert(&self.config.default_ffmpeg_video_downloads)], ["Hide HLS notification", &convert(&self.config.default_hide_hls_notification)], ["Subscriptions", &convert(&self.config.default_subscriptions)], ["Filters", &convert(&self.config.default_filters)], diff --git a/src/main.rs b/src/main.rs index d8a7d05..365624f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,7 +13,7 @@ use log::info; use once_cell::sync::Lazy; use redsunlib::client::{canonical_path, proxy, CLIENT}; use redsunlib::server::{self, RequestExt}; -use redsunlib::utils::{error, redirect, ThemeAssets, MascotAssets}; +use redsunlib::utils::{error, redirect, MascotAssets, ThemeAssets}; use redsunlib::{config, duplicates, headers, instance_info, post, search, settings, subreddit, user}; use redsunlib::client::OAUTH_CLIENT; @@ -110,8 +110,7 @@ async fn style() -> Result, String> { /// Serve mascot async fn mascot_image(req: Request) -> Result, String> { - let res = MascotAssets::get(&req.param("name").unwrap()) - .unwrap_or(MascotAssets::get("redsunlib.png").unwrap()); + let res = MascotAssets::get(&req.param("name").unwrap()).unwrap_or(MascotAssets::get("redsunlib.png").unwrap()); Ok( Response::builder() .status(200) @@ -249,7 +248,7 @@ async fn main() { app.at("/commits.json").get(|_| async move { proxy_commit_info().await }.boxed()); app.at("/instances.json").get(|_| async move { proxy_instances().await }.boxed()); - + // FFmpeg app .at("/ffmpeg/814.ffmpeg.js") diff --git a/src/oauth.rs b/src/oauth.rs index c68e50a..d15fa2f 100644 --- a/src/oauth.rs +++ b/src/oauth.rs @@ -6,7 +6,7 @@ use crate::{ }; use base64::{engine::general_purpose, Engine as _}; use hyper::{client, Body, Method, Request}; -use log::{error, info, debug, trace}; +use log::{debug, error, info, trace}; use serde_json::json; use tokio::time::{error::Elapsed, timeout}; diff --git a/src/subreddit.rs b/src/subreddit.rs index 86388e3..2eea14c 100644 --- a/src/subreddit.rs +++ b/src/subreddit.rs @@ -12,7 +12,7 @@ use rinja::Template; use once_cell::sync::Lazy; use regex::Regex; -use time::{Duration, OffsetDateTime,macros::format_description}; +use time::{macros::format_description, Duration, OffsetDateTime}; use log::trace; @@ -301,8 +301,7 @@ pub async fn subscriptions_filters_quicklists(req: Request) -> Result Result { // Send a request to the url let res = json(path, quarantined).await?; - trace!("Subreddit info from r/{} : {}",sub,res["data"]); + trace!("Subreddit info from r/{} : {}", sub, res["data"]); // Metadata regarding the subreddit let members: i64 = res["data"]["subscribers"].as_u64().unwrap_or_default() as i64; let active: i64 = res["data"]["accounts_active"].as_u64().unwrap_or_default() as i64; - + // Grab creation date as unix timestamp let created_unix = res["data"]["created"].as_f64().unwrap_or(0.0).round() as i64; let created = OffsetDateTime::from_unix_timestamp(created_unix).unwrap_or(OffsetDateTime::UNIX_EPOCH); diff --git a/src/user.rs b/src/user.rs index 5e8bfd7..6866700 100644 --- a/src/user.rs +++ b/src/user.rs @@ -6,9 +6,9 @@ use crate::server::RequestExt; use crate::utils::{error, filter_posts, format_url, get_filters, nsfw_landing, param, setting, template, Post, Preferences, User}; use crate::{config, utils}; use hyper::{Body, Request, Response}; +use log::trace; use rinja::Template; use time::{macros::format_description, OffsetDateTime}; -use log::trace; // STRUCTS #[derive(Template)] @@ -112,7 +112,7 @@ async fn user(name: &str) -> Result { // Send a request to the url json(path, false).await.map(|res| { - trace!("User info from r/{} : {}",name,res["data"]); + trace!("User info from r/{} : {}", name, res["data"]); // Grab creation date as unix timestamp let created_unix = res["data"]["created"].as_f64().unwrap_or(0.0).round() as i64; let created = OffsetDateTime::from_unix_timestamp(created_unix).unwrap_or(OffsetDateTime::UNIX_EPOCH);