fn index_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!("http://{}:{}/controller", host, port);

    Ok(HtmlPage::new()
        .add_title("Sphrosyne")
        .add_meta(vec![
            ("charset", "utf8"),
            ("viewport", "width=device-width, initial-scale=1.0"),
        ])
        .add_style(include_str!("style.css"))
        .add_paragraph("The server is running. Scan the following QR code to connect your device:")
        .add_image(qr_data_url(&url)?, url)
        .to_html_string())
}
/// Return the HTML of the index page
Return the HTML of the index page
Return the HTML of the index page
fn index_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!("http://{}:{}/controller", host, port);
    Ok(HtmlPage::new()
        .add_title("Sphrosyne")
        .add_meta(vec![
            ("charset", "utf8"),
            ("viewport", "width=device-width, initial-scale=1.0"),
        ])
        .add_style(include_str!("style.css"))
        .add_paragraph("The server is running. Scan the following QR code to connect your device:")
        .add_image(qr_data_url(&url)?, url)
        .to_html_string())
}
fn index_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 ! ( " " ) ) . add_paragraph ( " " ) . add_image ( qr_data_url ( & url ) ? , url ) . to_html_string ( ) ) }
Return the HTML of the index page
Return the HTML of the index page
port
u16
port
u16