mirror of
https://github.com/YGGverse/btracker-gemini.git
synced 2026-03-31 09:05:30 +00:00
add date format option, update headers
This commit is contained in:
parent
b2f3809656
commit
90d8e48b55
2 changed files with 12 additions and 10 deletions
|
|
@ -12,6 +12,10 @@ pub struct Config {
|
|||
#[arg(short, long, default_value_t = String::from("βtracker"))]
|
||||
pub name: String,
|
||||
|
||||
/// Date format
|
||||
#[arg(short, long, default_value_t = String::from("%Y/%m/%d"))]
|
||||
pub date: String,
|
||||
|
||||
/// Tracker(s) to join / scrape requests
|
||||
#[arg(short, long)]
|
||||
pub tracker: Option<Vec<Url>>,
|
||||
|
|
|
|||
18
src/main.rs
18
src/main.rs
|
|
@ -36,7 +36,6 @@ fn main() -> Result<()> {
|
|||
}
|
||||
|
||||
let config = Arc::new(Config::parse());
|
||||
|
||||
let public = Arc::new(Public::init(&config.storage, config.limit, config.capacity).unwrap());
|
||||
|
||||
// https://geminiprotocol.net/docs/protocol-specification.gmi#the-use-of-tls
|
||||
|
|
@ -236,7 +235,8 @@ fn index(config: &Config, public: &Public, page: Option<usize>) -> Result<String
|
|||
for torrent in torrents {
|
||||
let i: TorrentMetaV1Owned = torrent_from_bytes(&torrent.bytes)?;
|
||||
b.push(format!(
|
||||
"### {}",
|
||||
"=> /{} {}",
|
||||
i.info_hash.as_string(),
|
||||
i.info
|
||||
.name
|
||||
.as_ref()
|
||||
|
|
@ -244,23 +244,21 @@ fn index(config: &Config, public: &Public, page: Option<usize>) -> Result<String
|
|||
.unwrap_or_default()
|
||||
));
|
||||
b.push(format!(
|
||||
"=> {} {} • {} • {}",
|
||||
i.info_hash.as_string(),
|
||||
torrent.time.format("%Y/%m/%d"), // @TODO optional
|
||||
"{} • {} • {}\n",
|
||||
torrent.time.format(&config.date),
|
||||
size(&i),
|
||||
files(&i),
|
||||
));
|
||||
|
||||
b.push(format!(
|
||||
))
|
||||
/*b.push(format!(
|
||||
"=> {} Magnet\n",
|
||||
magnet(&i, config.tracker.as_ref())
|
||||
))
|
||||
))*/
|
||||
}
|
||||
|
||||
b.push("## Navigation\n".into());
|
||||
|
||||
b.push(format!(
|
||||
"Page {} / {} ({total} {} total)",
|
||||
"Page {} / {} ({total} {} total)\n",
|
||||
page.unwrap_or(1),
|
||||
(total as f64 / public.default_limit as f64).ceil(),
|
||||
total.plurify(&["torrent", "torrents", "torrents"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue