Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(gitlab): Introduce a self-hosted gitlab endpoint #9

Merged
merged 1 commit into from
Oct 30, 2023
Merged

feat(gitlab): Introduce a self-hosted gitlab endpoint #9

merged 1 commit into from
Oct 30, 2023

Conversation

algernon
Copy link
Collaborator

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 with gitlab.gnome.org and salsa.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 of user/repo, but if user or repo 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.

This introduces the `/v1/gitlab/:host/:user/:repo` routes, where `:host`
is any GitLab instance (including, possibly, gitlab.com).

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
Copy link
Owner

@cafkafk cafkafk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, nothing to complain about here, very nice! I opened an issue for url-encoding #12 just so we don't forget about it.

Thanks for the contribution, now we basically support all major forges eh? 🎉

@cafkafk cafkafk merged commit 3dd2c37 into cafkafk:main Oct 30, 2023
3 checks passed
@algernon algernon deleted the gitlab branch October 30, 2023 08:53
@algernon
Copy link
Collaborator Author

Thanks for the contribution, now we basically support all major forges eh? 🎉

There's SourceHut left still. Unsure if it is something that can be supported, but I haven't looked closer yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants