feat(gitlab): Introduce a self-hosted gitlab endpoint #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This introduces the
/v1/gitlab/:host/:user/:repo
routes, where:host
is any GitLab instance (including, possibly, gitlab.com).I have not made
gitlab.com
the default, because that seems to require a login to do anything at all, at least on the web UI side of things, and I couldn't be bothered to look further. I did some testing withgitlab.gnome.org
andsalsa.debian.org
, and things seem to work well.I even found a flake-enabled project on salsa:
nix run 'http://127.0.0.1:3000/v1/gitlab/salsa.debian.org/reproducible-builds/reproducible-website/b/master.tar.gz'
does... uhh... something? Not sure what it is supposed to do, but the flake gets evaluated. Sadly, there is no release with a flake yet, so can't directly test that.But I did test that looking up the latest tag works! However, there's a small TODO item there, part of the URL needs to be URL-encoded, and the code in this PR doesn't do that properly. It url-encodes the
/
part ofuser/repo
, but ifuser
orrepo
would require encoding too, things might break. That is, imo, such an unlikely scenario that I didn't bother with proper encoding.If proper encoding is required, rime will need to depend on something like
form_urlencode
directly.