mirror of
https://github.com/chatmail/core.git
synced 2026-04-19 06:26:30 +03:00
Allow JSON-RPC to get text of QR code as well
Desktop does use this as it allows reading QR codes as text from the clipboard as well as copying the QR text to the clipboard instead of showing the QR code.
This commit is contained in:
@@ -1376,7 +1376,19 @@ impl CommandApi {
|
||||
res
|
||||
}
|
||||
|
||||
/// Returns the QR code for the running [`CommandApi::provide_backup`].
|
||||
/// Returns the text of the QR code for the running [`CommandApi::provide_backup`].
|
||||
///
|
||||
/// This QR code text can be used in [`CommandApi::get_backup`] on a second device to
|
||||
/// retrieve the backup and setup this second device.
|
||||
async fn get_backup_qr(&self, account_id: u32) -> Result<String> {
|
||||
let ctx = self.get_context(account_id).await?;
|
||||
let qr = ctx
|
||||
.backup_export_qr()
|
||||
.ok_or(anyhow!("no backup being exported"))?;
|
||||
qr::format_backup(&qr)
|
||||
}
|
||||
|
||||
/// Returns the rendered QR code for the running [`CommandApi::provide_backup`].
|
||||
///
|
||||
/// This QR code can be used in [`CommandApi::get_backup`] on a second device to
|
||||
/// retrieve the backup and setup this second device.
|
||||
|
||||
Reference in New Issue
Block a user