Add tacit css
This commit is contained in:
parent
539b61e856
commit
254351e391
12
src/main.rs
12
src/main.rs
@ -16,6 +16,7 @@ use structopt::StructOpt;
|
|||||||
type State = Arc<String>;
|
type State = Arc<String>;
|
||||||
|
|
||||||
const INDEX: &str = include_str!("../static/index.html");
|
const INDEX: &str = include_str!("../static/index.html");
|
||||||
|
const CSS: &str = include_str!("../static/tacit-css.min.css");
|
||||||
|
|
||||||
#[derive(StructOpt, Debug)]
|
#[derive(StructOpt, Debug)]
|
||||||
struct Opt {
|
struct Opt {
|
||||||
@ -181,6 +182,16 @@ fn index() -> HttpResponse {
|
|||||||
.streaming(rx_body.map_err(|_| error::ErrorBadRequest("bad request")))
|
.streaming(rx_body.map_err(|_| error::ErrorBadRequest("bad request")))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[get("/tacit-css.min.css")]
|
||||||
|
fn css() -> HttpResponse {
|
||||||
|
let (tx, rx_body) = mpsc::unbounded();
|
||||||
|
let _ = tx.unbounded_send(Bytes::from(CSS.as_bytes()));
|
||||||
|
|
||||||
|
HttpResponse::Ok()
|
||||||
|
.content_type("text/css")
|
||||||
|
.streaming(rx_body.map_err(|_| error::ErrorBadRequest("bad request")))
|
||||||
|
}
|
||||||
|
|
||||||
fn main() -> std::io::Result<()> {
|
fn main() -> std::io::Result<()> {
|
||||||
std::env::set_var("RUST_LOG", "actix_web=info");
|
std::env::set_var("RUST_LOG", "actix_web=info");
|
||||||
pretty_env_logger::init();
|
pretty_env_logger::init();
|
||||||
@ -193,6 +204,7 @@ fn main() -> std::io::Result<()> {
|
|||||||
.data(state.clone())
|
.data(state.clone())
|
||||||
.wrap(middleware::Logger::default())
|
.wrap(middleware::Logger::default())
|
||||||
.service(index)
|
.service(index)
|
||||||
|
.service(css)
|
||||||
.service(web::resource("/github/{user}/{repo}").to(github))
|
.service(web::resource("/github/{user}/{repo}").to(github))
|
||||||
.service(web::resource("/gitlab/{user}/{repo}").to(gitlab))
|
.service(web::resource("/gitlab/{user}/{repo}").to(gitlab))
|
||||||
.service(web::resource("/bitbucket/{user}/{repo}").to(bitbucket))
|
.service(web::resource("/bitbucket/{user}/{repo}").to(bitbucket))
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
<link rel="stylesheet" href="tacit-css.min.css"/>
|
||||||
<title>Hits-of-Code Badges</title>
|
<title>Hits-of-Code Badges</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -25,32 +26,32 @@ gives an overview about the amount of work put into a codebase.
|
|||||||
<p />
|
<p />
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
<p>
|
||||||
There is a <a href="https://github.com/yegor256/hoc/">command-line tool</a> to calculate the HoC of a repository, but
|
There is a <a href="https://github.com/yegor256/hoc/">command-line tool</a> to calculate the HoC of a repository, but
|
||||||
some people might want a nice badge to put in their README, that's why I implemented this API. Currently the API can be
|
some people might want a nice badge to put in their README, that's why I implemented this API. Currently the API can be
|
||||||
used for GitHub, GitLab and Bitbucket repositories. Just put the following code in your README:
|
used for GitHub, GitLab and Bitbucket repositories. Just put the following code in your README:
|
||||||
|
|
||||||
<code>
|
|
||||||
<pre>
|
<pre>
|
||||||
![Hits-of-Code](https://hoc.oldsql.cc/<service>/<user>/<repo>)
|
![Hits-of-Code](https://hoc.oldsql.cc/<service>/<user>/<repo>)
|
||||||
</pre>
|
</pre>
|
||||||
</code>
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
where <code><service></code> is one of <code>github</code>, <code>gitlab</code> or <code>bitbucket</code>. So the
|
where <code><service></code> is one of <code>github</code>, <code>gitlab</code> or <code>bitbucket</code>. So the
|
||||||
following Markdown
|
following Markdown
|
||||||
|
|
||||||
<code>
|
|
||||||
<pre>
|
<pre>
|
||||||
![Hits-of-Code](https://hoc.oldsql.cc/github/vbrandl/elm-chess)
|
![Hits-of-Code](https://hoc.oldsql.cc/github/vbrandl/elm-chess)
|
||||||
</pre>
|
</pre>
|
||||||
</code>
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
would render this badge:
|
would render this badge:
|
||||||
|
|
||||||
<code>
|
|
||||||
<pre>
|
<pre>
|
||||||
<img src="https://hoc.oldsql.cc/github/vbrandl/elm-chess" />
|
<img src="https://hoc.oldsql.cc/github/vbrandl/elm-chess" />
|
||||||
</pre>
|
</pre>
|
||||||
</code>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2>Source Code</h2>
|
<h2>Source Code</h2>
|
||||||
|
3
static/tacit-css.min.css
vendored
Normal file
3
static/tacit-css.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user