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

Custom Search Engines #8

Open
JesFEREM opened this issue May 31, 2024 · 2 comments
Open

Custom Search Engines #8

JesFEREM opened this issue May 31, 2024 · 2 comments

Comments

@JesFEREM
Copy link

I want to use a search engine self hosted by a friend of mines which is searx.absturztau.be
it would be cool to add an optional permission to intercept links from any site of your choice
Here's an example from Extension UBlacklist
image

@dmlls
Copy link
Owner

dmlls commented Jun 4, 2024

Hi @JesFEREM, that's a great idea and definitely should be implemented! It would also help keep the "default" list of permissions smaller and avoid having to update the SearX(NG) instances manually.

Since this will take a bit longer to implement (there are some rather big changes needed, such as restructuring the way settings are stored), for now I've published a minor release updating the SearX(NG) instances (including your friend's ;).

I'll leave the issue open until it's implemented, and get back to you then.

@dmlls
Copy link
Owner

dmlls commented Jul 7, 2024

Hi back @JesFEREM. After digging a bit into the matter, I've got to know that optional permissions must be declared in the manifest.json before they can be requested through the permissions API.

This, unfortunately, makes this feature unable to be implemented in this way, since the manifest cannot be modified programmatically. I've been also taking a look at the example you gave, and the search engine URLs are hardcoded in search-engines.ts, which then are injected into manifest.json.ts.

I can see three ways to work around this:

  1. Keep the current model, curating the supported search engine URLs manually, and accepting requests via issues (we could add a shortcut to the addon UI to make it simple for any user).
  2. Requesting the <all_urls> permission, which I really would not want to do, since it can raise privacy concerns in the users.
  3. There is also the activeTab permission, which seems like a reasonable compromise between options 1 and 3.

Unfortunately, since we capture the bangs from the URL by looking e.g. at the query parameters, options 1 and 3 will lead to accidental triggers since there are plenty of non-search sites using these parameters. Which takes us back to the beginning: the necessity to hardcode the search engine sites (option 1).

Long story short, I do not see a way of implementing this, but do please let me know if you have any ideas.

Update:
I was thinking a bit further, and actually a possible solution would be to:

  1. Request the activeTab permission.
  2. Keep the hardcoded sites in which the bangs will trigger.
  3. Give the user the option to add new sites to the "trigger" list.

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

No branches or pull requests

2 participants