mirror of
https://github.com/YGGverse/btracker.git
synced 2026-03-31 17:15:31 +00:00
move css to separated cachable file, update config api
This commit is contained in:
parent
1d64acef2c
commit
054968ca5d
4 changed files with 173 additions and 169 deletions
10
src/main.rs
10
src/main.rs
|
|
@ -106,29 +106,31 @@ fn rss(feed: &State<Feed>, storage: &State<Storage>) -> Result<RawXml<String>, C
|
|||
#[launch]
|
||||
fn rocket() -> _ {
|
||||
use clap::Parser;
|
||||
use rocket::fs::FileServer;
|
||||
let config = Config::parse();
|
||||
let feed = Feed::init(
|
||||
config.title.clone(),
|
||||
config.description.clone(),
|
||||
config.link.clone(),
|
||||
config.canonical_url.clone(),
|
||||
config.tracker.clone(),
|
||||
);
|
||||
let storage = Storage::init(config.storage, config.list_limit, config.capacity).unwrap(); // @TODO handle
|
||||
let storage = Storage::init(config.preload, config.list_limit, config.capacity).unwrap(); // @TODO handle
|
||||
rocket::build()
|
||||
.attach(Template::fairing())
|
||||
.configure(rocket::Config {
|
||||
port: config.port,
|
||||
address: config.address,
|
||||
address: config.host,
|
||||
..rocket::Config::debug_default()
|
||||
})
|
||||
.manage(feed)
|
||||
.manage(storage)
|
||||
.manage(Meta {
|
||||
canonical: config.link,
|
||||
canonical: config.canonical_url,
|
||||
description: config.description,
|
||||
format_time: config.format_time,
|
||||
title: config.title,
|
||||
trackers: config.tracker,
|
||||
})
|
||||
.mount("/", FileServer::from(config.statics))
|
||||
.mount("/", routes![index, rss])
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue