A self-hosted Cloudflare worker for KeeWeb which allows you to run your own favicon grabber service. This worker is responsible for users who obtain a favicon within the KeeWeb application.
This project is a Cloudflare service worker utilized for KeeWeb's Favicon Grabber and is integrated as an API end-point within the KeeWeb Password Manager.
This worker includes the following features:
- Favicon override using a Github repository
(self-hostable)
- Favicon override using locally provided image URL table
- Favicon override using locally provided SVG path
- Works with Google, Yandex, Duckduckgo, FaviconKit, Allesedv
- Site code scanning for favicon tags, both
link
andsvg
- CORS Security Headers
- Ability to set API rate limits
(disabled by default)
- Daily limits OR limit X per milliseconds
- Aggressive throttling mode
(disabled by default)
- Adds an incremental punishment onto the client's cooldown each time they attempt to grab a favicon when their original cooldown period has not yet expired.
- IP blacklisting / banning
- Supports sub-routes for users who want to add on
get
,post
routes - Supports Cloudflare worker logs
(beta)
Favicons can be grabbed with the following syntax:
https://services.keeweb.info/favicon/{DOMAIN}/{ICON_SIZE}
https://services.keeweb.info/favicon/keeweb.info/64
Parameter | Description | Default | Status |
---|---|---|---|
DOMAIN |
Website to grab favicon for Does not require the use of adding http , https or www to your url. |
✔️ Required | |
ICON_SIZE |
Specifies the size of the icon to return. Certain methods may not support down-sizing icons. | 32 |
⭕ Optional |
If you wish to host your own instance of this service, you must deploy it as a Cloudflare worker, which requires you to sign up for a Cloudflare account.
Once you are signed up for Cloudflare, you may click the button below:
These are notes you should keep in mind if you plan on modifying this favicon Cloudflare worker.
We recommend treating your wrangler.toml
file as the source of truth for your Worker configuration, and to avoid making changes to your Worker via the Cloudflare dashboard if you are using Wrangler.
If you need to make changes to your Worker from the Cloudflare dashboard, the dashboard will generate a TOML snippet for you to copy into your wrangler.toml
file, which will help ensure your wrangler.toml
file is always up to date.
If you change your environment variables in the Cloudflare dashboard, Wrangler will override them the next time you deploy. If you want to disable this behavior, add keep_vars = true
to your wrangler.toml
.
If you change your routes in the dashboard, Wrangler will override them in the next deploy with the routes you have set in your wrangler.toml
. To manage routes via the Cloudflare dashboard only, remove any route and routes keys from your wrangler.toml
file. Then add workers_dev = false
to your wrangler.toml
file. For more information, refer to Deprecations.
Wrangler will not delete your secrets (encrypted environment variables) unless you run wrangler secret delete <key>
.
Note
Experimental Config
Wrangler currently supports an --experimental-json-config
flag, which will read your configuration from a wrangler.json
file, rather than wrangler.toml
. The format of this file is exactly the same as the wrangler.toml
configuration file, except that the syntax is JSON
rather than TOML
.
This is experimental, and is not recommended for production use.
Since Cloudflare recommends installing Wrangler locally in your project(rather than globally), the way to run Wrangler will depend on your specific setup and package manager.
After you have access to wrangler globally, you can switch over from using npx wrangler
to just wrangler
:
This section provides a reference for Wrangler commands. Full list of commands available here.
The syntax for utilizing wrangler is as follows:
npx wrangler <COMMAND> <SUBCOMMAND> [PARAMETERS] [OPTIONS]
Update version of Wrangler used in your project:
npm install wrangler@latest
To use Wrangler, deploy a dev server, or deploy a production build, you must be signed into your Cloudflare account via wrangler. This will be accomplished by making use of OAuth. Wrangler will attempt to automatically open your web browser to login with your Cloudflare account.
If you prefer to use API tokens for authentication, such as in headless or continuous integration environments, refer to Running Wrangler in CI/CD.
If Wrangler fails to open a browser, you can copy and paste the URL generated by wrangler login
in your terminal into a browser and log in.
npx wrangler login [OPTIONS]
Logout from Cloudflare
npx wrangler logout [OPTIONS]
Lists all accounts associated with your Cloudflare account
npx wrangler whoami
Launches local wrangler / cloudflare dev project in a test environment.
npx wrangler dev -e dev
Deploy your Worker to Cloudflare.
npx wrangler deploy [<SCRIPT>] [OPTIONS]
npx wrangler deploy --minify -e production
The following command will build a dry-run compiled version of your index.js file which will be placed in the dist/
folder
npx wrangler deploy --dry-run --outdir dist -e production
Note
None of the options for this command are required. Also, many can be set in your wrangler.toml
file. Refer to the wrangler.toml
configuration documentation for more information.
Rollback a deployment for a Worker to a previous version.
npx wrangler rollback [version-id]
Check where wrangler (and other global packages) are installed at:
npm list -g --depth=0
Displays the 10 most recent deployments of your Worker
npx wrangler deployments list
List the 10 most recent Versions of your Worker [beta]
npx wrangler versions list
Delete your Worker and all associated Cloudflare developer platform resources.
npx wrangler delete [<SCRIPT>] [OPTIONS]
We are always looking for contributors. If you feel that you can provide something useful to KeeWeb, then we'd love to review your suggestion.
The following people have helped get this project going: