1
0
Fork 0
mirror of https://github.com/edward-shen/shlink.git synced 2025-09-09 19:18:35 -07:00
Unofficial Shlink extension for Firefox and Chrome
Find a file
Edward Shen 9ae8b85635
Some checks failed
Build and lint / web-ext Build and Lint (push) Failing after 11s
Build and lint / web-ext Build and Lint-1 (push) Failing after 4s
Build and lint / Bun tests (push) Failing after 3s
Update readme
2025-09-06 15:59:32 -07:00
.github Use prettier to lint the world 2025-01-14 23:08:34 -08:00
.vscode Use prettier to lint the world 2025-01-14 23:08:34 -08:00
assets Update to 0.6.1 2025-04-19 21:01:47 -07:00
src Lint 2025-04-19 21:01:34 -07:00
.gitignore Add coverage to .gitignore 2025-01-14 00:12:13 -08:00
.prettierignore Use prettier to lint the world 2025-01-14 23:08:34 -08:00
.prettierrc Use prettier to lint the world 2025-01-14 23:08:34 -08:00
bun.lockb Add badge display after copying link to clipboard 2025-04-20 03:40:17 +02:00
bundle.mts Re-org source directory 2025-01-14 23:44:07 -08:00
bunfig.toml Begin adding tests 2025-01-13 23:17:15 -08:00
happydom.ts Begin adding tests 2025-01-13 23:17:15 -08:00
LICENSE Initial commit 2020-09-19 19:45:55 -04:00
package.json Use prettier to lint the world 2025-01-14 23:08:34 -08:00
README.md Update readme 2025-09-06 15:59:32 -07:00
tsconfig.json Begin adding tests 2025-01-13 23:17:15 -08:00
web-ext-config.cjs Use prettier to lint the world 2025-01-14 23:08:34 -08:00

Shlink Extension (Unofficial)

This extension provides a shortcut button to generate a short url using Shlink.

Usage

Click the extension and a short link will be requested from your instance for the page you're currently on. This short link will be copied to your clipboard, so you can easily paste it.

Requirements

An existing Shlink installation that's ready to use. If you don't have one, take a look at their Getting Started page to learn how to run your own instance.

Installation

Once installed, you'll need to set it up with your API key and host URL information:

  1. Right click the Shlink button in the top right and select the option to manage the extension.
    • In Chrome, you would select "Options".
    • In Firefox, you would select "Manage Extension".
  2. (Firefox only) Then, select the Preferences tab.
  3. Here, you'll need to enter your API key and point to where your Shlink instance is located.

Once all these steps are complete, the extension should be ready to use. If you encounter any errors, check to see if your API key is correct and you're pointed to the right domain.

Privacy

This extension does not log any information by itself, and only communicates with the Shlink instance you provide in its preferences. All other information is kept local.

This extension keeps your API key in plaintext in your local browser storage.

Permissions used

Permission Reason
activeTab Needed so that the extension read the current active tab.
notifications Needed so that the extension can inform users if generating the short link was successful or not.
clipboardWrite Needed so that the extension can copy the short link to your clipboard.
offscreen Chrome only. Needed to workaround clipboard writing to an offscreen doc.
storage Needed so that the extension can save the location of a Shlinker instance and your API key.

Developing

Pre-requsities

  • bun
  • web-ext

Then, run bun install.

Running

You can build it by running bun run build.

bun run watch

This starts two scripts that watches for changes and updates the extension on an test browser instance.

Currently, the watch script accepts additional args to be provided to the web-ext script. By default, it opens up a firefox instance, but you can change it by providing a --target option:

bun run watch -- --target chromium

Testing

todo

Notes

Currently, bundle.mts watches for changes in the assets/ and src folder. On change, this triggers bun to output data into the dist folder. The dist folder is watched/used by web-ext for testing/building.

The assets/ folder are items that should be directly copied over without changes to the dist folder. This is for things that bun either name-mangles or "helps" out by processing it into a .js file. Notably, the manifest file and various "simplier" files are here.

The src/ folder contains assets that need to be compiled. This is for any other files.