Move raw to /r/ instead of /
This commit is contained in:
parent
460e0ac022
commit
c3aa68af78
4 changed files with 5 additions and 5 deletions
|
|
@ -48,7 +48,7 @@ pub async fn pretter_retrieve_inner(
|
||||||
Ok(v) => v,
|
Ok(v) => v,
|
||||||
Err(e) if e.kind() == InvalidData => {
|
Err(e) if e.kind() == InvalidData => {
|
||||||
return ResponseWrapper::redirect(Redirect::permanent(format!(
|
return ResponseWrapper::redirect(Redirect::permanent(format!(
|
||||||
"/{}",
|
"/r/{}",
|
||||||
id
|
id
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,13 @@ use crate::models::paste_id::PasteId;
|
||||||
use crate::models::pretty_syntax::PasteIdSyntax;
|
use crate::models::pretty_syntax::PasteIdSyntax;
|
||||||
use crate::models::response_wrapper::ResponseWrapper;
|
use crate::models::response_wrapper::ResponseWrapper;
|
||||||
|
|
||||||
#[get("/<id>", rank = 2)]
|
#[get("/r/<id>", rank = 2)]
|
||||||
pub async fn retrieve(id: PasteId<'_>) -> ResponseWrapper<File> {
|
pub async fn retrieve(id: PasteId<'_>) -> ResponseWrapper<File> {
|
||||||
retrieve_inner(&id.to_string()).await
|
retrieve_inner(&id.to_string()).await
|
||||||
}
|
}
|
||||||
|
|
||||||
// rank 1 here because this would be more oftenly used
|
// rank 1 here because this would be more oftenly used
|
||||||
#[get("/<id_ext>", rank = 1)]
|
#[get("/r/<id_ext>", rank = 1)]
|
||||||
pub async fn retrieve_ext(id_ext: PasteIdSyntax<'_>) -> ResponseWrapper<File> {
|
pub async fn retrieve_ext(id_ext: PasteIdSyntax<'_>) -> ResponseWrapper<File> {
|
||||||
retrieve_inner(id_ext.get_fname()).await
|
retrieve_inner(id_ext.get_fname()).await
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ pub async fn upload(paste: Data<'_>) -> Result<String, std::io::Error> {
|
||||||
.contains("text")
|
.contains("text")
|
||||||
{
|
{
|
||||||
true => format!("/p/{id}", id = id),
|
true => format!("/p/{id}", id = id),
|
||||||
false => format!("/{id}", id = id),
|
false => format!("/r/{id}", id = id),
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(url)
|
Ok(url)
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ NAME
|
||||||
bin - A highly opinionated and minamalistic Pastebin
|
bin - A highly opinionated and minamalistic Pastebin
|
||||||
|
|
||||||
ROUTES
|
ROUTES
|
||||||
GET /<id>
|
GET /r/<id>
|
||||||
Get raw pastes
|
Get raw pastes
|
||||||
GET /p/<id>
|
GET /p/<id>
|
||||||
Get highlighted pastes
|
Get highlighted pastes
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue