Compare commits
3 Commits
v0.35.4
...
138172b365
Author | SHA1 | Date | |
---|---|---|---|
138172b365 | |||
0791f6af41 | |||
76bf796572 |
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1357,7 +1357,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "redsunlib"
|
||||
version = "0.35.3"
|
||||
version = "0.35.4"
|
||||
dependencies = [
|
||||
"arc-swap",
|
||||
"async-recursion",
|
||||
|
@ -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, trace, warn};
|
||||
use log::{error, debug, warn};
|
||||
use once_cell::sync::Lazy;
|
||||
use percent_encoding::{percent_encode, CONTROLS};
|
||||
use serde_json::Value;
|
||||
@ -396,7 +396,7 @@ pub async fn json(path: String, quarantine: bool) -> Result<Value, String> {
|
||||
response.headers().get("x-ratelimit-reset").and_then(|val| val.to_str().ok().map(|s| s.to_string())),
|
||||
response.headers().get("x-ratelimit-used").and_then(|val| val.to_str().ok().map(|s| s.to_string())),
|
||||
) {
|
||||
trace!(
|
||||
debug!(
|
||||
"Ratelimit remaining: Header says {remaining}, we have {current_rate_limit}. Resets in {reset}. Rollover: {}. Ratelimit used: {used}",
|
||||
if is_rolling_over { "yes" } else { "no" },
|
||||
);
|
||||
|
@ -6,7 +6,7 @@ use crate::{
|
||||
};
|
||||
use base64::{engine::general_purpose, Engine as _};
|
||||
use hyper::{client, Body, Method, Request};
|
||||
use log::{error, info, trace};
|
||||
use log::{error, info, debug, trace};
|
||||
|
||||
use serde_json::json;
|
||||
use tokio::time::{error::Elapsed, timeout};
|
||||
@ -160,7 +160,7 @@ pub async fn force_refresh_token() {
|
||||
return;
|
||||
}
|
||||
|
||||
trace!("Rolling over refresh token. Current rate limit: {}", OAUTH_RATELIMIT_REMAINING.load(Ordering::SeqCst));
|
||||
debug!("Rolling over refresh token. Current rate limit: {}", OAUTH_RATELIMIT_REMAINING.load(Ordering::SeqCst));
|
||||
let new_client = Oauth::new().await;
|
||||
OAUTH_CLIENT.swap(new_client.into());
|
||||
OAUTH_RATELIMIT_REMAINING.store(99, Ordering::SeqCst);
|
||||
|
@ -13,6 +13,7 @@ use rinja::Template;
|
||||
use once_cell::sync::Lazy;
|
||||
use regex::Regex;
|
||||
use time::{Duration, OffsetDateTime};
|
||||
use log::trace;
|
||||
|
||||
// STRUCTS
|
||||
#[derive(Template)]
|
||||
@ -461,6 +462,8 @@ async fn subreddit(sub: &str, quarantined: bool) -> Result<Subreddit, String> {
|
||||
// Send a request to the url
|
||||
let res = json(path, quarantined).await?;
|
||||
|
||||
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;
|
||||
|
@ -8,6 +8,7 @@ use crate::{config, utils};
|
||||
use hyper::{Body, Request, Response};
|
||||
use rinja::Template;
|
||||
use time::{macros::format_description, OffsetDateTime};
|
||||
use log::trace;
|
||||
|
||||
// STRUCTS
|
||||
#[derive(Template)]
|
||||
@ -111,6 +112,7 @@ async fn user(name: &str) -> Result<User, String> {
|
||||
|
||||
// Send a request to the url
|
||||
json(path, false).await.map(|res| {
|
||||
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);
|
||||
|
@ -73,12 +73,6 @@
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>Content</legend>
|
||||
<div class="prefs-group">
|
||||
<label for="video_quality">Video quality:</label>
|
||||
<select name="video_quality" id="video_quality">
|
||||
{% call utils::options(prefs.video_quality, ["best", "medium", "worst"], "best") %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="prefs-group">
|
||||
<label for="post_sort" title="Applies only to subreddit feeds">Default subreddit post sort:</label>
|
||||
<select name="post_sort">
|
||||
@ -121,6 +115,12 @@
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>Media</legend>
|
||||
<div class="prefs-group">
|
||||
<label for="video_quality">Video quality:</label>
|
||||
<select name="video_quality" id="video_quality">
|
||||
{% call utils::options(prefs.video_quality, ["best", "medium", "worst"], "best") %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="prefs-group">
|
||||
<label for="autoplay_videos">Autoplay videos</label>
|
||||
<input type="hidden" value="off" name="autoplay_videos">
|
||||
|
Reference in New Issue
Block a user