Idea: Create a service that redirects directly from crate name to its repository url

This will reduce one page jump from crates.io/lib.rs/docs.rs when cloning a crate's source code or submitting an issue to a crate, etc.

I'm not 100% certain if enough users need this so it's worth adding to one of the services above.

But I'm using a simple shell-alias/script for this, which works for both usecases similarly:

curl -s https://crates.io/api/v1/crates/$1 | jq -r '.crate.repository' 

which then can be used like

# clone the crate repo: 
git clone $(crate-repository.sh askama)
1 Like

lib.rs supports git cloning of crates:

git clone https://lib.rs/serde
Cloning into 'serde'...
warning: redirecting to https://github.com/serde-rs/serde.git/

For a repository HTML link, I'm slightly worried about creating an open redirect. Spammers find opportunities like that to hide their spammy links behind someone else's reputable domain, and I'd need to put some anti-spam safeguards to prevent spammers from publishing garbage crate with an ad URL in the repository field.

10 Likes

Maybe you could have a redirect page clearly indicating that you are leaving lib.rs and showing the redirect destination? I know some websites do this for every link that leaves the current website.

I could show a warning and require a click through, but then it wouldn't be more direct than going to the regular crate's page.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.