GithubHelp home page GithubHelp logo

kagisearch / browser_extensions Goto Github PK

View Code? Open in Web Editor NEW
82.0 5.0 23.0 44.38 MB

Official companion browser extensions for Kagi Search (Chrome, Firefox)

License: MIT License

JavaScript 39.77% CSS 7.48% HTML 34.07% Swift 18.68%

browser_extensions's Introduction

Kagi Search Extension

This contains the source for the Kagi Search extension for Firefox and Chrome.

Get it for your browser here:

Contents

Extension Features

  • Sets Kagi as your default search engine
  • Automatic login when searching in incognito/private browsing
  • Use the Universal Summarizer on the current page
  • ... more in the future!

Other Browsers

Loading from source

Building

To build the extension, you will need node and npm installed.

  1. Obtain the files from this repo, either via git clone https://github.com/kagisearch/browser_extensions or by downloading the source zip.
  2. run npm i to install adm-zip which is used to package up the files.
  3. You can now run npm run build-firefox or npm run build-chrome to zip up the relevant files and output a zip file.

You can also download a pre-packaged zip from our releases page.

Download

First, obtain the source code from the release page:

GitHub Releases

Or by cloning the repo:

git clone https://github.com/kagisearch/browser_extensions

Loading the extension

Firefox

  1. Head to about:debugging
  2. Click on "This Firefox"
  3. Click "Load Temporary Add-On"
  4. Select the zip file or manifest.json of the extension.

Chrome

  1. Head to chrome://extensions
  2. Turn on "Developer mode" in the top right and then some new buttons will pop up.
  3. Click on Load unpacked extension
  4. Select the zip file or you may have to unzip the zip and select the folder outputted from extraction.

Contributing

Accepted Contributions

Bugfixes and improvements to the extension's code are welcome!

At the time we are not accepting PRs for new features without prior approval.

You can inquire about new features or report bugs here:

