Site: no «free and open source» line; recent downloads without bots, long cells wrap
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8b0d68f480
commit
78ef78fda1
9 changed files with 5 additions and 13 deletions
|
|
@ -931,10 +931,10 @@ async fn stats(State(state): State<Shared>, headers: HeaderMap) -> Response {
|
|||
);
|
||||
|
||||
let mut recent = String::from(
|
||||
"<section class=wide><h2>Последние скачивания (все, включая отсеянные)</h2><table><tr><th>Время (UTC)</th><th>Файл</th><th>Версия</th><th>Где</th><th>Язык</th><th>Откуда</th><th>Кто</th></tr>",
|
||||
"<section class=wide><h2>Последние скачивания (без ботов; ваши и из локальной сети — серым)</h2><table class=recent><tr><th>Время (UTC)</th><th>Файл</th><th>Версия</th><th>Где</th><th>Язык</th><th>Откуда</th><th>Кто</th></tr>",
|
||||
);
|
||||
if let Ok(mut stmt) = db.prepare(
|
||||
"SELECT ts, platform, version, country, region, city, lang, referrer, kind, ua FROM downloads ORDER BY id DESC LIMIT 50",
|
||||
"SELECT ts, platform, version, country, region, city, lang, referrer, kind, ua FROM downloads WHERE kind <> 'bot' ORDER BY id DESC LIMIT 50",
|
||||
) {
|
||||
let rows = stmt.query_map([], |r| {
|
||||
(0..10)
|
||||
|
|
@ -950,14 +950,13 @@ async fn stats(State(state): State<Shared>, headers: HeaderMap) -> Response {
|
|||
.join(" · ");
|
||||
let who = match row[8].as_str() {
|
||||
"human" => "человек",
|
||||
"bot" => "бот",
|
||||
"owner" => "вы",
|
||||
"local" => "локальная сеть",
|
||||
other => other,
|
||||
};
|
||||
let class = if row[8] == "human" { "" } else { " class=muted" };
|
||||
recent.push_str(&format!(
|
||||
"<tr{class}><td>{}</td><td>{}</td><td>{}</td><td>{place}</td><td>{}</td><td>{}</td><td title=\"{}\">{who}</td></tr>",
|
||||
"<tr{class}><td>{}</td><td>{}</td><td>{}</td><td class=wrap>{place}</td><td>{}</td><td class=wrap>{}</td><td title=\"{}\">{who}</td></tr>",
|
||||
esc(&row[0].replace('T', " ").replace('Z', "")),
|
||||
esc(platform_label(&row[1])),
|
||||
esc(&row[2]),
|
||||
|
|
@ -982,6 +981,7 @@ section.wide{{margin-top:16px}} h2{{font-size:15px;margin:0 0 10px}}
|
|||
table{{border-collapse:collapse;width:100%}} td,th{{padding:4px 6px;border-bottom:1px solid var(--line);text-align:left;white-space:nowrap}}
|
||||
.summary td{{padding:10px 8px}} .summary td:first-child{{white-space:normal}} .big{{font-size:24px;font-weight:600}}
|
||||
.grid td:first-child{{max-width:230px;overflow:hidden;text-overflow:ellipsis}} .num{{text-align:right;width:60px}} .bar{{width:40%}} .bar span{{display:block;height:8px;border-radius:4px;background:var(--accent)}}
|
||||
.recent td.wrap{{white-space:normal;overflow-wrap:anywhere;min-width:120px}}
|
||||
.muted{{color:var(--muted)}} .chart{{display:flex;gap:3px;height:150px}}
|
||||
.chart div{{flex:1;display:flex;flex-direction:column;text-align:center}}
|
||||
.chart p{{flex:1;margin:0;display:flex;align-items:flex-end;justify-content:center;gap:1px}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue