pinakes-server: update remaining route imports and handlers
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I67206fd813d514f8903041eea0a4cd266a6a6964
This commit is contained in:
parent
2b2c1830a1
commit
eb6c0a3577
20 changed files with 169 additions and 87 deletions
|
|
@ -1,6 +1,18 @@
|
|||
use axum::{Json, extract::State};
|
||||
|
||||
use crate::{dto::*, error::ApiError, state::AppState};
|
||||
use crate::{
|
||||
dto::{
|
||||
ConfigResponse,
|
||||
RootDirRequest,
|
||||
ScanningConfigResponse,
|
||||
ServerConfigResponse,
|
||||
UiConfigResponse,
|
||||
UpdateScanningRequest,
|
||||
UpdateUiConfigRequest,
|
||||
},
|
||||
error::ApiError,
|
||||
state::AppState,
|
||||
};
|
||||
|
||||
pub async fn get_config(
|
||||
State(state): State<AppState>,
|
||||
|
|
@ -15,18 +27,11 @@ pub async fn get_config(
|
|||
let config_writable = match &state.config_path {
|
||||
Some(path) => {
|
||||
if path.exists() {
|
||||
std::fs::metadata(path)
|
||||
.map(|m| !m.permissions().readonly())
|
||||
.unwrap_or(false)
|
||||
std::fs::metadata(path).is_ok_and(|m| !m.permissions().readonly())
|
||||
} else {
|
||||
path
|
||||
.parent()
|
||||
.map(|parent| {
|
||||
std::fs::metadata(parent)
|
||||
.map(|m| !m.permissions().readonly())
|
||||
.unwrap_or(false)
|
||||
})
|
||||
.unwrap_or(false)
|
||||
path.parent().is_some_and(|parent| {
|
||||
std::fs::metadata(parent).is_ok_and(|m| !m.permissions().readonly())
|
||||
})
|
||||
}
|
||||
},
|
||||
None => false,
|
||||
|
|
@ -128,18 +133,11 @@ pub async fn update_scanning_config(
|
|||
let config_writable = match &state.config_path {
|
||||
Some(path) => {
|
||||
if path.exists() {
|
||||
std::fs::metadata(path)
|
||||
.map(|m| !m.permissions().readonly())
|
||||
.unwrap_or(false)
|
||||
std::fs::metadata(path).is_ok_and(|m| !m.permissions().readonly())
|
||||
} else {
|
||||
path
|
||||
.parent()
|
||||
.map(|parent| {
|
||||
std::fs::metadata(parent)
|
||||
.map(|m| !m.permissions().readonly())
|
||||
.unwrap_or(false)
|
||||
})
|
||||
.unwrap_or(false)
|
||||
path.parent().is_some_and(|parent| {
|
||||
std::fs::metadata(parent).is_ok_and(|m| !m.permissions().readonly())
|
||||
})
|
||||
}
|
||||
},
|
||||
None => false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue