about summary refs log tree commit diff
path: root/src/bin
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/kittybox-indieauth-helper.rs15
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);