`lib.mdDoc` has been removed. Flake lock file updates: • Updated input 'naersk': 'github:nix-community/naersk/aeb58d5e8faead8980a807c840232697982d47b9' (2023-10-27) → 'github:nix-community/naersk/3fb418eaf352498f6b6c30592e3beb63df42ef11' (2024-07-23) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/63143ac2c9186be6d9da6035fa22620018c85932' (2024-01-02) → 'github:NixOS/nixpkgs/2c15aa59df0017ca140d9ba302412298ab4bf22a' (2024-12-02) • Updated input 'utils': 'github:numtide/flake-utils/4022d587cbbfd70fe950c1e2083a02621806a725' (2023-12-04) → 'github:numtide/flake-utils/11707dc2f618dd54ca8739b309ec4fc024de578b' (2024-11-13) |
||
---|---|---|
.github/workflows | ||
src | ||
.envrc | ||
.gitignore | ||
Cargo.lock | ||
Cargo.toml | ||
LICENSE.md | ||
README.md | ||
default.nix | ||
flake.lock | ||
flake.nix |
README.md
URL Eater
Clean unnecessary parameters from URLs copied to clipboard
Usage
Run with a filter file that specifies which parameters should be removed:
url-eater denylist.kdl
An example filter file:
category "Spotify" {
params "context@open.spotify.com" "si@open.spotify.com"
}
category "Campaign tracking (itm)" {
params "itm_*"
}
category "Campaign tracking (stm)" disabled=true {
params "stm_*"
}
Categories are used to structure filter lists and allow disabling/enabling filters in groups.
Each parameter applies to all URLs, unless a domain like @example.com
is specified at the end.
Both the parameter and the domain parts can contain wildcards. Use *
to match 0 or more characters, and ?
to match exactly one character.
The structure is based on NeatURL's format, with a few differences (aside from a different file format):
- Single character matching (
?
) is supported. $
and!
rules are currently unsupported.
The intended use case is running the program as a background service.
Example
Before:
https://open.spotify.com/track/0ibuggkWTSDXHo25S0Qqvj?si=e4c675cbaee94c3a
After:
https://open.spotify.com/track/0ibuggkWTSDXHo25S0Qqvj
Usage example
This repository also contains a Nix flake. It can be used in a NixOS configuration like this:
- Add flake to inputs:
url-eater.url = "github:AgathaSorceress/url-eater";
url-eater.inputs.nixpkgs.follows = "nixpkgs"; # optional
- Adding output:
outputs = inputs@{ self, nixpkgs, url-eater, ... }:
- Import NixOS module
imports = [ url-eater.nixosModules.default ];
- Configure the module:
{ ... }: {
services.url-eater = {
enable = true;
filters = ''
category "Spotify" {
params "context@open.spotify.com" "si@open.spotify.com"
}
category "Twitter" {
params "cxt@*.twitter.com" "ref_*@*.twitter.com" "s@*.twitter.com" "t@*.twitter.com" "twclid"
}
'';
};
}
Building from source
Clone this repository, then run:
cargo build --release
The output binary will be in target/release/url-eater
Alternatively,
nix build github:AgathaSorceress/url-eater