/// Index page letting users upload via a UI
Index page letting users upload via a UI
Index page letting users upload via a UI
pub fn index(
    request: HttpRequest,
    identity: Identity,
    password_hash: web::Data<Vec<u8>>,
) -> impl Responder {
    if let Err(response) = auth(identity, request, &password_hash) {
        return response;
    }
    let contents = {
        #[cfg(feature = "dev")]
        {
            let html = fs::read_to_string(&*HTML_PATH).expect("Can't read index.html");
            let js = fs::read_to_string(&*JS_PATH).expect("Can't read script.js");
            let css = fs::read_to_string(&*CSS_PATH).expect("Can't read style.css");
            html.replace("{{ js }}", &js).replace("{{ css }}", &css)
        }
        #[cfg(not(feature = "dev"))]
        {
            INDEX_CONTENTS.clone()
        }
    };
    HttpResponse::Ok()
        .header("Content-Type", "text/html")
        .body(contents)
}
pub fn index ( request : HttpRequest , identity : Identity , password_hash : web :: Data < Vec < u8 > > , ) -> impl Responder { if let Err ( response ) = auth ( identity , request , & password_hash ) { return response ; } let contents = { # [ cfg ( feature " " ) ] { let html = fs :: read_to_string ( & * HTML_PATH ) . expect ( " " ) ; let js = fs :: read_to_string ( & * JS_PATH ) . expect ( " " ) ; let css = fs :: read_to_string ( & * CSS_PATH ) . expect ( " " ) ; html . replace ( " " , & js ) . replace ( " " , & css ) } # [ cfg ( not ( feature " " ) ) ] { INDEX_CONTENTS . clone ( ) } } ; HttpResponse :: Ok ( ) . header ( " " , " " ) . body ( contents ) }
Index page letting users upload via a UI
Index page letting users upload via a UI
request
HttpRequest
identity
Identity
password_hash
web::Data<Vec<u8>>