From c3aa68af78ccd33d7b3a772cb905621930297b2a Mon Sep 17 00:00:00 2001 From: Leonora Tindall Date: Mon, 31 Jan 2022 21:54:00 -0600 Subject: [PATCH] Move raw to /r/ instead of / --- src/routes/pretty_retrieve.rs | 2 +- src/routes/retrieve.rs | 4 ++-- src/routes/upload.rs | 2 +- templates/index.html.tera | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/routes/pretty_retrieve.rs b/src/routes/pretty_retrieve.rs index 38689f4..207965f 100644 --- a/src/routes/pretty_retrieve.rs +++ b/src/routes/pretty_retrieve.rs @@ -48,7 +48,7 @@ pub async fn pretter_retrieve_inner( Ok(v) => v, Err(e) if e.kind() == InvalidData => { return ResponseWrapper::redirect(Redirect::permanent(format!( - "/{}", + "/r/{}", id ))); } diff --git a/src/routes/retrieve.rs b/src/routes/retrieve.rs index af2ccd9..d291510 100644 --- a/src/routes/retrieve.rs +++ b/src/routes/retrieve.rs @@ -7,13 +7,13 @@ use crate::models::paste_id::PasteId; use crate::models::pretty_syntax::PasteIdSyntax; use crate::models::response_wrapper::ResponseWrapper; -#[get("/", rank = 2)] +#[get("/r/", rank = 2)] pub async fn retrieve(id: PasteId<'_>) -> ResponseWrapper { retrieve_inner(&id.to_string()).await } // rank 1 here because this would be more oftenly used -#[get("/", rank = 1)] +#[get("/r/", rank = 1)] pub async fn retrieve_ext(id_ext: PasteIdSyntax<'_>) -> ResponseWrapper { retrieve_inner(id_ext.get_fname()).await } diff --git a/src/routes/upload.rs b/src/routes/upload.rs index 424192c..aca88c9 100644 --- a/src/routes/upload.rs +++ b/src/routes/upload.rs @@ -22,7 +22,7 @@ pub async fn upload(paste: Data<'_>) -> Result { .contains("text") { true => format!("/p/{id}", id = id), - false => format!("/{id}", id = id), + false => format!("/r/{id}", id = id), }; Ok(url) diff --git a/templates/index.html.tera b/templates/index.html.tera index 3696217..c211aff 100644 --- a/templates/index.html.tera +++ b/templates/index.html.tera @@ -12,7 +12,7 @@ NAME bin - A highly opinionated and minamalistic Pastebin ROUTES - GET / + GET /r/ Get raw pastes GET /p/ Get highlighted pastes