fix: resolve overlapping route and deprecated base64 decode usage
Co-authored-by: aider (openai/andrew/openrouter/anthropic/claude-sonnet-4) <aider@aider.chat>
This commit is contained in:
@@ -130,7 +130,7 @@ pub async fn handle_list_items(
|
||||
)
|
||||
)]
|
||||
pub async fn handle_post_item(
|
||||
State(state): State<AppState>,
|
||||
State(_state): State<AppState>,
|
||||
) -> Result<Json<ApiResponse<ItemInfo>>, StatusCode> {
|
||||
|
||||
// This is a simplified implementation
|
||||
|
||||
@@ -16,7 +16,6 @@ use utoipa_swagger_ui::SwaggerUi;
|
||||
status::handle_status,
|
||||
item::handle_list_items,
|
||||
item::handle_post_item,
|
||||
item::handle_delete_item,
|
||||
item::handle_get_item_latest,
|
||||
item::handle_get_item_latest_meta,
|
||||
item::handle_get_item_latest_content,
|
||||
@@ -55,7 +54,4 @@ pub fn add_routes(router: Router<AppState>) -> Router<AppState> {
|
||||
pub fn add_docs_routes(router: Router<AppState>) -> Router<AppState> {
|
||||
router
|
||||
.merge(SwaggerUi::new("/swagger").url("/openapi.json", ApiDoc::openapi()))
|
||||
.route("/openapi.json", axum::routing::get(|| async {
|
||||
axum::Json(ApiDoc::openapi())
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ use axum::{
|
||||
http::StatusCode,
|
||||
response::Json,
|
||||
};
|
||||
use log::warn;
|
||||
|
||||
use crate::modes::server::common::{AppState, ApiResponse};
|
||||
use crate::common::status::{generate_status_info, StatusInfo};
|
||||
|
||||
@@ -5,6 +5,7 @@ use axum::{
|
||||
middleware::Next,
|
||||
response::Response,
|
||||
};
|
||||
use base64::Engine;
|
||||
use log::{info, warn};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashMap;
|
||||
@@ -80,7 +81,7 @@ fn check_basic_auth(auth_str: &str, expected_password: &str) -> bool {
|
||||
}
|
||||
|
||||
let encoded = &auth_str[6..];
|
||||
if let Ok(decoded_bytes) = base64::decode(encoded) {
|
||||
if let Ok(decoded_bytes) = base64::engine::general_purpose::STANDARD.decode(encoded) {
|
||||
if let Ok(decoded_str) = String::from_utf8(decoded_bytes) {
|
||||
let expected_credentials = format!("keep:{}", expected_password);
|
||||
return decoded_str == expected_credentials;
|
||||
|
||||
Reference in New Issue
Block a user