KTS915 / Test-ClassicPress-Directory

GNU General Public License v3.0
0 stars 0 forks source link

Repository URL #12

Closed viktorix closed 2 years ago

viktorix commented 2 years ago

A couple of things:

  1. Right now, registration and the profile allow for one repository URL. What will happen if they need to submit more plugins with a repository for each plugin?
  2. Also, there's no validation to ensure the repository URL is submitted. I can submit any URL that starts with github.com. We can perform a simple status code check at the minimum. If repo exists, it will return 200. If it doesn't, 404. Another option is the API: https://api.github.com/search/repositories?q=KTS915/Test-ClassicPress-Directory
  3. Since we know it's GitHub URL (and later GitLab, offer dropdown), why don't we ask for org/repo URI part? So they would only submit KTS915/Test-ClassicPress-Directory? EDIT: This could also be used for the form's software download link field.
KTS915 commented 2 years ago

1: We don't ask for a repository for each piece of software. We just ask for a download URL. So I don't see the problem: one developer's repo can house many individual code repos. 2 & 3: Good points.

KTS915 commented 2 years ago

For 2 & 3, we could just ask for the developer's username, e.g. KTS915, so that we can then check, e.g., https://api.github.com/search/repositories?q=KTS915/

Is GitHub Username the right label for this?

viktorix commented 2 years ago

For 1, the repo we ask for during registration is simply for verification then? 2/3. I thought about it and search API might not be right because it does search database. So there is a possibility of an error for generic names. We could use rest API but it does require authentication, so we would need to add that. However, the API is very good:

KTS915 commented 2 years ago

For 1, the repo we ask for during registration is simply for verification then?

Yes.

smileBeda commented 2 years ago

Don't forget that there are as well Orgs, not just users, in GitHub. For orgs, the url is something like https://api.github.com/orgs/{org}

This is for example the case for all "my" plugins I made for CP.

KTS915 commented 2 years ago

We can't use the second of the APIs @viktorix mentioned, as that requires authentication.

But the first one works well. It doesn't seem to matter if we're talking about an org's repo instead. I tried https://api.github.com/users/TukuToi and still retrieved a meaningful value for repos_url, so requiring a GitHub Username or Org name looks like the way to go.

KTS915 commented 2 years ago

Addressed by above commit. Will now add new issue to check that software submitted by this user has a repo under the same GitHub Username of Org name.