{% extends "swan/components/base.jinja" %}

{% block main %}
    <div class="flex">
        <h1>Swan Plugin </h1>
    </div>

    {% if not specter_hostname_supported %}
        <div class="flex p-4 mt-3 mb-4 bg-dark-600 rounded-lg">
            <svg class="flex-shrink-0 inline w-6 h-6 mr-3" version="1.1" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><!--Generated by IJSVG (https://github.com/iconjar/IJSVG)--><path d="M32.0022,55.9844l-1.04907e-06,-2.84217e-14c-13.2548,-5.79387e-07 -24,-10.7452 -24,-24c5.79387e-07,-13.2548 10.7452,-24 24,-24c13.2548,5.79387e-07 24,10.7452 24,24l2.13163e-14,-1.04907e-06c0,13.2548 -10.7452,24 -24,24Zm1.5,-32l3.82016e-08,-2.71086e-09c-1.79133,0.127116 -3.35165,-1.21031 -3.5,-3l6.50646e-08,-7.8524e-07c0.148296,-1.78972 1.70866,-3.12717 3.5,-3l-5.85322e-09,4.15529e-10c1.79134,-0.127171 3.3517,1.21028 3.5,3l-5.57104e-08,6.72365e-07c-0.148295,1.78976 -1.70872,3.12723 -3.5001,3Zm1.4206,6.7635l-2.7853,10.5093l-8.37179e-08,3.15667e-07c-0.270677,1.02062 0.262417,2.08281 1.2425,2.4757l-5.91015e-08,-2.36708e-08c0.379505,0.151996 0.628277,0.519688 0.6282,0.9285v0.323l8.52651e-14,4.05e-07c0,0.551933 -0.447167,0.999503 -0.9991,1h-2.9891l-4.04477e-08,1.96948e-10c-1.65938,0.00807986 -3.01111,-1.33056 -3.01919,-2.98993c-0.00127082,-0.260991 0.0314695,-0.521035 0.0973943,-0.773566l2.7852,-10.5094l2.79671e-08,-1.05468e-07c0.270652,-1.02067 -0.262537,-2.08289 -1.2427,-2.4757l-2.20542e-08,-8.83296e-09c-0.379505,-0.151996 -0.628276,-0.519688 -0.6282,-0.9285v-0.3229l-1.77636e-14,-9.40042e-08c-8.33514e-08,-0.552011 0.447289,-0.999614 0.9993,-1h2.9887l1.06497e-07,-5.28143e-10c1.65943,-0.00822943 3.01133,1.33033 3.01956,2.98976c0.00129458,0.261047 -0.0314356,0.52115 -0.0973639,0.773738Z" fill="currentColor" fill-rule="evenodd"></path></svg>
            <span class="sr-only">Info</span>
            {% if specter_used_hostname == "umbrel.local:25441" %}
                <div>Unfortunately, the Swan plugin currently only works with localhost as hostname. It looks like you're using Specter on Umbrel. You could run Specter locally, use Spectrum and connect via Tor to your Electrum server on Umbrel. With this setup you could use the Swan plugin.</div>
            {% else %}
                <div>Unfortunately, the Swan plugin currently only works with localhost as hostname. You are using right now: {{ specter_used_hostname }}.</div>
            {% endif %}
            {# <p>{{ _("Unfortunately the Swan plugin does not support this. The only supported hostnames are:") }}</p>
            <ul>
                {% for hostname in allowed_specter_hostnames %}
                <li>{{ hostname }}</li>
                {% endfor %}
            </ul>  #}
        </div>
    {% else %}
        <div class="flex items-center mt-6 mb-10 gap-2">
            <div class="flex items-center gap-2">
                <img src="{{ url_for(service.id +'_endpoint' + '.static', filename=service.icon) }}" width="32"/>
                <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-circle-plus" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
                    <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
                    <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path>
                    <path d="M9 12l6 0"></path>
                    <path d="M12 9l0 6"></path>
                </svg>
                <img src="{{ url_for('static', filename='img/favicon-dark-mode.png') }}" style="width: 32px;"/> 
            </div>
                Auto-withdraw from Swan straight into your Specter wallet
        </div>
        <div class="lg:flex gap-2 justify-end">
            <a class="button" onclick="location.href='{{ url_for(service.id +'_endpoint.oauth2_start') }}';">
                Existing Swan users
            </a>
            <a class="button bg-accent" href="{{ swan_frontend_url }}" target="_swan">
                <div class="flex items-center gap-1">
                    Join Swan! $10 free Bitcoin
                    <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-gift" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
                        <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
                        <path d="M3 8m0 1a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1z"></path>
                        <path d="M12 8l0 13"></path>
                        <path d="M19 12v7a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-7"></path>
                        <path d="M7.5 8a2.5 2.5 0 0 1 0 -5a4.8 8 0 0 1 4.5 5a4.8 8 0 0 1 4.5 -5a2.5 2.5 0 0 1 0 5"></path>
                    </svg>
                </div>
            </a>
        </div>
        <p class="p-4 mt-10 bg-dark-600 rounded-lg">
            Swan is a regulated exchange that is required to comply with KYC regulations. As such, they must collect personal information from users and may be legally obligated to share that data with government agencies.
            Be aware of the privacy tradeoffs inherent to KYC services. 
            Read: <a class="text-lg" href="https://www.swanbitcoin.com/bitcoin-privacy-best-practices/" target="_blank" title="Bitcoin Privacy Guide" alt="Privacy Guide link">Bitcoin Privacy</a>
        </p>
    {% endif %}  
{% endblock %}

{% block scripts %}
{% endblock %}