Commit 2cea8f97 authored by Zachary Dunn's avatar Zachary Dunn

Update Rocket to v0.4

Replace get_static_files route with Rocket's StaticFiles
parent 0534af4f
......@@ -82,8 +82,8 @@ dependencies = [
"log4rs 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"pest 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"pest_derive 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rocket 0.4.0-rc.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rocket_contrib 0.4.0-rc.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rocket 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rocket_contrib 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -805,7 +805,7 @@ dependencies = [
[[package]]
name = "rocket"
version = "0.4.0-rc.2"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"base64 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -814,8 +814,8 @@ dependencies = [
"memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pear 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rocket_codegen 0.4.0-rc.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rocket_http 0.4.0-rc.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rocket_codegen 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rocket_http 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"state 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -825,26 +825,26 @@ dependencies = [
[[package]]
name = "rocket_codegen"
version = "0.4.0-rc.2"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"devise 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
"rocket_http 0.4.0-rc.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rocket_http 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"yansi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rocket_contrib"
version = "0.4.0-rc.1"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"notify 4.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rocket 0.4.0-rc.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rocket 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
"tera 0.11.20 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -852,7 +852,7 @@ dependencies = [
[[package]]
name = "rocket_http"
version = "0.4.0-rc.2"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cookie 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -1443,10 +1443,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum regex 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ee84f70c8c08744ea9641a731c7fadb475bf2ecc52d7f627feb833e0b3990467"
"checksum regex-syntax 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fbc557aac2b708fe84121caf261346cc2eed71978024337e42eb46b8a252ac6e"
"checksum ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2c4db68a2e35f3497146b7e4563df7d4773a2433230c5e4b448328e31740458a"
"checksum rocket 0.4.0-rc.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eaa997ea8de9b14112aa38b2b6a0ecf3e651ff2c08d2fdf384fa765b5f9c2c98"
"checksum rocket_codegen 0.4.0-rc.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fc68f90452ac88c6c1e02a922a0a23ef0ade08f9af899056d0c919b25fa7768c"
"checksum rocket_contrib 0.4.0-rc.1 (registry+https://github.com/rust-lang/crates.io-index)" = "38cce3e4f0de0b950604c2a5cda4b3d74a7f17c62937cee54f4996b36c2d31a5"
"checksum rocket_http 0.4.0-rc.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c7d555ce896830602aedf4bce2eec8d64713d45a2492c5a3625c3faa5f719b0f"
"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_contrib 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f73e161dad5730435f51c815a5c6831d2e57b6b4299b1bf609d31b09aa9a2fa7"
"checksum rocket_http 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba9d4f2ce5bba6e1b6d3100493bbad63879e99bbf6b4365d61e6f781daab324d"
"checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395"
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
"checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7"
......
......@@ -18,7 +18,7 @@ default = ["store_in_flat_files"]
log = "0.4.6"
pest = "2.0"
pest_derive = "2.0"
rocket = "0.4.0-rc.2"
rocket = "0.4"
tera = "0.11"
time = "0.1"
serde = "1.0"
......@@ -33,7 +33,7 @@ default-features = false
features = [ "console_appender", "file", "file_appender", "pattern_encoder", "yaml_format" ]
[dependencies.rocket_contrib]
version = "0.4.0-rc.1"
version = "0.4"
default-features = false
features = [ "json", "tera_templates" ]
features = [ "json", "tera_templates", "serve" ]
......@@ -7,7 +7,10 @@ extern crate pest_derive;
use dotenv::dotenv;
use log4rs;
use rocket_contrib::templates::Template;
use rocket_contrib::{
serve::StaticFiles,
templates::Template,
};
pub mod activity_pub;
pub mod micropub;
......@@ -36,5 +39,6 @@ fn main() {
.mount("/photos", routes::photos::routes())
.mount("/likes", routes::likes::routes())
.mount("/boosts", routes::boosts::routes())
.mount("/public", StaticFiles::from("/public"))
.launch();
}
use crate::micropub::responders::MicropubResponse;
use rocket::{ response::NamedFile, get, post, routes, Route };
use std::path::{ Path, PathBuf };
use rocket::{ post, routes, Route };
pub fn routes() -> Vec<Route> {
routes![ get_static_file, upload_media ]
}
#[get("/public/<path..>")]
fn get_static_file(path: PathBuf) -> Option<NamedFile> {
NamedFile::open(Path::new("public/").join(path)).ok()
routes![ upload_media ]
}
#[post("/media")]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment