mirror of
https://github.com/ByteAtATime/raycast-linux.git
synced 2025-12-23 10:11:57 +00:00
feat: add deep link for confetti
This commit is contained in:
parent
85912b94e6
commit
2d1a84afde
2 changed files with 28 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -171,6 +171,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
}
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if deep_link::is_confetti_link(link) {
|
||||
return run_confetti();
|
||||
}
|
||||
}
|
||||
|
||||
match cli.command {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue