Skip to content

Commit

Permalink
Fix title whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
randomairborne committed Mar 31, 2024
1 parent e21d3a5 commit 4045b97
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 74 deletions.
7 changes: 1 addition & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<str>,
ip: IpAddr,
Expand Down
136 changes: 68 additions & 68 deletions templates/index.hbs
Original file line number Diff line number Diff line change
@@ -1,80 +1,80 @@
<!doctype html>
{% 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." -%}
<html lang="en">
<head>
<meta charset="UTF-8"/>
<head>
<meta charset="UTF-8" />
<link
rel="preload"
href="{{ scheme }}://{{ root_dns_name }}/main.js"
as="script"
rel="preload"
href="{{ scheme }}://{{ root_dns_name }}/main.js"
as="script"
/>
{% match ip %}
{% when IpAddr::V4 with (_) %}
<link
rel="preload"
href="{{ scheme }}://v6.{{ root_dns_name }}/raw"
as="fetch"
crossorigin="anonymous"
/>
{% when IpAddr::V6 with (_) %}
<link
rel="preload"
href="{{ scheme }}://v4.{{ root_dns_name }}/raw"
as="fetch"
crossorigin="anonymous"
/>
{% endmatch %}
<link rel="stylesheet" href="{{ scheme }}://{{ root_dns_name }}/main.css"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
{%- match ip -%}
{%- when IpAddr::V4 with (_) -%}
<link
rel="preload"
href="{{ scheme }}://v6.{{ root_dns_name }}/raw"
as="fetch"
crossorigin="anonymous"
/>
{%- when IpAddr::V6 with (_) -%}
<link
rel="preload"
href="{{ scheme }}://v4.{{ root_dns_name }}/raw"
as="fetch"
crossorigin="anonymous"
/>
{%- endmatch -%}
<link rel="stylesheet" href="{{ scheme }}://{{ root_dns_name }}/main.css" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta
name="root-dns-name"
id="root-dns-name"
data-dns-name="{{ root_dns_name }}"
name="root-dns-name"
id="root-dns-name"
data-dns-name="{{ root_dns_name }}"
/>
<meta name="scheme" id="scheme" data-scheme="{{ scheme }}"/>
<meta name="description" content="{{ description }}"/>
<meta property="og:title" content="GiveIP"/>
<meta property="og:url" content="{{ scheme }}://{{ root_dns_name }}/"/>
<meta property="og:description" content="{{ description }}"/>
<link rel="canonical" href="{{ scheme }}://{{ root_dns_name }}/"/>
{% match ip %}
{% when IpAddr::V4 with (ipv4) %}
<title id="title">Your public IP is {{ ipv4 }}</title>
{% when IpAddr::V6 with (_) %}
<title id="title">What's my IP?</title>
{% endmatch %}
<meta name="scheme" id="scheme" data-scheme="{{ scheme }}" />
<meta name="description" content="{{ description }}" />
<meta property="og:title" content="GiveIP" />
<meta property="og:url" content="{{ scheme }}://{{ root_dns_name }}/" />
<meta property="og:description" content="{{ description }}" />
<link rel="canonical" href="{{ scheme }}://{{ root_dns_name }}/" />
{%- match ip -%}
{%- when IpAddr::V4 with (ipv4) -%}
<title id="title">Your public IP is {{ ipv4 }}</title>
{%- when IpAddr::V6 with (_) -%}
<title id="title">What's my IP?</title>
{%- endmatch -%}
<script src="{{ scheme }}://{{ root_dns_name }}/main.js" defer></script>
<script
defer
src="https://static.cloudflareinsights.com/beacon.min.js"
data-cf-beacon='{"token": "872609be4c924b219e5de38a6e0b26a0"}'
defer
src="https://static.cloudflareinsights.com/beacon.min.js"
data-cf-beacon='{"token": "872609be4c924b219e5de38a6e0b26a0"}'
></script>
</head>
</head>

<body>
<div class="stack">
{% match ip %}
{% when IpAddr::V4 with (ipv4) %}
<div id="ip4txt">
Your public IPv4 is: <code id="ip4">{{ ipv4 }}</code>
</div>
<div id="ip6txt" hidden>
Your public IPv6 is: <code id="ip6">(fetching)</code>
</div>
{% when IpAddr::V6 with (ipv6) %}
<div id="ip4txt" hidden>
Your public IPv4 is: <code id="ip4">(fetching)</code>
</div>
<div id="ip6txt">
Your public IPv6 is: <code id="ip6">{{ ipv6 }}</code>
<body>
<div class="stack">
{%- match ip -%}
{%- when IpAddr::V4 with (ipv4) -%}
<div id="ip4txt">
Your public IPv4 is: <code id="ip4">{{ ipv4 }}</code>
</div>
<div id="ip6txt" hidden>
Your public IPv6 is: <code id="ip6">(fetching)</code>
</div>
{%- when IpAddr::V6 with (ipv6) -%}
<div id="ip4txt" hidden>
Your public IPv4 is: <code id="ip4">(fetching)</code>
</div>
<div id="ip6txt">
Your public IPv6 is: <code id="ip6">{{ ipv6 }}</code>
</div>
{%- endmatch -%}
</div>
{% endmatch %}
</div>
</body>
</body>
</html>

0 comments on commit 4045b97

Please sign in to comment.