-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat: bounty deeplinks support raycast extension #1764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
f063be3
8ee4706
da0642b
9ce4806
71c95a3
1a934f6
2c15a9a
fcd13d8
693c0b2
f277947
49588ff
619cff1
81f9439
6b31864
7d2cfcc
c936a2f
38d663d
e09e05f
0de5c78
f74631b
3824c53
32c416a
fb33159
9b99a32
04e7527
bccd62b
1ac7eb2
ebbcc36
18b3690
e9c3200
e90adca
0164d43
fc93e9d
c3330ee
f8a4f9a
9d45b3e
fd8c395
a0693db
846590c
6a81c5b
406d854
7a7bdae
e9eb947
2e3e3ea
9381b9d
a321f7a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| // File: crates/recording/src/camera.rs | ||
| use cap_recording::CameraFeed; | ||
| use cap_utils::Url; | ||
| use std::collections::HashMap; | ||
|
|
||
| pub struct Camera { | ||
| pub feed: CameraFeed, | ||
| pub deeplink_handler: DeeplinkHandler, | ||
| } | ||
|
|
||
| impl Camera { | ||
| pub fn new() -> Self { | ||
| Self { | ||
| feed: CameraFeed::new(), | ||
| deeplink_handler: DeeplinkHandler::new(), | ||
| } | ||
| } | ||
|
|
||
| pub fn start_recording(&self) { | ||
| let deeplink = self.deeplink_handler.handle_deeplink("recording_start".to_string()).unwrap(); | ||
| println!("{}", deeplink.recording_start()); | ||
| } | ||
|
|
||
| pub fn stop_recording(&self) { | ||
| let deeplink = self.deeplink_handler.handle_deeplink("recording_stop".to_string()).unwrap(); | ||
| println!("{}", deeplink.recording_stop()); | ||
| } | ||
|
|
||
| pub fn pause_recording(&self) { | ||
| let deeplink = self.deeplink_handler.handle_deeplink("recording_pause".to_string()).unwrap(); | ||
| println!("{}", deeplink.recording_pause()); | ||
| } | ||
|
|
||
| pub fn resume_recording(&self) { | ||
| let deeplink = self.deeplink_handler.handle_deeplink("recording_resume".to_string()).unwrap(); | ||
| println!("{}", deeplink.recording_resume()); | ||
| } | ||
|
|
||
| pub fn switch_camera(&self) { | ||
| let deeplink = self.deeplink_handler.handle_deeplink("camera_switch".to_string()).unwrap(); | ||
| println!("{}", deeplink.camera_switch()); | ||
| } | ||
|
|
||
| pub fn switch_microphone(&self) { | ||
| let deeplink = self.deeplink_handler.handle_deeplink("microphone_switch".to_string()).unwrap(); | ||
| println!("{}", deeplink.microphone_switch()); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| // File: crates/recording/src/cap_recording.rs | ||
|
|
||
| use cap_recording::CameraFeed; | ||
| use cap_utils::Url; | ||
| use std::collections::HashMap; | ||
|
|
||
| // Removed the unnecessary and circular module declaration | ||
| // pub mod cap_recording; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| // File: crates/recording/src/cap_utils.rs | ||
| use std::collections::HashMap; | ||
|
|
||
| pub struct Url { | ||
| url: String, | ||
| } | ||
|
|
||
| impl Url { | ||
| pub fn parse(s: &str) -> Result<Self, std::fmt::Error> { | ||
| // Simplified parsing logic | ||
| if s.is_empty() || !s.contains("://") { | ||
| return Err(std::fmt::Error); | ||
| } | ||
| Ok(Url { url: s.to_string() }) | ||
| } | ||
|
|
||
| pub fn join(&self, path: &str) -> Result<Self, std::fmt::Error> { | ||
| if path.is_empty() { | ||
| return Ok(Url { | ||
| url: self.url.clone(), | ||
| }); | ||
| } | ||
| let sep = if self.url.ends_with('/') || path.starts_with('/') { | ||
| "" | ||
| } else { | ||
| "/" | ||
| }; | ||
| let joined = format!("{}{}{}", self.url, sep, path); | ||
| Url::parse(&joined) | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| // File: crates/recording/src/deeplink.rs | ||
| use cap_utils::Url; | ||
| use std::collections::HashMap; | ||
|
|
||
| pub struct Deeplink { | ||
| pub url: Url, | ||
| } | ||
|
|
||
| impl Deeplink { | ||
| pub fn new(url: Url) -> Self { | ||
| Self { url } | ||
| } | ||
|
|
||
| pub fn recording_start(&self) -> Url { | ||
| self.url.join("recording/start").unwrap() | ||
| } | ||
|
|
||
| pub fn recording_stop(&self) -> Url { | ||
| self.url.join("recording/stop").unwrap() | ||
| } | ||
|
|
||
| pub fn recording_pause(&self) -> Url { | ||
| self.url.join("recording/pause").unwrap() | ||
| } | ||
|
|
||
| pub fn recording_resume(&self) -> Url { | ||
| self.url.join("recording/resume").unwrap() | ||
| } | ||
|
|
||
| pub fn camera_switch(&self) -> Url { | ||
| self.url.join("camera/switch").unwrap() | ||
| } | ||
|
|
||
| pub fn microphone_switch(&self) -> Url { | ||
| self.url.join("microphone/switch").unwrap() | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| use cap_recording::CameraFeed; | ||
| use cap_utils::Url; | ||
| use std::collections::HashMap; | ||
|
|
||
| pub struct DeeplinkHandler { | ||
| pub deeplinks: HashMap<String, Deeplink>, | ||
| } | ||
|
|
||
|
Comment on lines
+6
to
+8
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Prompt To Fix With AIThis is a comment left during a code review.
Path: crates/recording/src/deeplink_handler.rs
Line: 6-8
Comment:
**`Deeplink` type not imported β will not compile**
`DeeplinkHandler` stores `HashMap<String, Deeplink>` and `register_deeplink` takes a `Deeplink` argument, but there is no `use` statement that brings `Deeplink` into scope. The compiler will reject this with "cannot find type `Deeplink` in this scope". Also, `use cap_recording::CameraFeed` is unused, and the file is not declared in `lib.rs`.
How can I resolve this? If you propose a fix, please make it concise. |
||
| impl DeeplinkHandler { | ||
| pub fn new() -> Self { | ||
| Self { | ||
| deeplinks: HashMap::new(), | ||
| } | ||
| } | ||
|
|
||
| pub fn register_deeplink(&mut self, name: String, deeplink: Deeplink) { | ||
| self.deeplinks.insert(name, deeplink); | ||
| } | ||
|
|
||
| pub fn handle_deeplink(&self, name: String) -> Option<&Deeplink> { | ||
| self.deeplinks.get(&name) | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| use cap_recording::CameraFeed; | ||
| use cap_utils::Url; | ||
| use std::collections::HashMap; | ||
|
|
||
| pub fn main() { | ||
| let camera = Camera::new(); | ||
| camera.start_recording(); | ||
| camera.stop_recording(); | ||
| camera.pause_recording(); | ||
| camera.resume_recording(); | ||
| camera.switch_camera(); | ||
| camera.switch_microphone(); | ||
| } | ||
|
Comment on lines
+1
to
+13
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Prompt To Fix With AIThis is a comment left during a code review.
Path: crates/recording/src/main.rs
Line: 1-13
Comment:
**`main.rs` conflicts with `lib.rs` in a library crate**
`crates/recording` already has a `lib.rs`, making it a library crate. Cargo does not allow a crate to be both a library and a binary unless the binary is placed under `src/bin/`. Placing `main.rs` directly in `src/` will either cause a build error or silently shadow the library entry point depending on the Cargo edition. Additionally, `Camera` is used here without any `use` import, and the three `use` statements at the top (`CameraFeed`, `Url`, `HashMap`) are all unused.
How can I resolve this? If you propose a fix, please make it concise. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several issues in this file:
DeeplinkHandleris referenced on line 7 and 14 but there is nousestatement importing it β the compiler will fail with "cannot find typeDeeplinkHandler".start_recording) callhandle_deeplink(...)to look up a URL and then print it. No deeplink is ever registered in theDeeplinkHandler'sHashMap, so every call returnsNoneand.unwrap()will panic at runtime.apps/desktop/src-tauri/src/deeplink_actions.rsand should be invoked there β this layer of indirection achieves nothing.use cap_recording::CameraFeed,use cap_utils::Url, anduse std::collections::HashMapare all unused.lib.rs, so it will never be compiled as part of the crate.Prompt To Fix With AI