fix: исправлены роуты веб-сервера и обновлён Makefile
- Убран дублирующийся роут /favicon.ico - Добавлен импорт ServeDir - Makefile: поддержка ImageMagick 6 и 7 - Добавлена цель favicon
This commit is contained in:
BIN
src/static/favicon.ico
Normal file
BIN
src/static/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -4,12 +4,13 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>AE Anons - Nexrender Job Manager</title>
|
||||
<title>AE Anons</title>
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="icon" type="image/png" href="/favicon.ico">
|
||||
<link rel="apple-touch-icon" href="/favicon.ico">
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="/favicon.ico">
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
|
||||
<link rel="apple-touch-icon" href="/assets/logo.png">
|
||||
<!-- CSS -->
|
||||
<link rel="stylesheet" href="/static/fontawesome/all.min.css">
|
||||
<link rel="stylesheet" href="/static/style.css">
|
||||
</head>
|
||||
@@ -26,7 +27,7 @@
|
||||
<i class="fas fa-bolt"></i>
|
||||
</div>
|
||||
</div>
|
||||
<h1>AE Anons - Nexrender Job Manager</h1>
|
||||
<h1>AE Anons</h1>
|
||||
</div>
|
||||
<div class="header-controls">
|
||||
<button class="theme-toggle" onclick="toggleTheme()">
|
||||
|
||||
27
src/web.rs
27
src/web.rs
@@ -89,13 +89,16 @@ pub async fn run_web_server(config: Config) -> anyhow::Result<()> {
|
||||
.route("/favicon.ico", get(favicon))
|
||||
.route("/static/style.css", get(style_css))
|
||||
.route("/static/fontawesome/all.min.css", get(fontawesome_css))
|
||||
.nest_service("/static/fontawesome/webfonts", ServeDir::new("src/static/fontawesome/webfonts"))
|
||||
.route("/assets/logo.png", get(logo_png))
|
||||
.route("/api/jobs", get(list_jobs))
|
||||
.route("/api/generate", post(generate_jobs))
|
||||
.route("/api/cleanup", post(cleanup_jobs))
|
||||
.route("/api/status", get(get_status))
|
||||
.route("/api/jobs/stop-all", post(stop_all_jobs))
|
||||
.nest_service(
|
||||
"/static/fontawesome/webfonts",
|
||||
ServeDir::new("src/static/fontawesome/webfonts"),
|
||||
)
|
||||
.layer(TraceLayer::new_for_http())
|
||||
.with_state(state);
|
||||
|
||||
@@ -112,19 +115,31 @@ async fn index_page() -> Html<&'static str> {
|
||||
}
|
||||
|
||||
async fn style_css() -> impl IntoResponse {
|
||||
([(CONTENT_TYPE, "text/css")], include_str!("static/style.css"))
|
||||
(
|
||||
[(CONTENT_TYPE, "text/css")],
|
||||
include_str!("static/style.css"),
|
||||
)
|
||||
}
|
||||
|
||||
async fn fontawesome_css() -> impl IntoResponse {
|
||||
([(CONTENT_TYPE, "text/css")], include_str!("static/fontawesome/all.min.css"))
|
||||
(
|
||||
[(CONTENT_TYPE, "text/css")],
|
||||
include_str!("static/fontawesome/all.min.css"),
|
||||
)
|
||||
}
|
||||
|
||||
async fn logo_png() -> impl IntoResponse {
|
||||
([(CONTENT_TYPE, "image/png")], include_bytes!("../assets/logo.png").as_slice())
|
||||
(
|
||||
[(CONTENT_TYPE, "image/png")],
|
||||
include_bytes!("../assets/logo.png").as_slice(),
|
||||
)
|
||||
}
|
||||
|
||||
async fn favicon() -> impl IntoResponse {
|
||||
([(CONTENT_TYPE, "image/png")], include_bytes!("../assets/logo.png").as_slice())
|
||||
(
|
||||
[(CONTENT_TYPE, "image/x-icon")],
|
||||
include_bytes!("static/favicon.ico").as_slice(),
|
||||
)
|
||||
}
|
||||
|
||||
async fn list_jobs(State(state): State<AppState>) -> Result<Json<Vec<JobInfo>>, AppError> {
|
||||
@@ -220,4 +235,4 @@ impl IntoResponse for AppError {
|
||||
fn into_response(self) -> axum::response::Response {
|
||||
(self.0, self.1).into_response()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user