<!--
SPDX-FileCopyrightText: 2023 Helge

SPDX-License-Identifier: MIT
-->

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title>Actor Verification Result for {{actor_uri}}</title>
    <link rel="stylesheet" href="static/styles.css">
    <link rel="icon" href="static/icon.svg">
    <meta name="description"
        content="Result for if {{actor_uri}} is an actor that interoperates well with the Fediverse">
    <meta property="og:title" content="Verify your Fediverse Actor" />
    <meta property="og:type" content="website" />
    <meta property="og:url" content="https://verify.funfedi.dev/" />
    <meta property="og:image" content="https://funfedi.dev/assets/FediverseLogo.png" />
</head>

<body>
    <main>
        <h1>Actor Verification Result</h1>
        <form action="/" method="GET">
            <label for="actor_uri">Actor URI to verify</label>
            <input type="text" name="actor_uri" id="actor_uri" value="{{actor_uri}}" />
            <details {% if has_restriction %} open {% endif %}>
                <summary>Options</summary>
                Selecting any of the options will cause only the selected options to be run.
                <ul>
                    {% for name in test_actors %}
                    <li><input type="checkbox" id="only_{{name}}" name="only_{{name}}" {% if only[name] %} checked
                            {%endif%} /><label for="only_{{name}}">
                            Run for {{name}}</label>
                    </li>
                    {% endfor %}
                </ul>
            </details>
            <input type="submit" value="Verify" />
        </form>

        {% if has_warnings %}

        <h2>🚨 Warnings 🚨</h2>
        <ul>
            {% for warning in warnings %}
            <li>{{warning}}</li>
            {% endfor %}
        </ul>

        {% endif %}

        <h2>Result for Actor Personas</h2>

        <p>A description of these actor personas can be found <a
                href="https://funfedi.dev/testing_tools/verify_actor/#actor-personas">here</a>.</p>


        <table>
            <tr>
                <th>Name</th>
                <th>GET Actor</th>
                <th>POST Inbox</th>
            </tr>


            {% if "alice" in result %}
            {% if result["alice"]["warning"] %}<tr class="warning"> {% else %}
            <tr> {% endif %}
                <td>Alice<br />
                    <ul class="remarks">
                        <li>uses unsigned GET and POST requests</li>
                    </ul>
                </td>
                <td>{% if result["alice"]["get_actor"] %} ✔️ {% endif %}</td>
                <td>{% if result["alice"]["post_inbox"] %} <b>❌ Can post to inbox </b><br />
                    <ul class="remarks">
                        <li>successful inbox post with <b>unsigned</b> request</li>
                    </ul> {%
                    endif %}
                </td>
            </tr>
            {% endif %}
            {% if "bob" in result %}

            {% if result["bob"]["warning"] %}<tr class="warning"> {% else %}
            <tr> {% endif %}
                <td>Bob<br />
                    <ul class="remarks">
                        <li>uses <b>signed</b> GET and POST requests</li>
                    </ul>
                </td>
                <td>{% if result["bob"]["get_actor"] %} ✔️ {% else %} <b>❌ Cannot get actor</b>
                    <ul class="remarks">
                        <li>signed requests should be able to retrieve the actor</li>
                    </ul> {% endif %}
                </td>
                <td>{% if result["bob"]["post_inbox"] %} ✔️ {% else %} <b>❌ Cannot post to inbox</b>
                    <ul class="remarks">
                        <li>signed requests should be able to post to inbox</li>
                    </ul> {% endif %}
                </td>
            </tr>
            {% endif %}

            {% if "claire" in result %}
            {% if result["claire"]["warning"] %}<tr class="warning"> {% else %}
            <tr> {% endif %}
                <td>Claire<br />
                    <ul class="remarks">
                        <li>uses <b>signed</b> GET and POST requests</li>
                        <li>GET actor requires <b>signed</b> request</li>
                    </ul>
                </td>
                <td>{% if result["claire"]["get_actor"] %} ✔️ {% else %} <b>❌ Cannot get actor</b>
                    <ul class="remarks">
                        <li>if this fails and succeeds for Bob, check your key retrieval uses a signed request</li>
                    </ul> {% endif %}
                </td>
                <td>{% if result["claire"]["post_inbox"] %} ✔️ {% else %} <b>❌ Cannot post to inbox</b>
                    <ul class="remarks">
                        <li>if this fails and succeeds for Bob, check your key retrieval uses a signed request</li>
                    </ul>{% endif %}
                </td>
            </tr>
            {% endif %}
            {% if "dean" in result %}
            {% if result["dean"]["warning"] %}<tr class="warning"> {% else %}
            <tr> {% endif %}
                <td>Dean<br />
                    <ul class="remarks">
                        <li>as Alice not resolved by webfinger</li>
                    </ul>
                </td>
                <td>{% if result["dean"]["get_actor"] %} ✔️ {% endif %}</td>
                <td>{% if result["dean"]["post_inbox"] %} <b>❌ Can post to inbox </b><br />
                    <ul class="remarks">
                        <li>successful inbox post with <b>unsigned</b> request</li>
                    </ul> {%
                    endif %}
                </td>
            </tr>
            {% endif %}
            {% if "emily" in result %}
            {% if result["emily"]["warning"] %}<tr class="warning"> {% else %}
            <tr> {% endif %}
                <td>Emily<br />
                    <ul class="remarks">
                        <li>as Bob not resolved by webfinger</li>
                    </ul>
                </td>
                <td>{% if result["emily"]["get_actor"] %} ✔️ {% else %} <b>Cannot get actor</b> {% endif %}</td>
                <td>{% if result["emily"]["post_inbox"] %} ✔️ {% else %} <b>Cannot post to inbox</b> {% endif %}</td>
            </tr>
            {% endif %}
            {% if "frank" in result %}
            {% if result["frank"]["warning"] %}<tr class="warning"> {% else %}
            <tr> {% endif %}
                <td>Frank<br />
                    <ul class="remarks">
                        <li>as Claire not resolved by webfinger</li>
                    </ul>
                </td>
                <td>{% if result["frank"]["get_actor"] %} ✔️ {% else %} <b>Cannot get actor</b> {% endif %}</td>
                <td>{% if result["frank"]["post_inbox"] %} ✔️ {% else %} <b>Cannot post to inbox</b> {% endif %}</td>
            </tr>
            {% endif %}

        </table>


        <h2>Processing log</h2>

        <pre>{{messages}}</pre>
    </main>
</body>

</html>