Some documentation and cleanup of old, commented out code.
Signed-off-by: Jade <obsidianical@gmail.com>
This commit is contained in:
parent
528a7b6899
commit
7d5c70ddd6
7 changed files with 8 additions and 42 deletions
|
@ -27,6 +27,7 @@ pub async fn index() -> impl Responder {
|
|||
.body(IndexTemplate { args: &ARGS }.render().unwrap())
|
||||
}
|
||||
|
||||
/// Pasta creation endpoint.
|
||||
pub async fn create(
|
||||
data: web::Data<AppState>,
|
||||
mut payload: Multipart,
|
||||
|
|
|
@ -14,6 +14,7 @@ struct Info<'a> {
|
|||
message: &'a str,
|
||||
}
|
||||
|
||||
/// Endpoint to get information about the instance.
|
||||
#[get("/info")]
|
||||
pub async fn info(data: web::Data<AppState>) -> HttpResponse {
|
||||
// get access to the pasta collection
|
||||
|
|
|
@ -18,6 +18,7 @@ struct PastaTemplate<'a> {
|
|||
args: &'a Args,
|
||||
}
|
||||
|
||||
/// Endpoint to view a pasta.
|
||||
#[get("/pasta/{id}")]
|
||||
pub async fn getpasta(data: web::Data<AppState>, id: web::Path<String>) -> HttpResponse {
|
||||
// get access to the pasta collection
|
||||
|
@ -82,6 +83,7 @@ pub async fn getpasta(data: web::Data<AppState>, id: web::Path<String>) -> HttpR
|
|||
.body(ErrorTemplate { args: &ARGS }.render().unwrap())
|
||||
}
|
||||
|
||||
/// Endpoint for redirection.
|
||||
#[get("/url/{id}")]
|
||||
pub async fn redirecturl(data: web::Data<AppState>, id: web::Path<String>) -> HttpResponse {
|
||||
// get access to the pasta collection
|
||||
|
@ -149,6 +151,7 @@ pub async fn redirecturl(data: web::Data<AppState>, id: web::Path<String>) -> Ht
|
|||
.body(ErrorTemplate { args: &ARGS }.render().unwrap())
|
||||
}
|
||||
|
||||
/// Endpoint to request pasta as raw file.
|
||||
#[get("/raw/{id}")]
|
||||
pub async fn getrawpasta(data: web::Data<AppState>, id: web::Path<String>) -> String {
|
||||
// get access to the pasta collection
|
||||
|
|
|
@ -13,6 +13,7 @@ struct PastaListTemplate<'a> {
|
|||
args: &'a Args,
|
||||
}
|
||||
|
||||
/// The endpoint to view all currently registered pastas.
|
||||
#[get("/pastalist")]
|
||||
pub async fn list(data: web::Data<AppState>) -> HttpResponse {
|
||||
if ARGS.no_listing {
|
||||
|
|
|
@ -16,6 +16,7 @@ struct QRTemplate<'a> {
|
|||
args: &'a Args,
|
||||
}
|
||||
|
||||
/// Endpoint to open a QR code to a pasta.
|
||||
#[get("/qr/{id}")]
|
||||
pub async fn getqr(data: web::Data<AppState>, id: web::Path<String>) -> HttpResponse {
|
||||
// get access to the pasta collection
|
||||
|
|
|
@ -10,6 +10,7 @@ use crate::AppState;
|
|||
use askama::Template;
|
||||
use std::fs;
|
||||
|
||||
/// Endpoint to remove a pasta.
|
||||
#[get("/remove/{id}")]
|
||||
pub async fn remove(data: web::Data<AppState>, id: web::Path<String>) -> HttpResponse {
|
||||
if ARGS.readonly {
|
||||
|
|
|
@ -19,45 +19,3 @@ fn handle_embedded_file(path: &str) -> HttpResponse {
|
|||
async fn static_resources(path: web::Path<String>) -> impl Responder {
|
||||
handle_embedded_file(path.as_str())
|
||||
}
|
||||
|
||||
// #[derive(Template)]
|
||||
// #[template(path = "water.css", escape = "none")]
|
||||
// struct WaterCSS<'a> {
|
||||
// _marker: PhantomData<&'a ()>,
|
||||
// }
|
||||
|
||||
// // #[derive(Template)]
|
||||
// // #[template(path = "logo.png", escape = "none")]
|
||||
// struct LogoPNG<'a> {
|
||||
// _marker: PhantomData<&'a ()>,
|
||||
// }
|
||||
|
||||
// #[derive(Template)]
|
||||
// #[template(path = "favicon.svg", escape = "none")]
|
||||
// struct Favicon<'a> {
|
||||
// _marker: PhantomData<&'a ()>,
|
||||
// }
|
||||
|
||||
// #[get("/static/{resource}")]
|
||||
// pub async fn static_resources(resource_id: web::Path<String>) -> HttpResponse {
|
||||
// match resource_id.into_inner().as_str() {
|
||||
// "water.css" => HttpResponse::Ok().content_type("text/css").body(
|
||||
// WaterCSS {
|
||||
// _marker: Default::default(),
|
||||
// }
|
||||
// .render()
|
||||
// .unwrap(),
|
||||
// ),
|
||||
// "logo.png" => HttpResponse::Ok()
|
||||
// .content_type("image/png")
|
||||
// .body(Ok(EmbedFile::open("templates/logo.png")?)),
|
||||
// "favicon.svg" => HttpResponse::Ok().content_type("image/svg+xml").body(
|
||||
// Favicon {
|
||||
// _marker: Default::default(),
|
||||
// }
|
||||
// .render()
|
||||
// .unwrap(),
|
||||
// ),
|
||||
// _ => HttpResponse::NotFound().content_type("text/html").finish(),
|
||||
// }
|
||||
// }
|
||||
|
|
Loading…
Reference in a new issue