diff --git a/build.rs b/build.rs deleted file mode 100644 index b30c3be..0000000 --- a/build.rs +++ /dev/null @@ -1,33 +0,0 @@ -use std::fs::File; -use std::io; -use std::path::{Path, PathBuf}; -use std::process::Command; -use zip::ZipWriter; - -fn main() { - let out_dir = PathBuf::from(std::env::var_os("OUT_DIR").unwrap()); - - let output = Command::new("cargo") - .args(["package", "--list", "--allow-dirty"]) - .output() - .unwrap(); - if !output.status.success() { - panic!("cargo package failed"); - } - - let mut writer = ZipWriter::new(File::create(out_dir.join("source.zip")).unwrap()); - for path in String::from_utf8(output.stdout).unwrap().lines() { - if path == "Cargo.toml.orig" { - continue; - } - - writer.start_file(path, Default::default()).unwrap(); - io::copy( - &mut File::open(Path::new(env!("CARGO_MANIFEST_DIR")).join(path)).unwrap(), - &mut writer, - ) - .unwrap(); - } - - writer.finish().unwrap(); -} diff --git a/src/main.rs b/src/main.rs index 3fd0655..76b266b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,7 +28,6 @@ fn rocket() -> _ { "/", routes![ instance, - trivial::code, trivial::copy_js, trivial::css, trivial::favicon_ico, diff --git a/src/trivial.rs b/src/trivial.rs index 56eb28a..66c4133 100644 --- a/src/trivial.rs +++ b/src/trivial.rs @@ -3,9 +3,9 @@ use crate::Html; use askama::Template; use rocket::form::{Form, FromForm}; -use rocket::http::{Header, Status}; +use rocket::http::Status; use rocket::response::content::{RawCss, RawJavaScript}; -use rocket::response::{status::NoContent, Redirect, Responder}; +use rocket::response::{status::NoContent, Redirect}; use rocket::{get, post, uri}; #[derive(Template)] @@ -33,24 +33,6 @@ pub(crate) fn instance_form(form: Form>) -> Redirect { ))) } -#[derive(Responder)] -#[response(content_type = "application/zip")] -pub(crate) struct Code { - zip: &'static [u8], - disposition: Header<'static>, -} - -#[get("/code")] -pub(crate) fn code() -> Code { - Code { - zip: include_bytes!(concat!(env!("OUT_DIR"), "/source.zip")), - disposition: Header::new( - "content-disposition", - r#"attachment; filename="emojos.in.zip""#, - ), - } -} - #[get("/static/site.css")] pub(crate) fn css() -> RawCss<&'static [u8]> { RawCss(include_bytes!("site.css"))