26 lines
681 B
Rust
26 lines
681 B
Rust
use mid_chat::ChatAttachment;
|
|
|
|
/*
|
|
use tokio::sync::OnceCell;
|
|
|
|
static PHOEBE_MEDIA_BASE_URL: OnceCell<String> = OnceCell::const_new();
|
|
|
|
async fn get_base_url() -> &'static str {
|
|
PHOEBE_MEDIA_BASE_URL
|
|
.get_or_init(|| async {
|
|
std::env::var("PHOEBE_MEDIA_BASE_URL")
|
|
.expect("PHOEBE_MEDIA_BASE_URL environment variable was not set!")
|
|
})
|
|
.await
|
|
}
|
|
*/
|
|
|
|
pub async fn attachment_to_url(attachment: &ChatAttachment) -> String {
|
|
match attachment {
|
|
ChatAttachment::Online { url, .. } => url.clone(),
|
|
ChatAttachment::InMemory { .. } => {
|
|
todo!("Store in-memory attachment inside webroot")
|
|
}
|
|
}
|
|
}
|