Compare commits

..

2 Commits

Author SHA1 Message Date
missytake
18044c2fef fix ruff 2025-10-13 16:12:20 +02:00
missytake
f5dea1d252 feat: allow setting displayname + selfavatar via CLI 2025-10-13 16:12:18 +02:00
5 changed files with 13 additions and 63 deletions

View File

@@ -7749,17 +7749,12 @@ void dc_event_unref(dc_event_t* event);
/// Used in status messages.
#define DC_STR_CHANNEL_LEFT_BY_YOU 200
/// "Security"
///
/// Used in connectivity view.
#define DC_STR_SECUREJOIN_WAIT_TIMEOUT 201
/// "Scan to join channel %1$s"
///
/// Subtitle for channel join qrcode svg image generated by the core.
///
/// `%1$s` will be replaced with the channel name.
#define DC_STR_SECURE_JOIN_CHANNEL_QR_DESC 202
#define DC_STR_SECURE_JOIN_CHANNEL_QR_DESC 201
/**
* @}

View File

@@ -92,6 +92,12 @@ def _run_cli(
)
parser.add_argument("--email", action="store", help="email address", default=os.getenv("DELTACHAT_EMAIL"))
parser.add_argument("--password", action="store", help="password", default=os.getenv("DELTACHAT_PASSWORD"))
parser.add_argument(
"--displayname", action="store", help="the profile's display name", default=os.getenv("DELTACHAT_DISPLAYNAME"),
)
parser.add_argument(
"--avatar", action="store", help="filename of the profile's avatar", default=os.getenv("DELTACHAT_AVATAR"),
)
args = parser.parse_args(argv[1:])
with Rpc(accounts_dir=args.accounts_dir, **kwargs) as rpc:
@@ -108,7 +114,12 @@ def _run_cli(
configure_thread = Thread(
target=client.configure,
daemon=True,
kwargs={"email": args.email, "password": args.password},
kwargs={
"email": args.email,
"password": args.password,
"displayname": args.displayname,
"selfavatar": args.avatar,
},
)
configure_thread.start()
client.run_forever()

View File

@@ -888,22 +888,6 @@ impl ConfiguredLoginParam {
| ConfiguredCertificateChecks::AcceptInvalidCertificates2 => false,
}
}
/// Returns true if strict TLS checks are disabled
/// and configuration is not for a known provider
/// with broken TLS setup.
pub fn strict_tls_manually_disabled(&self) -> bool {
match self.certificate_checks {
ConfiguredCertificateChecks::OldAutomatic => {
// Old "Automatic" configuration defaults to no strict TLS.
// User should upgrade configuration.
self.provider.is_none()
}
ConfiguredCertificateChecks::Automatic | ConfiguredCertificateChecks::Strict => false,
ConfiguredCertificateChecks::AcceptInvalidCertificates
| ConfiguredCertificateChecks::AcceptInvalidCertificates2 => true,
}
}
}
#[cfg(test)]

View File

@@ -8,7 +8,6 @@ use humansize::{BINARY, format_size};
use crate::events::EventType;
use crate::imap::{FolderMeaning, scan_folders::get_watched_folder_configs};
use crate::log::info;
use crate::login_param::ConfiguredLoginParam;
use crate::quota::{QUOTA_ERROR_THRESHOLD_PERCENTAGE, QUOTA_WARN_THRESHOLD_PERCENTAGE};
use crate::stock_str;
use crate::{context::Context, log::LogExt};
@@ -531,36 +530,6 @@ impl Context {
}
ret += "</ul>";
// =============================================================================================
// Add e.g.
// Security
// TLS Certificate Checks: enabled
// =============================================================================================
if let Some(configured_login_param) = ConfiguredLoginParam::load(self).await? {
let security = stock_str::security(self).await;
ret += &format!("<h3>{security}</h3><ul>");
ret += "<li>";
if configured_login_param.strict_tls() {
// GREEN: strict TLS checks are enabled.
ret += &format!(
"<span class=\"green dot\"></span> <b>TLS Certificate Checks:</b> enabled"
);
} else if configured_login_param.strict_tls_manually_disabled() {
// RED: TLS checks are manually disabled.
ret += &format!(
"<span class=\"red dot\"></span> <b>TLS Certificate Checks:</b> disabled"
);
} else {
// YELLOW: TLS checks are automatically disabled.
ret += &format!(
"<span class=\"yellow dot\"></span> <b>TLS Certificate Checks:</b> disabled"
);
}
ret += "</li></ul>";
}
// =============================================================================================
ret += "</body></html>\n";

View File

@@ -439,10 +439,6 @@ https://delta.chat/donate"))]
#[strum(props(fallback = "Scan to join channel %1$s"))]
SecureJoinBrodcastQRDescription = 201,
/// "Security" title for connectivity view section.
#[strum(props(fallback = "Security"))]
Security = 202,
}
impl StockMessage {
@@ -1328,11 +1324,6 @@ pub(crate) async fn backup_transfer_msg_body(context: &Context) -> String {
translated(context, StockMessage::BackupTransferMsgBody).await
}
/// Stock string: `Security`.
pub(crate) async fn security(context: &Context) -> String {
translated(context, StockMessage::Security).await
}
impl Context {
/// Set the stock string for the [StockMessage].
///