feat(server): UI funcional com busca, filtros, detalhes e announce

This commit is contained in:
2026-08-06 11:14:49 -03:00
parent f31241b967
commit cdecec4a47
2 changed files with 310 additions and 36 deletions
+4 -36
View File
@@ -6,47 +6,15 @@ pub mod search;
pub mod stats;
pub mod ws;
use axum::{routing::{get, post}, Json, Router};
use axum::response::Html;
use axum::{routing::{get, post}, Router};
use tower_http::cors::CorsLayer;
use crate::state::SharedState;
const INDEX_HTML: &str = include_str!("../../static/index.html");
async fn index() -> Html<&'static str> {
Html(r#"<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Ares Next</title>
<style>
body { font-family: system-ui, -apple-system, sans-serif; margin: 0; background: #0f1115; color: #e6e6e6; display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.card { background: #181c24; border: 1px solid #2a2f3a; border-radius: 12px; padding: 40px 48px; max-width: 520px; width: 90%; }
h1 { margin: 0 0 8px; font-size: 28px; }
.status { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 13px; background: #123c2a; color: #4ade80; font-weight: 600; }
p.muted { color: #9aa3b2; margin: 8px 0 20px; }
ul { list-style: none; padding: 0; margin: 0; }
li { padding: 7px 10px; border-bottom: 1px solid #232833; font-family: ui-monospace, monospace; font-size: 14px; }
li:last-child { border-bottom: none; }
.tag { color: #7dd3fc; }
</style>
</head>
<body>
<div class="card">
<h1>Ares Next</h1>
<span class="status">online</span>
<p class="muted">Tracker P2P + busca de arquivos por hash — API pública</p>
<ul>
<li><span class="tag">GET</span> /api/v1/health</li>
<li><span class="tag">GET</span> /api/v1/search?q=...</li>
<li><span class="tag">GET</span> /api/v1/files/{file_id}</li>
<li><span class="tag">POST</span> /api/v1/announce</li>
<li><span class="tag">GET</span> /api/v1/peers/{file_id}</li>
<li><span class="tag">GET</span> /api/v1/stats</li>
<li><span class="tag">WS</span> /api/v1/tracker/ws</li>
</ul>
</div>
</body>
</html>"#)
Html(INDEX_HTML)
}
pub fn router(state: SharedState) -> Router {