diff options
author | Vika <vika@fireburn.ru> | 2024-08-18 01:13:52 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2024-08-18 01:13:52 +0300 |
commit | b32ed9ce706650f9e71aa74eb0e26e333215e0e3 (patch) | |
tree | a78cf76b963354cc017e41faad6a9dacb41754fd /src | |
parent | bf1a6ec8985ba801a9c7c2b321c98d38c9e6228a (diff) | |
download | kittybox-b32ed9ce706650f9e71aa74eb0e26e333215e0e3.tar.zst |
kittybox-indieauth-helper: ignore TLS in debug and xdg-open the page
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/kittybox-indieauth-helper.rs | 15 |
1 files changed, 14 insertions, 1 deletions
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); |