You've already forked AstralRinth
forked from didirus/AstralRinth
Add license name to license_text response (#555)
This commit is contained in:
@@ -321,6 +321,7 @@ pub async fn license_list() -> HttpResponse {
|
|||||||
|
|
||||||
#[derive(serde::Serialize)]
|
#[derive(serde::Serialize)]
|
||||||
pub struct LicenseText {
|
pub struct LicenseText {
|
||||||
|
title: String,
|
||||||
body: String,
|
body: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,12 +333,14 @@ pub async fn license_text(
|
|||||||
|
|
||||||
if license_id == *crate::models::projects::DEFAULT_LICENSE_ID {
|
if license_id == *crate::models::projects::DEFAULT_LICENSE_ID {
|
||||||
return Ok(HttpResponse::Ok().json(LicenseText {
|
return Ok(HttpResponse::Ok().json(LicenseText {
|
||||||
|
title: "All Rights Reserved".to_string(),
|
||||||
body: "All rights reserved unless explicitly stated.".to_string(),
|
body: "All rights reserved unless explicitly stated.".to_string(),
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(license) = spdx::license_id(&license_id) {
|
if let Some(license) = spdx::license_id(&license_id) {
|
||||||
return Ok(HttpResponse::Ok().json(LicenseText {
|
return Ok(HttpResponse::Ok().json(LicenseText {
|
||||||
|
title: license.full_name.to_string(),
|
||||||
body: license.text().to_string(),
|
body: license.text().to_string(),
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user