Skip to content
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

Add DuckDuckGo Bangs inspired search-plus extension #17418

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

franzwilhelm
Copy link
Contributor

@franzwilhelm franzwilhelm commented Feb 27, 2025

Description

Search Plus implements DuckDuckGo-style bangs search directly in Raycast without sending traffic through third-party websites. It allows users to search specific websites using shortcuts like:

  • !g cats to search Google for "cats"
  • !w cats to search Wikipedia for "cats"
  • Help me fix my code !t3 to use t3.chat for AI code help

For the best experience, users can set up Search Plus as a Fallback Command in Raycast, enabling bang searches directly from the main Raycast search.

Made this based on inspiration from Theo Browne on YouTube, and I want his take on the PR if he has the time to review it.

Screencast

Using the search command

480p.mov

Browsing available search engines

Screen.Recording.2025-02-27.at.23.43.25.mov

Checklist

@raycastbot raycastbot added the new extension Label for PRs with new extensions label Feb 27, 2025
@raycastbot
Copy link
Collaborator

Congratulations on your new Raycast extension! 🚀

Due to our current reduced availability, the initial review may take up to 10-15 business days

Once the PR is approved and merged, the extension will be available on our Store.

@franzwilhelm
Copy link
Contributor Author

@t3dotgg I watched your video and got inspired to implement this directly into Raycast. Tell me what you think if you get the chance to look at this!

@franzwilhelm franzwilhelm changed the title Add search-plus extension Add DuckDuckGo Bangs inspired search-plus extension Feb 27, 2025
@franzwilhelm
Copy link
Contributor Author

People in the chat of the youtube video are saying a good name would be search router. I'm open for name suggestions here

image

@lacherogwu lacherogwu mentioned this pull request Feb 28, 2025
5 tasks
@franzwilhelm
Copy link
Contributor Author

@lacherogwu I tried to add you as a contributor to the project, but your Raycast user was not found:

Not found (https://www.raycast.com/api/v1/users/lacherogwu RequestID: ac9c86f6-7ac5-4ec0-b3af-09ef78d6e702)

@pernielsentikaer: @lacherogwu should be a contributor as he had some great suggestions in his PR published some time after this one.

@pernielsentikaer
Copy link
Collaborator

@lacherogwu what's your Raycast handle?

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR adds a new "Search Plus" extension that implements DuckDuckGo-style bangs search functionality directly in Raycast, allowing users to search specific websites using shortcuts.

  • The src/lib/search-engines.ts file contains SQL injection vulnerabilities where user input is directly interpolated into queries without sanitization
  • The src/search.tsx function lacks proper handling for empty queries and could benefit from using showFailureToast from @raycast/utils for error handling
  • The CHANGELOG.md entry date is set to 2025-02-27 which is in the future and should use the {PR_MERGE_DATE} template instead
  • The extension should include a metadata folder with screenshots since it has a view command (browse-search-engines)
  • The launchCommand function in search.tsx should be wrapped in a try-catch block for better error handling

💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!

13 file(s) reviewed, 16 comment(s)
Edit PR Review Bot Settings | Greptile

@pernielsentikaer pernielsentikaer self-assigned this Mar 2, 2025
@pernielsentikaer
Copy link
Collaborator

This seems to be the same as #17297. Could we work together on creating one by taking the best of both?

@lacherogwu
Copy link
Contributor

lacherogwu commented Mar 2, 2025

@pernielsentikaer
My raycast handle is lachero

Perhaps you could also take a look at my submission, #17436, which I believe offers a more elegant and well-structured solution.

@franzwilhelm
Copy link
Contributor Author

@pernielsentikaer: As pointed out, it looks like there are now four PRs addressing the same problem. Here's a quick summary for clarity:

Quicklink extension wrappers around unduck.link:

These PRs wrap a quicklink with https://unduck.link?q={query}. Unduck.link itself is a web-based implementation of DuckDuckGo Bangs!. While this approach works, I believe adding extensions for every link on the web could lead to unnecessary bloat in the Raycast store.

Local-first DuckDuckGo Bangs! implementations:

These PRs implement DuckDuckGo Bangs! functionality (similar to unduck.link) directly within Raycast, allowing users to bypass the need for a proxy URL.

Regarding the overlap between this PR and @lacherogwu's, it seems we both independently arrived at similar solutions around the same time. This PR was submitted about 15 hours earlier, but I noticed some great implementation details in @lacherogwu's PR, which I’ve incorporated here. I see this as an opportunity for collaboration, as we’re both working toward the same goal: providing users with the best possible extension.

This PR also includes additional functionality that I believe enhances the user experience, such as the ability to browse available bangs, try them out, and set a default directly within the UI. As @lacherogwu pointed out, I opted not to use the Raycast preferences API in this implementation, as I found it provided a less intuitive experience compared to letting users select options during their search. However, I’m open to feedback and happy to adjust this approach if needed—that’s why this PR is still under review.

Looking forward to hearing everyone’s thoughts and working together to deliver the best solution for users!

- add lachero as contributor ref. raycast#17436
- feat: use raycast preferences instead of custom file preferences
- fix: adress PR review on spelling, logging, templating
- fix: adress PR review to simplify and handle errors better in search.tsx
@franzwilhelm
Copy link
Contributor Author

Update

  • Addressed issues detected by automated PR reviews
  • Moved over to setting default search using preferences API as noticed by @lacherogwu
  • Added @lacherogwu (lachero) as contributor to package.json

@franzwilhelm
Copy link
Contributor Author

@lacherogwu @jafupy @andrewbellucci Do you think the extension should be named unduck like Theo's implementation, or should we stay closer to the "bangs" concept in the naming? The reason I'm asking is that DuckDuck Go had the original implementation, and we should choose the naming that leads to more people discovering the extension in the store. It might be called something else, but having unduck as one of the keywords in search. Let's discuss and land on something together?

@pernielsentikaer
Copy link
Collaborator

Following replies from third parties

@lacherogwu
Copy link
Contributor

@franzwilhelm I think the name doesn't matter too much in terms of discoverability. Personally, the idea came from Theo, and I really appreciate the work he did with the unduck.link webpage. I believe it would be fitting to stick with the name "Unduck," as it carries the meaning and intent behind Theo's original implementation, which I also found appealing.

@pernielsentikaer
Copy link
Collaborator

It is certain that having four extensions performing the same functions is not feasible; it would be preferable to consolidate all features and ideas into a single extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants