Update to WG Upstream (#4)
* Fix typo: pretter -> pretty * fix: corrected spelling of "minimalistic" * Fix various build warnings. --------- Co-authored-by: Jonas Geiler <skayo.dev@gmail.com>
This commit is contained in:
parent
fdf38d4e55
commit
ba32ab5290
6 changed files with 10 additions and 7 deletions
2
build.rs
2
build.rs
|
|
@ -1,7 +1,7 @@
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
fn main() {
|
fn main() {
|
||||||
let output = Command::new("git")
|
let output = Command::new("git")
|
||||||
.args(&["rev-parse", "HEAD"])
|
.args(["rev-parse", "HEAD"])
|
||||||
.output()
|
.output()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let git_hash = String::from_utf8(output.stdout).unwrap();
|
let git_hash = String::from_utf8(output.stdout).unwrap();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
use rocket::{response::Redirect, Responder};
|
use rocket::{response::Redirect, Responder};
|
||||||
use rocket_dyn_templates::Template;
|
use rocket_dyn_templates::Template;
|
||||||
|
|
||||||
|
// Allowed LEV because Rocket doesn't let us box Responders like Redirect.
|
||||||
|
// See https://github.com/SergioBenitez/Rocket/issues/568
|
||||||
|
#[allow(clippy::large_enum_variant)]
|
||||||
#[derive(Responder)]
|
#[derive(Responder)]
|
||||||
pub enum MaybeRedirect {
|
pub enum MaybeRedirect {
|
||||||
Redirect(Redirect),
|
Redirect(Redirect),
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ use crate::models::response_wrapper::ResponseWrapper;
|
||||||
|
|
||||||
#[get("/p/<id>", rank = 2)]
|
#[get("/p/<id>", rank = 2)]
|
||||||
pub async fn pretty_retrieve(id: PasteId<'_>) -> ResponseWrapper<Template> {
|
pub async fn pretty_retrieve(id: PasteId<'_>) -> ResponseWrapper<Template> {
|
||||||
pretter_retrieve_inner(&id.to_string(), "txt").await
|
pretty_retrieve_inner(&id.to_string(), "txt").await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/p/<id_ext>", rank = 1)]
|
#[get("/p/<id_ext>", rank = 1)]
|
||||||
|
|
@ -24,10 +24,10 @@ pub async fn pretty_retrieve_ext(
|
||||||
let id = id_ext.get_fname();
|
let id = id_ext.get_fname();
|
||||||
let ext = id_ext.get_ext();
|
let ext = id_ext.get_ext();
|
||||||
|
|
||||||
pretter_retrieve_inner(id, ext).await
|
pretty_retrieve_inner(id, ext).await
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn pretter_retrieve_inner(
|
pub async fn pretty_retrieve_inner(
|
||||||
id: &str,
|
id: &str,
|
||||||
ext: &str,
|
ext: &str,
|
||||||
) -> ResponseWrapper<Template> {
|
) -> ResponseWrapper<Template> {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ pub async fn submit(paste: Form<PasteIdForm>) -> Redirect {
|
||||||
let content = &paste.content;
|
let content = &paste.content;
|
||||||
let ext = &paste.ext;
|
let ext = &paste.ext;
|
||||||
|
|
||||||
fs::write(&filepath, content).expect("Unable to write to the file");
|
fs::write(filepath, content).expect("Unable to write to the file");
|
||||||
|
|
||||||
Redirect::to(format!("/p/{id}.{ext}", id = id, ext = ext))
|
Redirect::to(format!("/p/{id}.{ext}", id = id, ext = ext))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<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" />
|
||||||
<meta name="Description" content="Author: Gunwant Jain,
|
<meta name="Description" content="Author: Gunwant Jain,
|
||||||
A highly opinionated and minamalistic Pastebin." />
|
A highly opinionated and minimalistic Pastebin." />
|
||||||
|
|
||||||
<link rel="apple-touch-icon" href="/static/media/apple-touch-icon.png" />
|
<link rel="apple-touch-icon" href="/static/media/apple-touch-icon.png" />
|
||||||
<link rel="icon" type="image/png" sizes="192x192" href="/static/media/android-chrome-192x192.png" />
|
<link rel="icon" type="image/png" sizes="192x192" href="/static/media/android-chrome-192x192.png" />
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
bin(3) BIN bin(3)
|
bin(3) BIN bin(3)
|
||||||
|
|
||||||
NAME
|
NAME
|
||||||
bin - A highly opinionated and minamalistic Pastebin
|
bin - A highly opinionated and minimalistic Pastebin
|
||||||
|
|
||||||
ROUTES
|
ROUTES
|
||||||
GET /
|
GET /
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue