Compare commits
3 commits
Author | SHA1 | Date | |
---|---|---|---|
|
907b595339 | ||
|
16de177083 | ||
|
dda65a53e1 |
2
.github/workflows/rust.yml
vendored
|
@ -1,4 +1,4 @@
|
||||||
name: Rust
|
name: Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|
13
README.MD
|
@ -1,24 +1,17 @@
|
||||||
|
|
||||||
![Screenshot](git/index.png)
|
# <img src="git/logo.png" alt="Logo" width="35" /> MicroBin
|
||||||
|
|
||||||
# MicroBin
|
|
||||||
|
|
||||||
|
|
||||||
![Build](https://github.com/szabodanika/microbin/actions/workflows/rust.yml/badge.svg)
|
![Build](https://github.com/szabodanika/microbin/actions/workflows/rust.yml/badge.svg)
|
||||||
![crates.io](https://img.shields.io/crates/v/microbin.svg)
|
![crates.io](https://img.shields.io/crates/v/microbin.svg)
|
||||||
|
|
||||||
|
|
||||||
MicroBin is a super tiny, feature rich, configurable, self-contained and self-hosted paste bin web application. It is very easy to set up and use, and will only require a few megabytes of memory and disk storage. It takes only a couple minutes to set it up, why not give it a try now?
|
MicroBin is a super tiny, feature rich, configurable, self-contained and self-hosted paste bin web application. It is very easy to set up and use, and will only require a few megabytes of memory and disk storage. It takes only a couple minutes to set it up, why not give it a try now?
|
||||||
|
|
||||||
[![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/szabodanika/microbin)
|
[![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`
|
![Screenshot](git/index.png)
|
||||||
|
|
||||||
And run with your custom configuration:
|
|
||||||
|
|
||||||
`microbin --port 8080 --highlightsyntax --editable`
|
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
- Is very small
|
- Is very small
|
||||||
|
|
BIN
git/logo.png
Normal file
After Width: | Height: | Size: 135 KiB |
|
@ -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 actix_web::{get, web, HttpResponse};
|
||||||
use askama::Template;
|
use askama::Template;
|
||||||
|
use std::io::ErrorKind::NotFound;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
#[derive(Template)]
|
|
||||||
#[template(path = "water.css", escape = "none")]
|
|
||||||
struct WaterCSS<'a> {
|
|
||||||
_marker: PhantomData<&'a ()>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[get("/static/{resource}")]
|
#[get("/static/{resource}")]
|
||||||
pub async fn static_resources(resource_id: web::Path<String>) -> HttpResponse {
|
pub async fn static_resources(resource_id: web::Path<String>) -> HttpResponse {
|
||||||
match resource_id.into_inner().as_str() {
|
return match resource_id.into_inner().as_str() {
|
||||||
"water.css" => HttpResponse::Ok().content_type("text/css").body(
|
"water.css" => HttpResponse::Ok()
|
||||||
WaterCSS {
|
.content_type("text/css")
|
||||||
_marker: Default::default(),
|
.body(include_bytes!("../../templates/static/water.css").to_vec()),
|
||||||
}
|
|
||||||
.render()
|
"icon.ico" => HttpResponse::Ok()
|
||||||
.unwrap(),
|
.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(),
|
_ => HttpResponse::NotFound().content_type("text/html").finish(),
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,13 @@
|
||||||
<title>{{ args.title.as_ref().unwrap() }}</title>
|
<title>{{ args.title.as_ref().unwrap() }}</title>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
|
<link rel="icon" type="image/png" href="/static/icon.ico">
|
||||||
|
<link rel="icon" type="image/png" href="/static/icon-16x16.png" sizes="16x16">
|
||||||
|
<link rel="icon" type="image/png" href="/static/icon-32x32.png" sizes="32x32">
|
||||||
|
<link rel="icon" type="image/png" href="/static/icon-192x192.png" sizes="192x192">
|
||||||
|
<link rel="icon" type="image/png" href="/static/icon-512x512.png">
|
||||||
|
<link rel="apple-touch-icon" href="/static/apple-touch-icon.png">
|
||||||
|
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
{% if !args.pure_html %}
|
{% if !args.pure_html %}
|
||||||
|
@ -39,11 +46,12 @@
|
||||||
<b style="margin-right: 0.5rem">
|
<b style="margin-right: 0.5rem">
|
||||||
|
|
||||||
{% if !args.hide_logo %}
|
{% if !args.hide_logo %}
|
||||||
<i><span style="font-size:2.2rem; margin-right:1rem">μ</span></i>
|
<!-- <i><span style="font-size:2.2rem; margin-right:1rem">μ</span></i>-->
|
||||||
|
<img width="25" style="margin-bottom: -0.4rem; margin-right: 0.4rem" src="static/icon-192x192.png"/>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
{% if args.footer_text.as_ref().is_none() %}
|
{% if args.footer_text.as_ref().is_none() %}
|
||||||
MicroBin
|
<span>MicroBin</span>
|
||||||
{%- else %}
|
{%- else %}
|
||||||
{{ args.title.as_ref().unwrap() }}
|
{{ args.title.as_ref().unwrap() }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
<div style="display: grid;
|
<div style="display: grid;
|
||||||
grid-gap: 4px;
|
grid-gap: 4px;
|
||||||
grid-template-columns: repeat(auto-fit, 234px);
|
grid-template-columns: repeat(auto-fit, 234px);
|
||||||
grid-template-rows: repeat(1, 100px); ">
|
grid-template-rows: repeat(1, 78px); ">
|
||||||
<div>
|
<div>
|
||||||
<label for="expiration">Expiration</label><br>
|
<label for="expiration">Expiration</label><br>
|
||||||
<select style="width: 100%;" name="expiration" id="expiration">
|
<select style="width: 100%;margin-top: 0" name="expiration" id="expiration">
|
||||||
<optgroup label="Expire">
|
<optgroup label="Expire">
|
||||||
<option value="1min">1 minute</option>
|
<option value="1min">1 minute</option>
|
||||||
<option value="10min">10 minutes</option>
|
<option value="10min">10 minutes</option>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
{% if args.highlightsyntax %}
|
{% if args.highlightsyntax %}
|
||||||
<div>
|
<div>
|
||||||
<label for="syntax-highlight">Syntax Highlighting</label><br>
|
<label for="syntax-highlight">Syntax Highlighting</label><br>
|
||||||
<select style="width: 100%;" name="syntax-highlight" id="syntax-highlight">
|
<select style="width: 100%; ;margin-top: 0" name="syntax-highlight" id="syntax-highlight">
|
||||||
<option value="none">None</option>
|
<option value="none">None</option>
|
||||||
<optgroup label="Source Code">
|
<optgroup label="Source Code">
|
||||||
<option value="sh">Bash Shell</option>
|
<option value="sh">Bash Shell</option>
|
||||||
|
@ -58,13 +58,12 @@
|
||||||
{%- else %}
|
{%- else %}
|
||||||
<input type="hidden" name="syntax-highlight" value="none">
|
<input type="hidden" name="syntax-highlight" value="none">
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label>File attachment</label>
|
<label>File attachment</label><br>
|
||||||
|
<input style="width: 100%; height: 21px" type="file" id="file" name="file">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<input style="width: 100%;" type="file" id="file" name="file">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<label>Content</label>
|
<label>Content</label>
|
||||||
<br>
|
<br>
|
||||||
<textarea style="width: 100%; min-height: 100px" name="content" autofocus></textarea>
|
<textarea style="width: 100%; min-height: 100px" name="content" autofocus></textarea>
|
||||||
|
|
BIN
templates/static/apple-touch-icon.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
templates/static/icon-16x16.png
Normal file
After Width: | Height: | Size: 875 B |
BIN
templates/static/icon-192x192.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
templates/static/icon-32x32.png
Normal file
After Width: | Height: | Size: 2 KiB |
BIN
templates/static/icon-512x512.png
Normal file
After Width: | Height: | Size: 135 KiB |
BIN
templates/static/icon.ico
Normal file
After Width: | Height: | Size: 15 KiB |