Make paths consistent
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Valentin Brandl 2020-11-24 19:13:08 +01:00
parent 1bdee4ee36
commit 14cd21dc1c
5 changed files with 17 additions and 17 deletions

View File

@ -1,6 +1,6 @@
# Hits-of-Code # Hits-of-Code
[![Hits-of-Code](https://hitsofcode.com/github/vbrandl/hoc)](https://hitsofcode.com/view/github/vbrandl/hoc) [![Hits-of-Code](https://hitsofcode.com/github/vbrandl/hoc)](https://hitsofcode.com/github/vbrandl/hoc/view)
[![Drone build](https://drone.vbrandl.net/api/badges/vbrandl/hoc/status.svg)](https://drone.vbrandl.net/vbrandl/hoc) [![Drone build](https://drone.vbrandl.net/api/badges/vbrandl/hoc/status.svg)](https://drone.vbrandl.net/vbrandl/hoc)
[![Gitlab build](https://gitlab.com/vbrandl/hoc/badges/master/pipeline.svg)](https://gitlab.com/vbrandl/hoc/pipelines) [![Gitlab build](https://gitlab.com/vbrandl/hoc/badges/master/pipeline.svg)](https://gitlab.com/vbrandl/hoc/pipelines)
[![dependency status](https://deps.rs/repo/github/vbrandl/hoc/status.svg)](https://deps.rs/repo/github/vbrandl/hoc) [![dependency status](https://deps.rs/repo/github/vbrandl/hoc/status.svg)](https://deps.rs/repo/github/vbrandl/hoc)
@ -26,7 +26,7 @@ where `<service>` is one of `gitub`, `gitlab` or `bitbucket`. The HoC data can a
https://<host>/<service>/<user>/<repo>/json https://<host>/<service>/<user>/<repo>/json
``` ```
There is also an overview page available via `https://<host>/view/<service>/<user>/<repo>` There is also an overview page available via `https://<host>/<service>/<user>/<repo>/view`
To delete a repository and the cache from the server, send a `POST` request to To delete a repository and the cache from the server, send a `POST` request to
`https://<host>/<service>/<user>/<repo>/delete`. On the overview page, there is a button to perform this operation. It `https://<host>/<service>/<user>/<repo>/delete`. On the overview page, there is a button to perform this operation. It
@ -48,18 +48,15 @@ $ docker build .
inside the repository. inside the repository.
I'm currently working on migrating to [nix](https://nixos.org/nix). To get a I'm currently working on migrating to [nix](https://nixos.org/nix). To get a development shell, run `nix-shell`, to
development shell, run `nix-shell`, to build the package run `nix-build --attr build the package run `nix-build --attr package` and to build the Docker image, run `nix-build --attr dockerImage`.
package` and to build the Docker image, run `nix-build --attr dockerImage`.
## Running ## Running
Rename [`hoc.toml.example`](./hoc.toml.example) to `hoc.toml` or Rename [`hoc.toml.example`](./hoc.toml.example) to `hoc.toml` or [`.env.example`](./.env.example) to `.env` and set the
[`.env.example`](./.env.example) to `.env` and set the correct value for correct value for `base_url`/`HOC_BASE_URL`. If you don't want to use a configuration or dotenv file, you can pass all
`base_url`/`HOC_BASE_URL`. If you don't want to use a configuration or dotenv parameters directly via environment variables. For variable names see [`.env.example`](./.env.example).
file, you can pass all parameters directly via environment variables. For
variable names see [`.env.example`](./.env.example).
To start a local instance of the service just run: To start a local instance of the service just run:

View File

@ -215,7 +215,7 @@ where
Ok(HttpResponse::TemporaryRedirect() Ok(HttpResponse::TemporaryRedirect()
.header( .header(
LOCATION, LOCATION,
format!("/view/{}/{}/{}", T::url_path(), data.0, data.1), format!("/{}/{}/{}/view", T::url_path(), data.0, data.1),
) )
.finish()) .finish())
}; };
@ -475,6 +475,9 @@ async fn start_server() -> std::io::Result<()> {
.service(web::resource("/view/github/{user}/{repo}").to(overview::<GitHub>)) .service(web::resource("/view/github/{user}/{repo}").to(overview::<GitHub>))
.service(web::resource("/view/gitlab/{user}/{repo}").to(overview::<Gitlab>)) .service(web::resource("/view/gitlab/{user}/{repo}").to(overview::<Gitlab>))
.service(web::resource("/view/bitbucket/{user}/{repo}").to(overview::<Bitbucket>)) .service(web::resource("/view/bitbucket/{user}/{repo}").to(overview::<Bitbucket>))
.service(web::resource("/github/{user}/{repo}/view").to(overview::<GitHub>))
.service(web::resource("/gitlab/{user}/{repo}/view").to(overview::<Gitlab>))
.service(web::resource("/bitbucket/{user}/{repo}/view").to(overview::<Bitbucket>))
.default_service(web::resource("").route(web::get().to(async_p404))) .default_service(web::resource("").route(web::get().to(async_p404)))
}) })
.workers(OPT.workers) .workers(OPT.workers)

View File

@ -10,7 +10,7 @@ Here is the markdown for the badge for <a href="https://@url/@path">@url/@path</
</p> </p>
<pre> <pre>
[![Hits-of-Code](@base_url/@service/@path)](@base_url/view/@service/@path) [![Hits-of-Code](@base_url/@service/@path)](@base_url/@service/@path/view)
</pre> </pre>
<p> <p>
@ -18,6 +18,6 @@ It will be rendered like this
</p> </p>
<pre> <pre>
<a href="@base_url/view/@service/@path"><img src="@base_url/@service/@path" alt="example badge" /></a> <a href="@base_url/@service/@path/view"><img src="@base_url/@service/@path" alt="example badge" /></a>
</pre> </pre>
}, version_info, repo_count) }, version_info, repo_count)

