cargo update, fmt and add rust_embed crate

Signed-off-by: Gunwant Jain <mail@wantguns.dev>
This commit is contained in:
Gunwant Jain
2022-01-16 23:03:53 +05:30
parent 0359a8ef52
commit 33583b71d4
8 changed files with 410 additions and 335 deletions

725
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -2,13 +2,13 @@
name = "bin"
version = "0.1.0"
authors = ["Gunwant Jain <mail@wantguns.dev>"]
edition = "2018"
edition = "2021"
[dependencies]
rand = "0.8.0"
rand = "0.8.4"
rocket = "0.5.0-rc.1"
tree_magic = "0.2.3"
syntect = "4.5.0"
syntect = "4.6.0"
[dependencies.rocket_dyn_templates]
version = "0.1.0-rc.1"

View File

@@ -1,3 +1,3 @@
pub mod paste_id;
pub mod pretty;
pub mod pretty_syntax;
pub mod pretty;

View File

@@ -7,4 +7,4 @@ pub async fn index() -> Option<Template> {
let mut map = HashMap::new();
map.insert("title", "bin");
Some(Template::render("index", &map))
}
}

View File

@@ -1,7 +1,7 @@
pub mod index;
pub mod pretty_retrieve;
pub mod pretty_retrieve_ext;
pub mod submit;
pub mod upload;
pub mod retrieve;
pub mod static_files;
pub mod submit;
pub mod upload;

View File

@@ -3,8 +3,8 @@ use rocket_dyn_templates::Template;
use std::collections::HashMap;
use std::path::Path;
use crate::models::pretty_syntax::PasteIdSyntax;
use crate::models::pretty::get_pretty_body;
use crate::models::pretty_syntax::PasteIdSyntax;
#[get("/p/<id_ext>", rank = 1)]
pub async fn pretty_retrieve_ext(id_ext: PasteIdSyntax<'_>) -> Option<Template> {

View File

@@ -1,7 +1,7 @@
use std::fs::File;
use crate::models::pretty_syntax::PasteIdSyntax;
use crate::models::paste_id::PasteId;
use crate::models::pretty_syntax::PasteIdSyntax;
#[get("/<id>", rank = 2)]
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()
}

View File

@@ -18,7 +18,6 @@ pub async fn upload(paste: Data<'_>) -> Result<String, std::io::Error> {
.contains("text")
{
true => format!("/p/{id}", id = id),
false => format!("/{id}", id = id),
};