Instructions

  1. Fork it (https://github.com/kagisearch/browser_extensions/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Development

Check the recommended and required node and npm versions in the package.json and .nvmrc files.

npm ci  # install dependencies
npm run watch-firefox  # builds the firefox zip file and unzips it into the `built/` directory every time a file changes
npm run watch-chrome  # builds the chrome zip file and unzips it into the `built/` directory every time a file changes
npm run format  # formats the code

Testing/sharing/debugging

npm run test  # runs the linter & formatter checks
npm run build  # builds the chrome and firefox zip files in the `built/` directory
npm run build-firefox  # builds the firefox zip file in the `built/` directory
npm run build-chrome  # builds the chrome zip file in the `built/` directory

browser_extensions's People

Contributors

alabhyajindal avatar brunobernardino avatar dinodev90 avatar hmnd avatar hughobrien avatar hypnocapybara avatar icedrooibos avatar kaitheredninja avatar kepstin avatar peterdavehello avatar pixelinc avatar vprelovac avatar workwithnano avatar z64 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

browser_extensions's Issues

Kagi extension loses auth in private browser window

Every time I restart my browser, my Kagi extension loses its authentication for private windows. In case it matters, I am using the Brave browser.

To outline the issue in steps:

  1. Start browser with the Kagi extension installed
  2. Open a New Private Window
  3. Type a query in the URL bar and hit Enter
  4. Instead of seeing search results as expected, get redirected to https://kagi.com/signin

A workaround is to go into the extension settings and disable and then re-enable the Kagi extension, but it's a pain to do this every time.

When searching an extra empty search tab opens.

Every once in a while on Firefox nightly (at least a couple of times a day) when I type my search criteria in the Firefox URL bar and hit enter, an extra tab opens up with an empty search url: "https://kagi.com/search?q=&l=6" and becomes focused. The search successfully executes in the tab that was active when I hit enter, so I have to close the newly created empty search tab to get back to my actual results, which is a bit annoying. I have tried unsuccessfully to identify any pattern to predict when this will happen.

Version 2.0 Safari/macOS Mojave

Upon updating my Kagi extension on a 2008 iMac on Mojave 10.14.6, the Safari extension now presents a blank screen and under the extensions settings in Safari, there's an error: "An unsupported manifest_version was specified"

Screen Shot 2023-12-28 at 7 41 03 AM
Screen Shot 2023-12-28 at 7 41 06 AM

Uninstalling and reinstalling does not help.

Unclear license

Hi,

on the Firefox add-on page it says the extension is licensed under MPL-2.0 but there is no license file in this repo.

Confusingly, the package.json claims the project is licensed under the MIT license:

"license": "MIT",

Please add a license file to clarify and clean up the metadata.

Search in private browsing without needing login

This is about discovery, really.

In firefox, installing this extension sets up search in normal and private browsing, but private browsing doesn't work: you get a login page.

I had set this up on my mobile using the special token link and it worked ok, so was confused why it failed on desktop.

Turns out that logging in once in private mode seems to get it all set up but this is confusing and hard to discover.

Some instruction, e.g. when installing, and/or by some status check ext. config page would be helpful.

Chrome extension doesn't work in Brave when installed via Sync

When installing the extension in Brave via a browser Sync, the default search engine isn't updated, and Kagi isn't even included in the list of available search engines.

I've tried disabling and re-enabling the extension but it never takes control of the default search engine.

Firefox: Summarize the current page using an extension shortcut doesn't work

Hey,

I've set an extension shortcut for "Summarize the currently active page". When using this shortcut, the browser window for the summary shows up, but it doesn't load the summary. In contrary, it works if I open the extension popup and click on the button "Summary".

Error:

Uncaught (in promise) ReferenceError: url is not defined
    requestPageSummary moz-extension://<uuid>/src/summarize_result.js:100
    setup moz-extension://<uuid>/src/summarize_result.js:128
    EventListener.handleEvent* moz-extension://<uuid>/src/summarize_result.js:131
summarize_result.js:100:7

Skimming the code (function requestPageSummary()), I noticed that in case I use the shortcut, window.location.search is empty (without using the shortcut it is something like ?url=https%3A%2F%2Fblog.kagi.com%2Funlimited-searches-for-10&summary_type=summary&target_language=&token=<token>&api_token=&api_engine=cecil). So it tries to get the required parameters from the active tab (getActiveTab()), but url is never defined/set.

// [...]
const searchParams = new URLSearchParams(window.location.search); // `searchParams.size` is 0

    // If there's no URL, get the currently active tab and default params
    if (!searchParams.get('url')) {
      searchParams.set('summary_type', 'summary');
      searchParams.set('target_language', '');

      const tab = await getActiveTab();

      if (!tab) {
        console.error('No tab/url found.');
        return;
      }

      searchParams.set('url', url); // `url` is undefined
      // [...]

Environment:

  • Firefox Developer Edition, 118.0b9
  • Kagi Search for Firefox, 0.3.7

Safari Extension Should Not Ask for All Websites

Hello! I installed the Safari extension today on my iPhone and the requested permissions are very scary: It wants access to read and modify all websites. Not only is this a big privacy and security risk, it's totally unnecessary:

When I visit my default search provider, DuckDuckGo, and click on the Kagi button, it asks for permission to read and modify just DuckDuckGo, and this works perfectly for the search bar, and is a setting I am much more comfortable with.

The instructions in the app should encourage people to grant the least necessary privilege, not the widest. The extension should instruct people to run a search and then press the Kagi extension from the results page.

Firefox summarize function does not ask user permission to access activeTab

OS: Windows 11 Pro N build 23H2 22631.4037
Browser: Firefox 129.0.2

Expected behaviour: -
When right clicking in a web page and selecting the Kagi Summarize option (that is added by this extension), a pop up window opens and the page is summarized via a call to Kagi's summarize service.

Observed behaviour: -
The window pops up and displays a spinner and the error "You can't summarize without allowing access to the currently active tab." No prompt to grant access is created by the browser. The only permission listed under the extension management permissions tab is "Access your data for https://kagi.com" with no option to enable access to the active tab. As such, the summarize function has to be invoked by the !sum bang instead.

Potential fix: -
Assuming my ancient install of Firefox doesn't have some weird permissions/privacy flag switched, that I've forgotten about... The required permission "activeTab" is listed in the Firefox manifest.json under "optional_permissions".
I'm a hobbyist coder, but ChatGPT4o suggests moving the permission to the "permissions" part of the manifest so the user can grant (or deny) it on installation.
Or in "summarize_result.js" the function requestPageSummary() (which generates the above error message) could be updated to try browser.permissions.request({ permissions: ["activeTab"] }) if hasTabAccess is False.
Additionally, I asked Claude Opus to make suggestions as well (putting my Ultimate sub to good use!). It says: "Make sure to include the tabs permission in the permissions array. The activeTab permission requires the tabs permission as a prerequisite." If that is correct, the "tabs" permission is missing from manifest.json.

Firefox extension is not able to read login token unless the user manually adjusts permissions

Following the switch from manifest v2 to manifest v3 in the Firefox extension, access to kagi.com is done through the host_permission field. However, Firefox treats host_permission as an optional permission, and it is not automatically granted on a fresh install.

This creates a problem with onboarding. A user will install the extension, get the "No kagi session found." message, click the "Let's go!" link, and kagi.com will open - but the extension will be unable to retrieve the login token. The extension will continue to show the "No kagi session found." message.

A savvy user can manually enable the permission; this can either be done by first navigating to kagi.com then opening the extensions menu, clicking the gear icon beside Kagi, and selecting "Always allow on kagi.com", or it can be done by opening the extension management screen, switching to the permissions tab, and enabling "Access your data for https://kagi.com".

To properly solve this as part of the onboarding flow, code needs to be added to the no session found screen which checks if the host permission is available and requests the host permission if needed when the user clicks on the "Lets go!" link.

Automatic session for firefox container tabs

I use firefox account containers a lot.
When I try to search from such a tab I have to login again to kagi.com
With this extension it would be great if it could do something similar to private mode and use my saved kagi login in these container tabs too.

Chrome extension update permissions

Similar to #13, the Chrome extension is now prompting for access to full browsing history and is automatically disabled by the browser if that isn't granted - this looks as though it comes from the recently added tabs permission in the manifest. Assuming that's only used for the summariser, I think it should be possible to replace it with activeTab, which will prompt for access when used rather than requiring it globally.

I also noticed that declarativeNetRequest is listed as "Block content on any page" in the user facing permissions. Since it only seems to be used for injecting the auth token on kagi.com it could probably be switched to declarativeNetRequestWithHostAccess as it is on Firefox.

Feature request: iOS share target for Universal Summarizer

As part of the iOS Safari extension can you please add the ability to share a URL directly to the Universal Summarizer?

User clicks the share icon from Safari.

1

User chooses the Universal Summarizer Kagi share target logo.

2

Universal summarizer is loaded in a new tab in the foreground with the URL having been submitted.

3

Extension does not keep me logged in with Firefox Private Browsing

In Firefox on Windows, Pop!_OS, and Android, the extension does not keep me signed in in private windows.

The extension shows that it is authorized with my login token, and Firefox states that it "Can always read and change data on this site" for kagi.com, but the site prompts me to log in before I can search.

I am able to successfully use the Summarize function, and I have tried manually re-entering the login token, but the problem persists.

[Request] Compatibility with Firefox for Android

It would be nice if the Kagi Search for Firefox extension was available to Firefox users on Android, if such a thing is possible. Currently you can manually add Kagi as a search engine (Settings > Search > Add search engine) but this relies on your session persisting, and does not work in private tabs (requiring you to log in again). Certainly not the worst thing in the world, but it would be nice to have.

The extension is now available on Firefox for Android, however the following features do not yet work:

  • Kagi does not add itself as an option for the Default Search Engine setting, requiring you to add it manually.
  • The Universal Summarizer does not work. The Summarize button appears to do nothing.

Context menu image search processes URLs as texts

For example, if you right click on my profile picture and reverse search for it, it shows a bunch of pictures that don't look like it at all:

image

I guess this is because the URL is treated as text.

In Kagi if I copy the URL manually into the reverse search input,
image
now it starts showing similar pictures:
image

Logged out in Firefox private windows

The Firefox add-on page says that it supports "automatically logging in to Kagi in private browsing windows", but this doesn't work for me. When I attempt to search from a private window, I get the login page.

I have "Run in Private Windows" enabled, as well as the "Access your data for https://kagi.com" permission.

I'm using version 0.6.0 of the add-on with Firefox 123.0.

1Password extension does not work

I tried both 1Password's Chrome and Firefox extension. neither works

I hostly only need Chrome extensions to work properly. No need to have firefox too. Chrome + Safari extensions would be more than enough

Perpetual blue dot below extension icon in Firefox

Hello!
I am enjoying using Kagi. Thanks for the great work!

I am on Firefox 118.0 and noticing a blue dot below the extension icon:

Screenshot_20231009_125656

Screenshot_20231009_125910

Steps to reproduce

  1. Install the extension
  2. Sign in using the "Let's go" link from the extension
  3. Go to a page other than kagi.com/*
  4. Click on the Kagi's extension icon. You might have to click on Request permission button once.
  5. Now whenever you refresh the page, you will see a blue dot below the extension's icon

Can anyone verify if this issue is reproducible? I tried solving this but I'm not able to understand what is causing it.

Firefox Extension update is prompting for new, very broad, permissions

It seems like something has changed in the extension manifest in a recent update which is resulting in Firefox re-prompting for permissions before installing the update. The two new permissions being asked for are:

  • Block content on any page
  • Access browser tabs

Given the purpose that I installed the extension for - to allow using Kagi search in private windows or multi-account containers - these permissions seem overly broad, and I do not wish to grant them. The extension has worked fine until now with only permission to "Access your data for kagi.com" granted.

If these permissions are for some new optional extension feature, the permissions should be requested at runtime since they are not required for basic extension functionality.

See the Firefox docs Requesting the right permissions and Test permission requests for details about how the warning Firefox shows during upgrades, how it categorizes permissions, and how to test.

Summary API key keeps unsetting itself so changing the model is impossible

Pretty much the title. It would be nice to either not reset the API key or allow users to change the model without needing to enter the API key. This could also be specific to my configuration somehow as I'm not able to use Kagi in private mode with my token without giving it permission to kagi.com

Feature request: Use different search engine in private browsing

A useful feature for me would be the ability to choose a different search engine in private-browsing mode instead of logging into Kagi. For example, I could set my search provider to Kagi, and in Kagi's settings I could choose to use DuckDuckGo in private-browsing mode.

My instinct is that this should be possible with the WebExtensions browser.search API in Firefox. Unfortunately it looks like Chromium's chrome.search API doesn't have the necessary features.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.