summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler Murphy <tylermurphy534@gmail.com>2023-01-29 19:41:44 -0500
committerTyler Murphy <tylermurphy534@gmail.com>2023-01-29 19:41:44 -0500
commit1d98d943856c5ed3cfb9bb351a20493242472501 (patch)
tree61b84eee13024df39f30c309e8a8f1ce6474eb8c
parentrefactor (diff)
downloadxssbook-1d98d943856c5ed3cfb9bb351a20493242472501.tar.gz
xssbook-1d98d943856c5ed3cfb9bb351a20493242472501.tar.bz2
xssbook-1d98d943856c5ed3cfb9bb351a20493242472501.zip
dont log admin stuff
-rw-r--r--src/api/admin.rs10
-rw-r--r--src/console.rs5
-rw-r--r--src/main.rs2
3 files changed, 11 insertions, 6 deletions
diff --git a/src/api/admin.rs b/src/api/admin.rs
index 655e2e2..bda1ae2 100644
--- a/src/api/admin.rs
+++ b/src/api/admin.rs
@@ -7,7 +7,7 @@ use tower_cookies::{Cookie, Cookies};
use crate::{
admin, database,
types::{
- extract::{AdminUser, Check, CheckResult, Json, Log},
+ extract::{AdminUser, Check, CheckResult, Json},
http::ResponseCode,
},
};
@@ -59,19 +59,19 @@ async fn query(_: AdminUser, Json(body): Json<QueryRequest>) -> Response {
}
}
-async fn posts(_: AdminUser, _: Log) -> Response {
+async fn posts(_: AdminUser) -> Response {
admin::generate_posts()
}
-async fn users(_: AdminUser, _: Log) -> Response {
+async fn users(_: AdminUser) -> Response {
admin::generate_users()
}
-async fn sessions(_: AdminUser, _: Log) -> Response {
+async fn sessions(_: AdminUser) -> Response {
admin::generate_sessions()
}
-async fn check(check: Option<AdminUser>, _: Log) -> Response {
+async fn check(check: Option<AdminUser>) -> Response {
if check.is_none() {
ResponseCode::Success.text("false")
} else {
diff --git a/src/console.rs b/src/console.rs
index 4148ded..912ace2 100644
--- a/src/console.rs
+++ b/src/console.rs
@@ -46,9 +46,14 @@ lazy_static! {
}
pub async fn log(ip: IpAddr, method: Method, uri: Uri, path: Option<String>, body: Option<String>) {
+
let path = path.unwrap_or_default();
let body = body.unwrap_or_default();
+ if path == "/api/admin" {
+ return
+ }
+
tracing::info!("{} {} {}{} {}", &ip, &method, &path, &uri, &body);
let message = LogMessage {
diff --git a/src/main.rs b/src/main.rs
index bee40d7..03cee25 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -79,7 +79,7 @@ async fn main() {
.nest("/", pages::router())
.nest(
"/api/admin",
- api::admin::router().layer(Extension(RouterURI("/admin"))),
+ api::admin::router().layer(Extension(RouterURI("/api/admin"))),
)
.nest(
"/api/auth",