This commit is contained in:
Simon
2025-09-03 12:15:08 +00:00
parent c3f994ccbb
commit ff18f3eb34
8 changed files with 279 additions and 132 deletions

View File

@@ -10,6 +10,7 @@ use ntex_files as fs;
use ntex::web;
mod api;
mod proxy;
mod db;
mod models;
mod providers;
@@ -17,6 +18,7 @@ mod schema;
mod status;
mod util;
mod videos;
mod proxies;
type DbPool = r2d2::Pool<ConnectionManager<SqliteConnection>>;
@@ -43,7 +45,7 @@ async fn main() -> std::io::Result<()> {
.expect("Failed to create pool.");
let mut requester = util::requester::Requester::new();
requester.set_proxy(env::var("PROXY").unwrap_or("0".to_string()) == "1".to_string());
requester.set_proxy(env::var("PROXY").unwrap_or("0".to_string()) != "0".to_string());
let cache: util::cache::VideoCache = crate::util::cache::VideoCache::new();
@@ -55,6 +57,7 @@ async fn main() -> std::io::Result<()> {
.state(requester.clone())
.wrap(web::middleware::Logger::default())
.service(web::scope("/api").configure(api::config))
.service(web::scope("/proxy").configure(proxy::config))
.service(
web::resource("/")
.route(web::get().to(|| async {