fix(client): update headers management, add self check (fix #334, fix #318)

This commit is contained in:
Matthew Esposito 2024-11-23 21:17:52 -05:00
parent 6be6f892a4
commit 100a7b65a6
3 changed files with 53 additions and 6 deletions

View file

@ -11,7 +11,7 @@ use hyper::Uri;
use hyper::{header::HeaderValue, Body, Request, Response};
use log::info;
use once_cell::sync::Lazy;
use redlib::client::{canonical_path, proxy, CLIENT};
use redlib::client::{canonical_path, proxy, rate_limit_check, CLIENT};
use redlib::server::{self, RequestExt};
use redlib::utils::{error, redirect, ThemeAssets};
use redlib::{config, duplicates, headers, instance_info, post, search, settings, subreddit, user};
@ -146,6 +146,16 @@ async fn main() {
)
.get_matches();
match rate_limit_check().await {
Ok(()) => {
info!("[✅] Rate limit check passed");
},
Err(e) => {
log::error!("[❌] Rate limit check failed: {}", e);
std::process::exit(1);
}
}
let address = matches.get_one::<String>("address").unwrap();
let port = matches.get_one::<String>("port").unwrap();
let hsts = matches.get_one("hsts").map(|m: &String| m.as_str());