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

Support for self-hosted Gitea #164

Merged
merged 1 commit into from
Aug 21, 2022
Merged

Support for self-hosted Gitea #164

merged 1 commit into from
Aug 21, 2022

Conversation

nitn3lav
Copy link
Contributor

deps.rs is now available for self-hosted Gitea at
/repo/gitea/<DOMAIN>/owner/repo, e. g.
/repo/gitea/git.example.org/deps-rs/deps.rs,
/repo/gitea/git.example.org:1234/deps-rs/deps.rs,
/repo/gitea/http://unsafe-gitea.org/deps-rs/deps.rs.

This should also include support for Gitea hosted in subdirectories,
e. g. www.example.org/gitea, though I haven't tested this yet.

If no protocol (https:///http://) is specified, https:// is
automatically added to the beginning of the gitea server's URL.
However I could also change this to only accept https. Another
option might be the use of URL-encoding.
I am open for feedback, feel free to suggest changes.

Implementation notes:

  • The Router now matches /repo/*site/:qual/:name instead of
    /repo/:site/:qual/:name to allow for an arbitrary number of
    /s before qual and name.

  • RepoSite now has a new variant Gitea(GiteaDomain).

  • RepoSite no longer implements Copy. However this should not
    be problematic because Copying was only used for to_base_uri,
    to_usercontent_base_uri and to_usercontent_repo_suffix which
    now accept &self references.

  • RepoSite: to_base_uri and to_usercontent_base_uri now return
    &str instead of &'static str.

  • RepoSite no longer implements AsRef and now uses Display
    instead.

  • updated test correct_raw_url_generation

  • updated readme

Related to #84, #141

deps.rs is now available for self-hosted Gitea at
`/repo/gitea/<DOMAIN>/owner/repo`, e. g.
`/repo/gitea/git.example.org/deps-rs/deps.rs`,
`/repo/gitea/git.example.org:1234/deps-rs/deps.rs`,
`/repo/gitea/http://unsafe-gitea.org/deps-rs/deps.rs`.

This _should_ also include support for Gitea hosted in subdirectories,
e. g. `www.example.org/gitea`, though I haven't tested this yet.

If no protocol (`https://`/`http://`) is specified, `https://` is
automatically added to the beginning of the gitea server's URL.
However I could also change this to only accept https. Another
option might be the use of URL-encoding.
I am open for feedback, feel free to suggest changes.

Implementation notes:

- The Router now matches `/repo/*site/:qual/:name` instead of
  `/repo/:site/:qual/:name` to allow for an arbitrary number of
  `/`s before qual and name.
- `RepoSite` now has a new variant `Gitea(GiteaDomain)`.
- `RepoSite` no longer implements `Copy`. However this should not
  be problematic because `Copy`ing was only used for `to_base_uri`,
  `to_usercontent_base_uri` and `to_usercontent_repo_suffix` which
  now accept `&self` references.
- `RepoSite` no longer implements `AsRef` and now uses `Display`
  instead.

- updated test `correct_raw_url_generation`
- updated readme

Related to deps-rs#84, deps-rs#141
@Feliix42
Copy link
Member

Feliix42 commented Aug 17, 2022

Wow, that is a great contribution! Thank you very much for your efforts and work! Unless another maintainer is faster, I will review your PR over the weekend. 🙂

Copy link
Member

@Feliix42 Feliix42 left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks for your contribution! :)

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