diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 7eab1a6..220d752 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,4 +1,4 @@ -name: Rust +name: Build on: push: diff --git a/README.MD b/README.MD index 43d8d14..aa69d54 100644 --- a/README.MD +++ b/README.MD @@ -1,7 +1,5 @@ -![Screenshot](git/index.png) - -# MicroBin +# Logo MicroBin ![Build](https://github.com/szabodanika/microbin/actions/workflows/rust.yml/badge.svg) @@ -12,15 +10,12 @@ MicroBin is a super tiny, feature rich, configurable, self-contained and self-ho [![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/szabodanika/microbin) -Or install from Cargo: +Or install from Cargo: +`cargo install microbin`, and run with your custom configuration: `microbin --port 8080 --highlightsyntax --editable`. -`cargo install microbin` - -And run with your custom configuration: - -`microbin --port 8080 --highlightsyntax --editable` ### Features +![Screenshot](git/index.png) - Is very small - Animal names instead of random numbers for pasta identifiers (64 animals) - File uploads (eg. server.com/file/pig-dog-cat) diff --git a/git/logo.png b/git/logo.png new file mode 100644 index 0000000..4d7958f Binary files /dev/null and b/git/logo.png differ diff --git a/src/endpoints/static_resources.rs b/src/endpoints/static_resources.rs index 9a5318e..53611a2 100644 --- a/src/endpoints/static_resources.rs +++ b/src/endpoints/static_resources.rs @@ -1,23 +1,37 @@ +use actix_web::dev::JsonBody::Body; +use actix_web::error::UrlencodedError::ContentType; +use actix_web::web::Path; use actix_web::{get, web, HttpResponse}; use askama::Template; +use std::io::ErrorKind::NotFound; use std::marker::PhantomData; -#[derive(Template)] -#[template(path = "water.css", escape = "none")] -struct WaterCSS<'a> { - _marker: PhantomData<&'a ()>, -} - #[get("/static/{resource}")] pub async fn static_resources(resource_id: web::Path) -> HttpResponse { - match resource_id.into_inner().as_str() { - "water.css" => HttpResponse::Ok().content_type("text/css").body( - WaterCSS { - _marker: Default::default(), - } - .render() - .unwrap(), - ), + return match resource_id.into_inner().as_str() { + "water.css" => HttpResponse::Ok() + .content_type("text/css") + .body(include_bytes!("../../templates/static/water.css").to_vec()), + + "icon.ico" => HttpResponse::Ok() + .content_type("image/x-icon") + .body(include_bytes!("../../templates/static/icon.ico").to_vec()), + "icon-16x16.png" => HttpResponse::Ok() + .content_type("image/x-icon") + .body(include_bytes!("../../templates/static/icon-16x16.png").to_vec()), + "icon-32x32.png" => HttpResponse::Ok() + .content_type("image/x-icon") + .body(include_bytes!("../../templates/static/icon-32x32.png").to_vec()), + "icon-192x192.png" => HttpResponse::Ok() + .content_type("image/x-icon") + .body(include_bytes!("../../templates/static/icon-192x192.png").to_vec()), + "icon-512x512.png" => HttpResponse::Ok() + .content_type("image/x-icon") + .body(include_bytes!("../../templates/static/icon-512x512.png").to_vec()), + "apple-touch-icon.png" => HttpResponse::Ok() + .content_type("image/x-icon") + .body(include_bytes!("../../templates/static/apple-touch-icon.png").to_vec()), + _ => HttpResponse::NotFound().content_type("text/html").finish(), - } + }; } diff --git a/templates/header.html b/templates/header.html index d5757ba..d20c0d4 100644 --- a/templates/header.html +++ b/templates/header.html @@ -7,6 +7,13 @@ {{ args.title.as_ref().unwrap() }} {%- endif %} + + + + + + + {% if !args.pure_html %} @@ -39,11 +46,12 @@ {% if !args.hide_logo %} - μ + + {%- endif %} {% if args.footer_text.as_ref().is_none() %} - MicroBin + MicroBin {%- else %} {{ args.title.as_ref().unwrap() }} {%- endif %} diff --git a/templates/index.html b/templates/index.html index e1c4ef7..fa9abf6 100644 --- a/templates/index.html +++ b/templates/index.html @@ -4,10 +4,10 @@
+ grid-template-rows: repeat(1, 78px); ">

- @@ -21,7 +21,7 @@ {% if args.highlightsyntax %}

- @@ -58,13 +58,12 @@ {%- else %} {%- endif %} -
- -
- +
+
+

diff --git a/templates/static/apple-touch-icon.png b/templates/static/apple-touch-icon.png new file mode 100644 index 0000000..3812ee0 Binary files /dev/null and b/templates/static/apple-touch-icon.png differ diff --git a/templates/static/icon-16x16.png b/templates/static/icon-16x16.png new file mode 100644 index 0000000..0f77045 Binary files /dev/null and b/templates/static/icon-16x16.png differ diff --git a/templates/static/icon-192x192.png b/templates/static/icon-192x192.png new file mode 100644 index 0000000..9c7caa3 Binary files /dev/null and b/templates/static/icon-192x192.png differ diff --git a/templates/static/icon-32x32.png b/templates/static/icon-32x32.png new file mode 100644 index 0000000..aef8591 Binary files /dev/null and b/templates/static/icon-32x32.png differ diff --git a/templates/static/icon-512x512.png b/templates/static/icon-512x512.png new file mode 100644 index 0000000..4d7958f Binary files /dev/null and b/templates/static/icon-512x512.png differ diff --git a/templates/static/icon.ico b/templates/static/icon.ico new file mode 100644 index 0000000..b248631 Binary files /dev/null and b/templates/static/icon.ico differ diff --git a/templates/water.css b/templates/static/water.css similarity index 100% rename from templates/water.css rename to templates/static/water.css