Anyone looking for a fun small rust project? Create a crate for cleaning urls, based on the ClearUrls project

This would entail:

  • Pulling in the ClearUrls rules as a git submodule.
  • Reading / transforming the json there into Rust structs.
  • Creating a Rust crate that runs a .clean(input_url) -> String

Lemmy issue: https://github.com/LemmyNet/lemmy/issues/4905

25 points · 6 comments · view on lemmy.world

6 Comments

BB_C@programming.dev · 4 pts · 2y (1 reply)

Looks trivial and easy to automate.
I possibly would have done it if they had a test suite.
But unless I didn't look hard enough, they have no tests at all (other than linting)!

dessalines@lemmy.ml · 2 pts · 2y

Yep, it'd be a pretty small library. I'm not sure if they generate those JSON rules from somewhere else, but either way they could be converted to defined rust objects as part of a build process.

This might be helpful: https://github.com/oxidecomputer/typify

dtc@masto.pt · 4 pts · 2y (1 reply)

@dessalines Did something similar last night. Might take a look into using ClearURLs instead: https://github.com/diogotcorreia/alt-urls-discord-bot

dessalines@lemmy.ml · 2 pts · 2y

Nice! Ya that could be made very multi-purpose.

jendrik@discuss.tchncs.de · 3 pts · 2y (1 reply)

I just released a crate doing exactly that: https://crates.io/crates/clearurls

Let me know if if fits your need or you need anything else. Issues and PRs welcome.

dessalines@lemmy.ml · 2 pts · 2y

Whoa nice! I'll check it out and see how we can integrate it into lemmy.