fn controller_page(port: u16) -> Result<String> {
    let host = gethostname::gethostname();
    let host = host
        .to_str()
        .ok_or_else(|| format_err!("Invalid hostname {:?}", host))?;
    let url = format!("ws://{}:{}/websocket", host, port);

    Ok(HtmlPage::new()
        .add_title("Sphrosyne Controller")
        .add_meta(vec![
            ("charset", "utf8"),
            ("viewport", "width=device-width, initial-scale=1.0"),
        ])
        .add_style(include_str!("style.css"))
        // We pass in our websocket URL as a hidden input on the page so our javascript can retrieve it
        .add_raw(format_args!(
            r#"<input type="hidden" id="url" value="{}">"#,
            url
        ))
        .add_script_literal(include_str!("controller.js"))
        .to_html_string())
}
// Return the HTML of the controller page
Return the HTML of the controller page
Return the HTML of the controller page
fn controller_page(port: u16) -> Result<String> {
    let host = gethostname::gethostname();
    let host = host
        .to_str()
        .ok_or_else(|| format_err!("Invalid hostname {:?}", host))?;
    let url = format!("ws://{}:{}/websocket", host, port);
    Ok(HtmlPage::new()
        .add_title("Sphrosyne Controller")
        .add_meta(vec![
            ("charset", "utf8"),
            ("viewport", "width=device-width, initial-scale=1.0"),
        ])
        .add_style(include_str!("style.css"))
        // We pass in our websocket URL as a hidden input on the page so our javascript can retrieve it
        .add_raw(format_args!(
            r#"<input type="hidden" id="url" value="{}">"#,
            url
        ))
        .add_script_literal(include_str!("controller.js"))
        .to_html_string())
}
fn controller_page ( port : u16 ) -> Result < String > { let host = gethostname :: gethostname ( ) ; let host = host . to_str ( ) . ok_or_else ( | | format_err ! ( " " host ) ) ? ; let url = format ! ( " " host port ) ; Ok ( HtmlPage :: new ( ) . add_title ( " " ) . add_meta ( vec ! [ ( " " " " ) ( " " " " ) ] ) . add_style ( include_str ! ( " " ) ) // We pass in our websocket URL as a hidden input on the page so our javascript can retrieve it . add_raw ( format_args ! ( r#"<input type="hidden" id="url" value="{}">"# url ) ) . add_script_literal ( include_str ! ( " " ) ) . to_html_string ( ) ) }
Return the HTML of the controller page
Return the HTML of the controller page
port
u16
port
u16