Put all URLs under /api/
This commit is contained in:
@@ -12,3 +12,24 @@ pub struct SearchResult {
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct Message {}
|
||||
|
||||
pub mod urls {
|
||||
pub const MOUNT_POINT: &'static str = "/api";
|
||||
pub fn cid_prefix(host: Option<&str>, cid: &str) -> String {
|
||||
if let Some(host) = host {
|
||||
format!("//{host}/api/cid/{cid}/")
|
||||
} else {
|
||||
format!("/api/cid/{cid}/")
|
||||
}
|
||||
}
|
||||
pub fn download_attachment(host: Option<&str>, id: &str, idx: &str, filename: &str) -> String {
|
||||
if let Some(host) = host {
|
||||
format!(
|
||||
"//{host}/api/download/attachment/{}/{}/{}",
|
||||
id, idx, filename
|
||||
)
|
||||
} else {
|
||||
format!("/api/download/attachment/{}/{}/{}", id, idx, filename)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user