dub-registry icon indicating copy to clipboard operation
dub-registry copied to clipboard

Gitea support?

Open LunaTheFoxgirl opened this issue 6 years ago • 8 comments

I see there's a PR for Gogs support, have you considered Gitea support? Gogs is very slow at updating and some people has forked gogs and made gitea, which is a community effort. @s-ludwig. Its API is way more fully fletched and should be easier to integrate.

LunaTheFoxgirl avatar Jun 09 '18 22:06 LunaTheFoxgirl

I would like to see this too!

bausshf avatar Jun 10 '18 00:06 bausshf

I took a look at it.

Here's Gitea's API. Every endpoint requires authentication, which requires a user. But the API doesn't let you register a user.

The process of registering your project hosted on gitea would be:

  1. Set DISABLE_REGISTRATION in your gitea config to false. Double-check that API access is turned on. Restart gitea.
  2. Create a new user.
  3. Enable API access for that user and disable everything else.
  4. Create an API token for them.
  5. Input your project URL in the dub registry.
  6. Tell dub that it's hosted on gitea.
  7. Give it the auth token you just made.
  8. Tell it where your README is located.

There are two alternatives:

  1. Dub parses gitea's HTML frontend. This will be a bit slow, and more importantly it will break without notice. Worse, this is a self-hosted system, so dub would have to support many versions of gitea HTML.
  2. Dub uses git instead, costing the registry a lot more disk space, bandwidth, and time, but supporting every git repository (such as git.gnome.org).

dhasenan avatar Sep 07 '18 05:09 dhasenan

You dont need to set DISABLE_REGISTRATION to false, if you have admin access on the server, then you can just create a new user via the admin UI.

LunaTheFoxgirl avatar Sep 07 '18 09:09 LunaTheFoxgirl

Aswell my testing shows that I don't need authentication for the GET requests. Maybe the repos you are trying to read are private?

Public repositories work fine without authentication.

(https://git.pplex.org/api/v1/repos/Polyplex/libpp as you can see)

LunaTheFoxgirl avatar Sep 07 '18 09:09 LunaTheFoxgirl

Apparently older versions of gitea required authentication for everything. https://git.ikeran.org/api/v1/repos/dhasenan/webkit-d for instance said 401 Unauthorized. Upgrading from 1.1.3 to the most recent version fixes this.

There's still no list files API endpoint, which is a bit of a problem.

dhasenan avatar Sep 07 '18 16:09 dhasenan

Well you don't need to list files afaik, just download a recent archive.

LunaTheFoxgirl avatar Sep 07 '18 18:09 LunaTheFoxgirl

Right. It's a bit of a problem, not a show-stopper. It means that dub needs to use more bandwidth (for itself and for the remote gitea server), time, and disk space to get the data it needs.

dhasenan avatar Sep 07 '18 21:09 dhasenan

If there is no effort to support this, I would like to try it, in a near future :smiley:

ljmf00 avatar Jul 01 '21 20:07 ljmf00

Opened a PR: #553

s-ludwig avatar Sep 24 '23 17:09 s-ludwig