{% extends 'base.html' %}
{% load i18n %}
{% load static %}

{% block title %}{% trans 'Check domain' %}{% endblock title %}

{% block content %}

<div class="container">

  <h1>{% trans 'Check domain' %}</h1>

  {% if form.errors %}
    <p class="error">{% trans "Please correct errors below:" %}<br>
      {% if form.openid_identifier.errors %}
        {{ form.openid_identifier.errors|join:', ' }}
      {% endif %}
      {% if form.next.errors %}
        {{ form.next.errors|join:', ' }}
      {% endif %}
    </p>
  {% endif %}

  <div style="max-width:640px">
    <form method="post" name="lookup">
      {% csrf_token %}

      <div class="form-group"><label for="id_domain">{% trans 'Domain' %}</label>
        <input type="text" name="domain" maxlength="254" minlength="6" class="form-control" placeholder="{% trans 'Domain' %}" {% if form.domain.value %} value="{{ form.domain.value }}" {% endif %} id="id_domain">
      </div>
      <div class="form-group">
        <button type="submit" class="button">{% trans 'Check' %}</button>
      </div>
    </form>
  </div>

  {% if result %}
    <hr/>
    <h2>The following servers will be used for your domain</h2>
<div class="panel panel-tortin" style="width:intrinsic;margin-left:30px;float:left">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa-solid fa-unlock-keyhole"></i>&nbsp;HTTP Server</h3>
</div>
<div class="panel-body">
{% if result.avatar_server_http %}
<a href="http://{{result.avatar_server_http}}">
<h4 style="text-transform: none;">http://{{result.avatar_server_http}}</h4>
</a>
{% if result.avatar_server_http_ipv4 %}
<br><center>{{ result.avatar_server_http_ipv4 }}</center>
{% endif %}
{% if result.avatar_server_http_ipv6 %}
<br><center>{{ result.avatar_server_http_ipv6 }}</center>
{% endif %}
{% else %}
<a href="http://cdn.libravatar.org">
<h4 style="text-transform: none;">http://cdn.libravatar.org</h4>
</a>
{% endif %}
</div>
</div>
<div class="panel panel-tortin" style="width:intrinsic;margin-left:30px;float:left">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa-solid fa-lock"></i>&nbsp;HTTPS Server</h3>
</div>
<div class="panel-body">
{% if result.avatar_server_https %}
<a href="https://{{result.avatar_server_https}}">
<h4 style="text-transform: none;">https://{{result.avatar_server_https}}</h4>
</a>
{% if result.avatar_server_https_ipv4 %}
<br><center>{{ result.avatar_server_https_ipv4 }}</center>
{% endif %}
{% if result.avatar_server_https_ipv6 %}
<br><center>{{ result.avatar_server_https_ipv6 }}</center>
{% endif %}
{% else %}
<a href="https://seccdn.libravatar.org">
<h4 style="text-transform: none;">https://seccdn.libravatar.org</h4>
</a>
{% endif %}
</div>
</div>
  {% endif %}
</div>
<div style="height:40px"></div>
{% endblock content %}
