2.2 KiB · text History 63417ef
{% extends "root.html" %}

{% block content %}
<div class="space-y-6 text-left max-w-2xl">
  <h2 class="text-2xl font-bold text-accent">Pair a device{% if label %}: {{ label }}{% endif %}</h2>

  <div class="alert alert-warning text-sm">
    <i class="fas fa-triangle-exclamation"></i>
    <span>This code is shown once. Leave this page and it can't be shown again &mdash; pair a new device instead.</span>
  </div>

  <div class="card bg-base-200 p-4 space-y-4">
    <p class="text-sm">
      In the app, tap <strong>Scan QR</strong> and point the phone at this.
      Opening the code from the phone's own camera or browser works too: the
      app handles <code class="text-xs">recourse://</code> links and opens with
      both fields filled in.
    </p>

    {% if qr_svg %}
    <div class="bg-white p-3 rounded-box w-fit mx-auto">{{ qr_svg }}</div>
    {% else %}
    <p class="text-sm text-error">Couldn't draw the QR code &mdash; copy the fields below by hand.</p>
    {% endif %}

    <div class="space-y-2">
      <label class="flex flex-col">
        <span class="text-xs">Server URL</span>
        <input class="input input-sm font-mono text-xs" readonly value="{{ base_url }}" onclick="this.select()"/>
      </label>
      <label class="flex flex-col">
        <span class="text-xs">Token</span>
        <input class="input input-sm font-mono text-xs" readonly value="{{ token }}" onclick="this.select()"/>
      </label>
      <label class="flex flex-col">
        <span class="text-xs">Pairing link</span>
        <input class="input input-sm font-mono text-xs" readonly value="{{ pair_uri }}" onclick="this.select()"/>
      </label>
    </div>

    <p class="text-xs opacity-70">
      Paired from <code>{{ base_url }}</code>: the phone has to be able to reach
      that address. If it says <code>localhost</code>, type the address the
      phone can use instead. The device stays signed in while it's used, and
      is signed out after {{ sliding_days }} days without. Anyone holding this
      token can read and post as <strong>{{ user.username }}</strong>.
    </p>
  </div>

  <a href="/devices" class="btn btn-ghost btn-sm"><i class="fas fa-arrow-left mr-1"></i> Back to devices</a>
</div>
{% endblock %}