pinakes-core: fix minor clippy warnings; add toggle for Swagger UI generation
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ie33a5d17b774289023e3855789d3adc86a6a6964
This commit is contained in:
parent
5e0f404fc7
commit
aa68d742c9
4 changed files with 12 additions and 6 deletions
|
|
@ -49,6 +49,9 @@ pinakes-plugin-api.workspace = true
|
|||
wasmtime.workspace = true
|
||||
ed25519-dalek.workspace = true
|
||||
|
||||
[features]
|
||||
ffmpeg-tests = []
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
|
|
|
|||
|
|
@ -1126,6 +1126,10 @@ pub struct ServerConfig {
|
|||
/// TLS/HTTPS configuration
|
||||
#[serde(default)]
|
||||
pub tls: TlsConfig,
|
||||
/// Enable the Swagger UI at /api/docs.
|
||||
/// Defaults to true. Set to false to disable in production if desired.
|
||||
#[serde(default = "default_true")]
|
||||
pub swagger_ui: bool,
|
||||
}
|
||||
|
||||
/// TLS/HTTPS configuration for secure connections
|
||||
|
|
@ -1470,6 +1474,7 @@ impl Default for Config {
|
|||
cors_enabled: false,
|
||||
cors_origins: vec![],
|
||||
tls: TlsConfig::default(),
|
||||
swagger_ui: true,
|
||||
},
|
||||
ui: UiConfig::default(),
|
||||
accounts: AccountsConfig::default(),
|
||||
|
|
|
|||
|
|
@ -3729,7 +3729,7 @@ impl StorageBackend for PostgresBackend {
|
|||
))
|
||||
})
|
||||
})
|
||||
.transpose()?;
|
||||
.transpose()?; // u32 fits in i32 for any valid track index, error is a safeguard
|
||||
let offset_ms = i32::try_from(subtitle.offset_ms).map_err(|_| {
|
||||
PinakesError::InvalidOperation(format!(
|
||||
"subtitle offset_ms {} exceeds i32 range",
|
||||
|
|
@ -3791,7 +3791,7 @@ impl StorageBackend for PostgresBackend {
|
|||
is_embedded: row.get("is_embedded"),
|
||||
track_index: row
|
||||
.get::<_, Option<i32>>("track_index")
|
||||
.map(|i| usize::try_from(i).unwrap_or(0)),
|
||||
.map(|i| u32::try_from(i).unwrap_or(0)),
|
||||
offset_ms: i64::from(row.get::<_, i32>("offset_ms")),
|
||||
created_at: row.get("created_at"),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4297,9 +4297,7 @@ impl StorageBackend for SqliteBackend {
|
|||
.as_ref()
|
||||
.map(|p| p.to_string_lossy().to_string());
|
||||
let is_embedded = subtitle.is_embedded;
|
||||
let track_index = subtitle
|
||||
.track_index
|
||||
.map(|i| i64::try_from(i).unwrap_or(i64::MAX));
|
||||
let track_index = subtitle.track_index.map(i64::from);
|
||||
let offset_ms = subtitle.offset_ms;
|
||||
let now = subtitle.created_at.to_rfc3339();
|
||||
let fut = tokio::task::spawn_blocking(move || {
|
||||
|
|
@ -4365,7 +4363,7 @@ impl StorageBackend for SqliteBackend {
|
|||
is_embedded: row.get::<_, i32>(5)? != 0,
|
||||
track_index: row
|
||||
.get::<_, Option<i64>>(6)?
|
||||
.map(|i| usize::try_from(i).unwrap_or(0)),
|
||||
.and_then(|i| u32::try_from(i).ok()),
|
||||
offset_ms: row.get(7)?,
|
||||
created_at: parse_datetime(&created_str),
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue