From b32ed9ce706650f9e71aa74eb0e26e333215e0e3 Mon Sep 17 00:00:00 2001 From: Vika Date: Sun, 18 Aug 2024 01:13:52 +0300 Subject: kittybox-indieauth-helper: ignore TLS in debug and xdg-open the page --- src/bin/kittybox-indieauth-helper.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/bin/kittybox-indieauth-helper.rs') diff --git a/src/bin/kittybox-indieauth-helper.rs b/src/bin/kittybox-indieauth-helper.rs index 86a2a38..e7004c0 100644 --- a/src/bin/kittybox-indieauth-helper.rs +++ b/src/bin/kittybox-indieauth-helper.rs @@ -60,7 +60,14 @@ async fn main() -> Result<(), Error> { .user_agent(concat!( env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION") )); - + // This only works on debug builds. Don't get any funny thoughts. + #[cfg(debug_assertions)] + if std::env::var("KITTYBOX_DANGER_INSECURE_TLS") + .map(|y| y == "1") + .unwrap_or(false) + { + builder = builder.danger_accept_invalid_certs(true); + } builder.build().unwrap() }; @@ -98,6 +105,12 @@ async fn main() -> Result<(), Error> { eprintln!("Please visit the following URL in your browser:\n\n {}\n", indieauth_url.as_str()); + #[cfg(target_os = "linux")] + match std::process::Command::new("xdg-open").arg(indieauth_url.as_str()).spawn() { + Ok(child) => drop(child), + Err(err) => eprintln!("Couldn't xdg-open: {}", err) + } + if args.redirect_uri.is_some() { eprintln!("Custom redirect URI specified, won't be able to catch authorization response."); std::process::exit(0); -- cgit 1.4.1