diff --git a/README.md b/README.md index 8396097..fe9aa35 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # 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) [![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) @@ -26,7 +26,7 @@ where `` is one of `gitub`, `gitlab` or `bitbucket`. The HoC data can a https://////json ``` -There is also an overview page available via `https:///view///` +There is also an overview page available via `https://////view` To delete a repository and the cache from the server, send a `POST` request to `https://////delete`. On the overview page, there is a button to perform this operation. It @@ -48,18 +48,15 @@ $ docker build . inside the repository. -I'm currently working on migrating to [nix](https://nixos.org/nix). To get a -development shell, run `nix-shell`, to build the package run `nix-build --attr -package` and to build the Docker image, run `nix-build --attr dockerImage`. +I'm currently working on migrating to [nix](https://nixos.org/nix). To get a development shell, run `nix-shell`, to +build the package run `nix-build --attr package` and to build the Docker image, run `nix-build --attr dockerImage`. ## Running -Rename [`hoc.toml.example`](./hoc.toml.example) to `hoc.toml` or -[`.env.example`](./.env.example) to `.env` and set the correct value for -`base_url`/`HOC_BASE_URL`. If you don't want to use a configuration or dotenv -file, you can pass all parameters directly via environment variables. For -variable names see [`.env.example`](./.env.example). +Rename [`hoc.toml.example`](./hoc.toml.example) to `hoc.toml` or [`.env.example`](./.env.example) to `.env` and set the +correct value for `base_url`/`HOC_BASE_URL`. If you don't want to use a configuration or dotenv 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: diff --git a/src/main.rs b/src/main.rs index 499daca..78d0b0c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -215,7 +215,7 @@ where Ok(HttpResponse::TemporaryRedirect() .header( LOCATION, - format!("/view/{}/{}/{}", T::url_path(), data.0, data.1), + format!("/{}/{}/{}/view", T::url_path(), data.0, data.1), ) .finish()) }; @@ -475,6 +475,9 @@ async fn start_server() -> std::io::Result<()> { .service(web::resource("/view/github/{user}/{repo}").to(overview::)) .service(web::resource("/view/gitlab/{user}/{repo}").to(overview::)) .service(web::resource("/view/bitbucket/{user}/{repo}").to(overview::)) + .service(web::resource("/github/{user}/{repo}/view").to(overview::)) + .service(web::resource("/gitlab/{user}/{repo}/view").to(overview::)) + .service(web::resource("/bitbucket/{user}/{repo}/view").to(overview::)) .default_service(web::resource("").route(web::get().to(async_p404))) }) .workers(OPT.workers) diff --git a/templates/generate.rs.html b/templates/generate.rs.html index 7c3a759..f4ad6dc 100644 --- a/templates/generate.rs.html +++ b/templates/generate.rs.html @@ -10,7 +10,7 @@ Here is the markdown for the badge for @url/@path
-[![Hits-of-Code](@base_url/@service/@path)](@base_url/view/@service/@path)
+[![Hits-of-Code](@base_url/@service/@path)](@base_url/@service/@path/view)
 

@@ -18,6 +18,6 @@ It will be rendered like this

-example badge
+example badge
 
}, version_info, repo_count) diff --git a/templates/index.rs.html b/templates/index.rs.html index 188df4e..7f886f6 100644 --- a/templates/index.rs.html +++ b/templates/index.rs.html @@ -24,7 +24,7 @@ used for GitHub, GitLab and Bitbucket repositories. Just put the following code

-[![Hits-of-Code](@base_url/<service>/<user>/<repo>)](@base_url/view/<service>/<user>/<repo>)
+[![Hits-of-Code](@base_url/<service>/<user>/<repo>)](@base_url/<service>/<user>/<repo>/view)
 

@@ -33,7 +33,7 @@ following Markdown

-[![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)
 

@@ -41,7 +41,7 @@ would render this badge:

-example badge
 
diff --git a/templates/overview.rs.html b/templates/overview.rs.html index f3b5ba7..af52040 100644 --- a/templates/overview.rs.html +++ b/templates/overview.rs.html @@ -19,7 +19,7 @@ To include the badge in your readme, use the following markdown:

-[![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)