Remove dependency on ring
This commit is contained in:
parent
caa8c3568d
commit
c3b886c196
3 changed files with 37 additions and 64 deletions
73
Cargo.lock
generated
73
Cargo.lock
generated
|
@ -7,39 +7,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "askama"
|
||||
version = "0.8.0"
|
||||
source = "git+https://github.com/djc/askama?rev=fc5addc4#fc5addc456e93c3ae07fd35fbad0d14d578e5b3c"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"askama_derive 0.8.0 (git+https://github.com/djc/askama?rev=fc5addc4)",
|
||||
"askama_escape 0.2.0 (git+https://github.com/djc/askama?rev=fc5addc4)",
|
||||
"askama_shared 0.8.0 (git+https://github.com/djc/askama?rev=fc5addc4)",
|
||||
"rocket 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"askama_derive 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"askama_shared 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "askama_derive"
|
||||
version = "0.8.0"
|
||||
source = "git+https://github.com/djc/askama?rev=fc5addc4#fc5addc456e93c3ae07fd35fbad0d14d578e5b3c"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"askama_shared 0.8.0 (git+https://github.com/djc/askama?rev=fc5addc4)",
|
||||
"askama_shared 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"nom 4.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "askama_escape"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/djc/askama?rev=fc5addc4#fc5addc456e93c3ae07fd35fbad0d14d578e5b3c"
|
||||
|
||||
[[package]]
|
||||
name = "askama_shared"
|
||||
version = "0.8.0"
|
||||
source = "git+https://github.com/djc/askama?rev=fc5addc4#fc5addc456e93c3ae07fd35fbad0d14d578e5b3c"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"askama_escape 0.2.0 (git+https://github.com/djc/askama?rev=fc5addc4)",
|
||||
"humansize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -72,8 +63,7 @@ dependencies = [
|
|||
name = "bin"
|
||||
version = "1.0.1"
|
||||
dependencies = [
|
||||
"askama 0.8.0 (git+https://github.com/djc/askama?rev=fc5addc4)",
|
||||
"askama_escape 0.2.0 (git+https://github.com/djc/askama?rev=fc5addc4)",
|
||||
"askama 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gpw 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -131,8 +121,6 @@ name = "cookie"
|
|||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
@ -224,11 +212,6 @@ name = "httparse"
|
|||
version = "1.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "humansize"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "humantime"
|
||||
version = "1.2.0"
|
||||
|
@ -451,6 +434,14 @@ dependencies = [
|
|||
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "packed_simd"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pear"
|
||||
version = "0.1.2"
|
||||
|
@ -533,6 +524,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
dependencies = [
|
||||
"autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"packed_simd 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -648,17 +640,6 @@ dependencies = [
|
|||
"ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ring"
|
||||
version = "0.13.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cc 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rocket"
|
||||
version = "0.4.0"
|
||||
|
@ -886,11 +867,6 @@ dependencies = [
|
|||
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "untrusted"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "1.7.2"
|
||||
|
@ -976,10 +952,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[metadata]
|
||||
"checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c"
|
||||
"checksum askama 0.8.0 (git+https://github.com/djc/askama?rev=fc5addc4)" = "<none>"
|
||||
"checksum askama_derive 0.8.0 (git+https://github.com/djc/askama?rev=fc5addc4)" = "<none>"
|
||||
"checksum askama_escape 0.2.0 (git+https://github.com/djc/askama?rev=fc5addc4)" = "<none>"
|
||||
"checksum askama_shared 0.8.0 (git+https://github.com/djc/askama?rev=fc5addc4)" = "<none>"
|
||||
"checksum askama 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eed81479263c8753e06f4981f5a313b3fe6cbff30c3ff8d9ae15ef0c72d93fb5"
|
||||
"checksum askama_derive 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "46580c08e5520afadc6e9064759e15fc743489a4db78f9c751113e3d32a1e083"
|
||||
"checksum askama_shared 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "64509fd5c2fa767fa7ea973b732c61f0b8d30d1adf084e5164523e51a5e35d71"
|
||||
"checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799"
|
||||
"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e"
|
||||
"checksum base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643"
|
||||
|
@ -1002,7 +977,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
|
||||
"checksum gpw 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f0289c2eaf649918996197a6dde734d62414178a67a23f89f08610c6e8564e"
|
||||
"checksum httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e8734b0cfd3bc3e101ec59100e101c2eecd19282202e87808b3037b442777a83"
|
||||
"checksum humansize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b6cab2627acfc432780848602f3f558f7e9dd427352224b0d9324025796d2a5e"
|
||||
"checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114"
|
||||
"checksum hyper 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)" = "df0caae6b71d266b91b4a83111a61d2b94ed2e2bea024c532b933dcff867e58c"
|
||||
"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e"
|
||||
|
@ -1031,6 +1005,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a23f0ed30a54abaa0c7e83b1d2d87ada7c3c23078d1d87815af3e3b6385fbba"
|
||||
"checksum onig 4.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a646989adad8a19f49be2090374712931c3a59835cb5277b4530f48b417f26e7"
|
||||
"checksum onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0"
|
||||
"checksum packed_simd 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a85ea9fc0d4ac0deb6fe7911d38786b32fc11119afd9e9d38b84ff691ce64220"
|
||||
"checksum pear 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c26d2b92e47063ffce70d3e3b1bd097af121a9e0db07ca38a6cc1cf0cc85ff25"
|
||||
"checksum pear_codegen 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "336db4a192cc7f54efeb0c4e11a9245394824cc3bcbd37ba3ff51240c35d7a6e"
|
||||
"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
|
||||
|
@ -1054,7 +1029,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
|
||||
"checksum redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)" = "423e376fffca3dfa06c9e9790a9ccd282fafb3cc6e6397d01dbf64f9bacc6b85"
|
||||
"checksum regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8c2f35eedad5295fdf00a63d7d4b238135723f92b434ec06774dad15c7ab0861"
|
||||
"checksum ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2c4db68a2e35f3497146b7e4563df7d4773a2433230c5e4b448328e31740458a"
|
||||
"checksum rocket 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "242154377a85c2a9e036fc31ffc8c200b9e1f22a196e47baa3b57716606ca89d"
|
||||
"checksum rocket_codegen 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d907d6d458c859651c1cf4c8fa99b77685082bde0561db6a4600b365058f710"
|
||||
"checksum rocket_http 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba9d4f2ce5bba6e1b6d3100493bbad63879e99bbf6b4365d61e6f781daab324d"
|
||||
|
@ -1081,7 +1055,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426"
|
||||
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
||||
"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
|
||||
"checksum untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "55cd1f4b4e96b46aeb8d4855db4a7a9bd96eeeb5c6a1ab54593328761642ce2f"
|
||||
"checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a"
|
||||
"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
|
||||
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
||||
|
|
|
@ -6,14 +6,13 @@ edition = "2018"
|
|||
|
||||
[dependencies]
|
||||
linked-hash-map = "0.5"
|
||||
rocket = "0.4"
|
||||
askama = { git = "https://github.com/djc/askama", rev = "fc5addc4", features = ["with-rocket"] }
|
||||
askama_escape = { git = "https://github.com/djc/askama", rev = "fc5addc4" }
|
||||
rocket = { version = "0.4", default-features = false }
|
||||
askama = "0.7"
|
||||
lazy_static = "1.2"
|
||||
rand = "0.6"
|
||||
rand = { version = "0.6", features = ["nightly"] }
|
||||
gpw = "0.1"
|
||||
syntect = "3.0"
|
||||
serde_derive = { version = "1.0" }
|
||||
serde_derive = "1.0"
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
|
|
19
src/main.rs
19
src/main.rs
|
@ -8,7 +8,6 @@ extern crate lazy_static;
|
|||
extern crate rocket;
|
||||
|
||||
extern crate askama;
|
||||
extern crate askama_escape;
|
||||
|
||||
mod highlight;
|
||||
mod io;
|
||||
|
@ -18,8 +17,7 @@ use highlight::highlight;
|
|||
use io::{generate_id, get_paste, store_paste};
|
||||
use params::{HostHeader, IsPlaintextRequest};
|
||||
|
||||
use askama::Template;
|
||||
use askama_escape::{Html, MarkupDisplay};
|
||||
use askama::{MarkupDisplay, Template};
|
||||
|
||||
use rocket::http::{ContentType, Status};
|
||||
use rocket::request::Form;
|
||||
|
@ -35,11 +33,14 @@ use std::io::Read;
|
|||
|
||||
#[derive(Template)]
|
||||
#[template(path = "index.html")]
|
||||
struct Index {}
|
||||
struct Index;
|
||||
|
||||
#[get("/")]
|
||||
fn index() -> Index {
|
||||
Index {}
|
||||
fn index() -> Result<rocket::response::content::Html<String>, Status> {
|
||||
Index
|
||||
.render()
|
||||
.map(|h| rocket::response::content::Html(h))
|
||||
.map_err(|_| Status::InternalServerError)
|
||||
}
|
||||
|
||||
///
|
||||
|
@ -79,7 +80,7 @@ fn submit_raw(input: Data, host: HostHeader) -> std::io::Result<String> {
|
|||
#[derive(Template)]
|
||||
#[template(path = "paste.html")]
|
||||
struct ShowPaste {
|
||||
content: MarkupDisplay<Html, String>,
|
||||
content: MarkupDisplay<String>,
|
||||
}
|
||||
|
||||
#[get("/<key>")]
|
||||
|
@ -96,9 +97,9 @@ fn show_paste(key: String, plaintext: IsPlaintextRequest) -> Result<Content<Stri
|
|||
Ok(Content(ContentType::Plain, entry))
|
||||
} else {
|
||||
let content = match ext {
|
||||
None => MarkupDisplay::new_unsafe(entry, Html),
|
||||
None => MarkupDisplay::Unsafe(entry),
|
||||
Some(extension) => highlight(&entry, extension)
|
||||
.map(|h| MarkupDisplay::new_safe(h, Html))
|
||||
.map(|h| MarkupDisplay::Safe(h))
|
||||
.ok_or_else(|| Status::NotFound)?,
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue