From 2d1a84afdeaee86f5f819360d7169df53adafd71 Mon Sep 17 00:00:00 2001 From: ByteAtATime Date: Sun, 30 Nov 2025 15:16:02 -0800 Subject: [PATCH] feat: add deep link for confetti --- src/deep_link.rs | 24 ++++++++++++++++++++++++ src/main.rs | 4 ++++ 2 files changed, 28 insertions(+) diff --git a/src/deep_link.rs b/src/deep_link.rs index c8ee04d..cb99c43 100644 --- a/src/deep_link.rs +++ b/src/deep_link.rs @@ -26,6 +26,30 @@ pub fn is_oauth_redirect(url: &str) -> bool { url.starts_with("raycast://oauth") || url.starts_with("flare://oauth") } +pub fn parse_extension_link(url: &str) -> Option<(&str, &str, &str)> { + let url = url + .strip_prefix("raycast://extensions/") + .or_else(|| url.strip_prefix("flare://extensions/"))?; + + let parts: Vec<&str> = url.split('/').collect(); + if parts.len() >= 3 { + Some(( + parts[0], + parts[1], + parts[2].split('?').next().unwrap_or(parts[2]), + )) + } else { + None + } +} + +pub fn is_confetti_link(url: &str) -> bool { + matches!( + parse_extension_link(url), + Some(("raycast", "raycast", "confetti")) + ) +} + pub fn handle_oauth_redirect(url: &str) -> bool { if !is_oauth_redirect(url) { return false; diff --git a/src/main.rs b/src/main.rs index 947c778..6f05063 100644 --- a/src/main.rs +++ b/src/main.rs @@ -171,6 +171,10 @@ fn main() -> Result<(), Box> { } return Ok(()); } + + if deep_link::is_confetti_link(link) { + return run_confetti(); + } } match cli.command {