mirror of
https://github.com/chatmail/core.git
synced 2026-04-19 06:26:30 +03:00
JSON-RPC: add get_http_blob API
This commit is contained in:
@@ -1610,6 +1610,17 @@ impl CommandApi {
|
||||
Ok(general_purpose::STANDARD_NO_PAD.encode(blob))
|
||||
}
|
||||
|
||||
/// Makes an HTTP GET request and returns base64-encoded contents.
|
||||
///
|
||||
/// `url` is the HTTP or HTTPS URL.
|
||||
async fn get_http_blob(&self, account_id: u32, url: String) -> Result<String> {
|
||||
let ctx = self.get_context(account_id).await?;
|
||||
let blob = deltachat::net::read_url_blob(&ctx, &url).await?;
|
||||
|
||||
use base64::{engine::general_purpose, Engine as _};
|
||||
Ok(general_purpose::STANDARD_NO_PAD.encode(blob))
|
||||
}
|
||||
|
||||
/// Forward messages to another chat.
|
||||
///
|
||||
/// All types of messages can be forwarded,
|
||||
|
||||
Reference in New Issue
Block a user