cargo update, fmt and add rust_embed crate
Signed-off-by: Gunwant Jain <mail@wantguns.dev>
This commit is contained in:
725
Cargo.lock
generated
725
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -2,13 +2,13 @@
|
|||||||
name = "bin"
|
name = "bin"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Gunwant Jain <mail@wantguns.dev>"]
|
authors = ["Gunwant Jain <mail@wantguns.dev>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rand = "0.8.0"
|
rand = "0.8.4"
|
||||||
rocket = "0.5.0-rc.1"
|
rocket = "0.5.0-rc.1"
|
||||||
tree_magic = "0.2.3"
|
tree_magic = "0.2.3"
|
||||||
syntect = "4.5.0"
|
syntect = "4.6.0"
|
||||||
|
|
||||||
[dependencies.rocket_dyn_templates]
|
[dependencies.rocket_dyn_templates]
|
||||||
version = "0.1.0-rc.1"
|
version = "0.1.0-rc.1"
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
pub mod paste_id;
|
pub mod paste_id;
|
||||||
pub mod pretty_syntax;
|
|
||||||
pub mod pretty;
|
pub mod pretty;
|
||||||
|
pub mod pretty_syntax;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
pub mod index;
|
pub mod index;
|
||||||
pub mod pretty_retrieve;
|
pub mod pretty_retrieve;
|
||||||
pub mod pretty_retrieve_ext;
|
pub mod pretty_retrieve_ext;
|
||||||
pub mod submit;
|
|
||||||
pub mod upload;
|
|
||||||
pub mod retrieve;
|
pub mod retrieve;
|
||||||
pub mod static_files;
|
pub mod static_files;
|
||||||
|
pub mod submit;
|
||||||
|
pub mod upload;
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ use rocket_dyn_templates::Template;
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use crate::models::pretty_syntax::PasteIdSyntax;
|
|
||||||
use crate::models::pretty::get_pretty_body;
|
use crate::models::pretty::get_pretty_body;
|
||||||
|
use crate::models::pretty_syntax::PasteIdSyntax;
|
||||||
|
|
||||||
#[get("/p/<id_ext>", rank = 1)]
|
#[get("/p/<id_ext>", rank = 1)]
|
||||||
pub async fn pretty_retrieve_ext(id_ext: PasteIdSyntax<'_>) -> Option<Template> {
|
pub async fn pretty_retrieve_ext(id_ext: PasteIdSyntax<'_>) -> Option<Template> {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
|
|
||||||
use crate::models::pretty_syntax::PasteIdSyntax;
|
|
||||||
use crate::models::paste_id::PasteId;
|
use crate::models::paste_id::PasteId;
|
||||||
|
use crate::models::pretty_syntax::PasteIdSyntax;
|
||||||
|
|
||||||
#[get("/<id>", rank = 2)]
|
#[get("/<id>", rank = 2)]
|
||||||
pub async fn retrieve(id: PasteId<'_>) -> Option<File> {
|
pub async fn retrieve(id: PasteId<'_>) -> Option<File> {
|
||||||
@@ -17,4 +17,3 @@ pub async fn retrieve_ext(id_ext: PasteIdSyntax<'_>) -> Option<File> {
|
|||||||
|
|
||||||
File::open(&filename).ok()
|
File::open(&filename).ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ 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!("/{id}", id = id),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user