Skip to content

Conversation

@Coder-soft
Copy link

@Coder-soft Coder-soft commented Aug 4, 2025

Unduck-Custom Search Engine Features

Features

1. Domain-Agnostic Functionality

The tool now works from any domain, not just unduck.link. The URL displayed in the interface automatically adapts to the current domain, making it easy to use the tool from different locations.

2. Built-in Search Engines

Users can select from 10 popular search engines as their default:

  • Google (bang: g)
  • DuckDuckGo (bang: d)
  • Bing (bang: b)
  • Yahoo (bang: y)
  • Yandex (bang: ya)
  • Ecosia (bang: e)
  • Startpage (bang: sp)
  • Qwant (bang: q)
  • Brave (bang: br)
  • Mojeek (bang: m)

3. Custom Search Engines

Users can add their own custom search engines with:

  • A name for the engine
  • A unique bang identifier
  • A URL template with {{{s}}} as the placeholder for search queries

4. Bang Redirects

Full compatibility with DuckDuckGo's bang system is maintained. Users can still use any of the thousands of available bangs by prefixing their search with ! followed by the bang identifier.

5. Search Priority

The search logic follows this priority order:

  1. Custom engines (user-defined)
  2. Built-in search engines
  3. DuckDuckGo bangs
  4. Default search engine (user-selected)

How It Works

Setting Your Default Search Engine

  1. When you first visit the site, Google is selected as the default search engine
  2. Use the dropdown selector to choose a different built-in search engine
  3. Your preference is automatically saved in your browser's localStorage
  4. Next time you visit, your preferred engine will be pre-selected

Using Bang Redirects

  1. Type your search query with a bang prefix, e.g., !gh unduck
  2. You'll be redirected to GitHub's search results for "unduck"
  3. If you use just !gh without a query, you'll be taken directly to github.com

Adding Custom Search Engines

  1. Click the "+ Add Custom Search Engine" button
  2. Fill in the form with:
    • Engine name (e.g., "My Custom Engine")
    • Bang identifier (e.g., "mce")
    • URL template with {{{s}}} for the search query (e.g., https://example.com/search?q={{{s}}})
  3. Click "Save" to add the engine
  4. Your custom engine will now appear in the dropdown selector
  5. You can use your custom engine's bang just like any other (e.g., !mce search terms)

Technical Implementation

Storage

User preferences and custom engines are stored in the browser's localStorage:

  • default-engine: The user's selected default search engine bang
  • custom-engines: An array of user-defined search engines

Search Logic

When a search is performed:

  1. The query is parsed to detect any bang prefixes
  2. If a bang is found, the system checks (in order):
    • Custom engines
    • Built-in engines
    • DuckDuckGo bangs
  3. If no bang is found, the user's default engine is used
  4. The query is cleaned of the bang prefix before being sent to the search engine

Domain Agnosticism

The tool uses window.location.origin to dynamically generate the correct URL for any domain, ensuring it works regardless of where it's hosted.

Chrome Extension

Simple Chrome extension to use unduck as the default search engine

Testing

The implementation includes comprehensive automated tests covering:

  • Search engine selection and persistence
  • Custom engine creation and validation
  • Bang redirect functionality
  • Domain-agnostic behavior

All tests are passing, ensuring the reliability of the implementation.

Users can now add custom search engines via the UI, which are stored in localStorage and included in the engine dropdown. The main page and search redirect logic have been updated to prioritize custom engines, and related styles and tests have been added. Also, new scripts for testing and .gitignore updates for test/config files.
Deleted the instructions block from the main page render and removed related CSS styles. This streamlines the interface and cleans up unused styling.
Integrates Supabase for storing and suggesting search history, including new environment variables, migration, and setup files. Updates UI with new fonts, dark theme, improved search form, suggestions, and settings panel. Adds Perplexity bang and refactors styles for a modern look.
Sets workbox.maximumFileSizeToCacheInBytes to 3MB in VitePWA config to allow caching of larger files in the service worker.
Initial commit of a Chrome extension that replaces the default new tab page with unduckcustom.vercel.app. Includes manifest, icons, newtab HTML, and documentation.
@Coder-soft Coder-soft changed the title Add custom engines Refractoring Every single feature and ADDING ALOT of functionalities so Theo don't have to work and can sleep with Unduck Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant