refactor: remove unused OpenAPI and Swagger UI endpoints and logging statements
This commit is contained in:
committed by
Andrew Phillips (aider)
parent
0a06098796
commit
ed8bf0f7fc
@@ -194,7 +194,6 @@ async fn handle_status(
|
|||||||
headers: HeaderMap,
|
headers: HeaderMap,
|
||||||
ConnectInfo(addr): ConnectInfo<SocketAddr>,
|
ConnectInfo(addr): ConnectInfo<SocketAddr>,
|
||||||
) -> Result<Json<ApiResponse<StatusInfo>>, StatusCode> {
|
) -> Result<Json<ApiResponse<StatusInfo>>, StatusCode> {
|
||||||
info!("SERVER: GET /status from {}", addr);
|
|
||||||
if !check_auth(&headers, &state.password) {
|
if !check_auth(&headers, &state.password) {
|
||||||
warn!("Unauthorized request from {}", addr);
|
warn!("Unauthorized request from {}", addr);
|
||||||
return Err(StatusCode::UNAUTHORIZED);
|
return Err(StatusCode::UNAUTHORIZED);
|
||||||
@@ -232,7 +231,6 @@ async fn handle_list_items(
|
|||||||
headers: HeaderMap,
|
headers: HeaderMap,
|
||||||
ConnectInfo(addr): ConnectInfo<SocketAddr>,
|
ConnectInfo(addr): ConnectInfo<SocketAddr>,
|
||||||
) -> Result<Json<ApiResponse<Vec<ItemInfo>>>, StatusCode> {
|
) -> Result<Json<ApiResponse<Vec<ItemInfo>>>, StatusCode> {
|
||||||
info!("SERVER: GET /item/ from {} with params: {:?}", addr, params);
|
|
||||||
if !check_auth(&headers, &state.password) {
|
if !check_auth(&headers, &state.password) {
|
||||||
warn!("Unauthorized request to /item/ from {}", addr);
|
warn!("Unauthorized request to /item/ from {}", addr);
|
||||||
return Err(StatusCode::UNAUTHORIZED);
|
return Err(StatusCode::UNAUTHORIZED);
|
||||||
@@ -310,7 +308,6 @@ async fn handle_get_item(
|
|||||||
headers: HeaderMap,
|
headers: HeaderMap,
|
||||||
ConnectInfo(addr): ConnectInfo<SocketAddr>,
|
ConnectInfo(addr): ConnectInfo<SocketAddr>,
|
||||||
) -> Result<Json<ApiResponse<ItemInfo>>, StatusCode> {
|
) -> Result<Json<ApiResponse<ItemInfo>>, StatusCode> {
|
||||||
info!("SERVER: GET /item/{} from {} with params: {:?}", item_id, addr, params);
|
|
||||||
if !check_auth(&headers, &state.password) {
|
if !check_auth(&headers, &state.password) {
|
||||||
warn!("Unauthorized request to /item/{} from {}", item_id, addr);
|
warn!("Unauthorized request to /item/{} from {}", item_id, addr);
|
||||||
return Err(StatusCode::UNAUTHORIZED);
|
return Err(StatusCode::UNAUTHORIZED);
|
||||||
@@ -382,7 +379,6 @@ async fn handle_put_item(
|
|||||||
headers: HeaderMap,
|
headers: HeaderMap,
|
||||||
ConnectInfo(addr): ConnectInfo<SocketAddr>,
|
ConnectInfo(addr): ConnectInfo<SocketAddr>,
|
||||||
) -> Result<Json<ApiResponse<ItemInfo>>, StatusCode> {
|
) -> Result<Json<ApiResponse<ItemInfo>>, StatusCode> {
|
||||||
info!("SERVER: PUT /item/ from {}", addr);
|
|
||||||
if !check_auth(&headers, &state.password) {
|
if !check_auth(&headers, &state.password) {
|
||||||
warn!("Unauthorized request to PUT /item/ from {}", addr);
|
warn!("Unauthorized request to PUT /item/ from {}", addr);
|
||||||
return Err(StatusCode::UNAUTHORIZED);
|
return Err(StatusCode::UNAUTHORIZED);
|
||||||
@@ -407,7 +403,6 @@ async fn handle_delete_item(
|
|||||||
headers: HeaderMap,
|
headers: HeaderMap,
|
||||||
ConnectInfo(addr): ConnectInfo<SocketAddr>,
|
ConnectInfo(addr): ConnectInfo<SocketAddr>,
|
||||||
) -> Result<Json<ApiResponse<()>>, StatusCode> {
|
) -> Result<Json<ApiResponse<()>>, StatusCode> {
|
||||||
info!("SERVER: DELETE /item/{} from {}", item_id, addr);
|
|
||||||
if !check_auth(&headers, &state.password) {
|
if !check_auth(&headers, &state.password) {
|
||||||
warn!("Unauthorized request to DELETE /item/{} from {}", item_id, addr);
|
warn!("Unauthorized request to DELETE /item/{} from {}", item_id, addr);
|
||||||
return Err(StatusCode::UNAUTHORIZED);
|
return Err(StatusCode::UNAUTHORIZED);
|
||||||
@@ -445,7 +440,6 @@ async fn handle_get_content_latest(
|
|||||||
headers: HeaderMap,
|
headers: HeaderMap,
|
||||||
ConnectInfo(addr): ConnectInfo<SocketAddr>,
|
ConnectInfo(addr): ConnectInfo<SocketAddr>,
|
||||||
) -> Result<Json<ApiResponse<String>>, StatusCode> {
|
) -> Result<Json<ApiResponse<String>>, StatusCode> {
|
||||||
info!("SERVER: GET /content from {} with params: {:?}", addr, params);
|
|
||||||
if !check_auth(&headers, &state.password) {
|
if !check_auth(&headers, &state.password) {
|
||||||
warn!("Unauthorized request to /content from {}", addr);
|
warn!("Unauthorized request to /content from {}", addr);
|
||||||
return Err(StatusCode::UNAUTHORIZED);
|
return Err(StatusCode::UNAUTHORIZED);
|
||||||
@@ -498,7 +492,6 @@ async fn handle_get_content(
|
|||||||
headers: HeaderMap,
|
headers: HeaderMap,
|
||||||
ConnectInfo(addr): ConnectInfo<SocketAddr>,
|
ConnectInfo(addr): ConnectInfo<SocketAddr>,
|
||||||
) -> Result<Json<ApiResponse<String>>, StatusCode> {
|
) -> Result<Json<ApiResponse<String>>, StatusCode> {
|
||||||
info!("SERVER: GET /content/{} from {}", item_id, addr);
|
|
||||||
if !check_auth(&headers, &state.password) {
|
if !check_auth(&headers, &state.password) {
|
||||||
warn!("Unauthorized request to /content/{} from {}", item_id, addr);
|
warn!("Unauthorized request to /content/{} from {}", item_id, addr);
|
||||||
return Err(StatusCode::UNAUTHORIZED);
|
return Err(StatusCode::UNAUTHORIZED);
|
||||||
@@ -725,32 +718,6 @@ async fn handle_openapi() -> Json<serde_json::Value> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/openapi.json": {
|
|
||||||
"get": {
|
|
||||||
"summary": "Get OpenAPI specification",
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "OpenAPI specification",
|
|
||||||
"content": {
|
|
||||||
"application/json": {"schema": {"type": "object"}}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/swagger/": {
|
|
||||||
"get": {
|
|
||||||
"summary": "Swagger UI",
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "Swagger UI HTML page",
|
|
||||||
"content": {
|
|
||||||
"text/html": {"schema": {"type": "string"}}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user