View File

@ -24,7 +24,7 @@ used for GitHub, GitLab and Bitbucket repositories. Just put the following code
</p> </p>
<pre> <pre>
[![Hits-of-Code](@base_url/&lt;service&gt;/&lt;user&gt;/&lt;repo&gt;)](@base_url/view/&lt;service&gt;/&lt;user&gt;/&lt;repo&gt;) [![Hits-of-Code](@base_url/&lt;service&gt;/&lt;user&gt;/&lt;repo&gt;)](@base_url/&lt;service&gt;/&lt;user&gt;/&lt;repo&gt;/view)
</pre> </pre>
<p> <p>
@ -33,7 +33,7 @@ following Markdown
</p> </p>
<pre> <pre>
[![Hits-of-Code](@base_url/github/vbrandl/hoc)](@base_url/view/github/vbrandl/hoc) [![Hits-of-Code](@base_url/github/vbrandl/hoc)](@base_url/github/vbrandl/hoc/view)
</pre> </pre>
<p> <p>
@ -41,7 +41,7 @@ would render this badge:
</p> </p>
<pre> <pre>
<a href="@base_url/view/github/vbrandl/hoc"><img src="@base_url/github/vbrandl/hoc" <a href="@base_url/github/vbrandl/hoc/view"><img src="@base_url/github/vbrandl/hoc"
alt="example badge" /></a> alt="example badge" /></a>
</pre> </pre>

View File

@ -19,7 +19,7 @@ To include the badge in your readme, use the following markdown:
</p> </p>
<pre> <pre>
[![Hits-of-Code](@repo_info.base_url/@repo_info.path?branch=@repo_info.branch)](@repo_info.base_url/view/@repo_info.path?branch=@repo_info.branch) [![Hits-of-Code](@repo_info.base_url/@repo_info.path?branch=@repo_info.branch)](@repo_info.base_url/@repo_info.path?branch=@repo_info.branch/view?branch=@repo_info.branch)
</pre> </pre>