diff --git a/src/main.rs b/src/main.rs index 21d024d..169225f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -61,12 +61,7 @@ async fn svc(tcp: TcpListener, app: Router) { } #[derive(Template)] -#[template( - path = "index.hbs", - escape = "html", - whitespace = "suppress", - ext = "html" -)] +#[template(path = "index.hbs", escape = "html", ext = "html")] pub struct IndexPage { root_dns_name: Arc, ip: IpAddr, diff --git a/templates/index.hbs b/templates/index.hbs index e7a8b3c..e019a6b 100644 --- a/templates/index.hbs +++ b/templates/index.hbs @@ -1,80 +1,80 @@ -{% set scheme %} -{% if https %} -{% let scheme = "https" %} -{% else %} -{% let scheme = "http" %} -{% endif %} -{% let description = "A simple, fast website to return your IPv4 and IPv6 addresses. No logs are kept. Free and open to all." %} +{%- set scheme -%} +{%- if https -%} + {%- let scheme = "https" -%} +{%- else -%} + {%- let scheme = "http" -%} +{%- endif -%} +{%- let description = "A simple, fast website to return your IPv4 and IPv6 addresses. No logs are kept. Free and open to all." -%} - - + + - {% match ip %} - {% when IpAddr::V4 with (_) %} - - {% when IpAddr::V6 with (_) %} - - {% endmatch %} - - + {%- match ip -%} + {%- when IpAddr::V4 with (_) -%} + + {%- when IpAddr::V6 with (_) -%} + + {%- endmatch -%} + + - - - - - - - {% match ip %} - {% when IpAddr::V4 with (ipv4) %} - Your public IP is {{ ipv4 }} - {% when IpAddr::V6 with (_) %} - What's my IP? - {% endmatch %} + + + + + + + {%- match ip -%} + {%- when IpAddr::V4 with (ipv4) -%} + Your public IP is {{ ipv4 }} + {%- when IpAddr::V6 with (_) -%} + What's my IP? + {%- endmatch -%} - + - -
- {% match ip %} - {% when IpAddr::V4 with (ipv4) %} -
- Your public IPv4 is: {{ ipv4 }} -
- - {% when IpAddr::V6 with (ipv6) %} - -
- Your public IPv6 is: {{ ipv6 }} + +
+ {%- match ip -%} + {%- when IpAddr::V4 with (ipv4) -%} +
+ Your public IPv4 is: {{ ipv4 }} +
+ + {%- when IpAddr::V6 with (ipv6) -%} + +
+ Your public IPv6 is: {{ ipv6 }} +
+ {%- endmatch -%}
- {% endmatch %} -
- +