1
0
Fork 0
forked from alemi/upub

feat: option to allow public debug fetches

This commit is contained in:
əlemi 2024-05-20 01:42:30 +02:00
parent 9105f73921
commit d3b141c9b5
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 4 additions and 1 deletions

View file

@ -64,6 +64,9 @@ pub struct DatasourceConfig {
pub struct SecurityConfig {
#[serde(default)]
pub allow_registration: bool,
#[serde(default)]
pub allow_public_debugger: bool,
}

View file

@ -50,7 +50,7 @@ pub async fn debug(
AuthIdentity(auth): AuthIdentity,
) -> crate::Result<Json<serde_json::Value>> {
// only local users can request debug fetches
if !matches!(auth, Identity::Local(_)) {
if !ctx.cfg().security.allow_public_debugger && !matches!(auth, Identity::Local(_)) {
return Err(UpubError::unauthorized());
}
Ok(Json(