firebreak/web/app/templates/setup.html

133 lines
6.9 KiB
HTML

{% extends "base.html" %}
{% block title %}{{ "Reconfigure" if reconfiguring else "Setup" }} — Firebreak{% endblock %}
{% block body_class %}landing-page{% endblock %}
{% block main_class %}{% endblock %}
{% block content %}
<section class="flex min-h-dvh items-center justify-center px-6 py-20">
<div class="w-full max-w-lg">
<div class="mb-8 text-center">
<img src="/static/img/firebreak-brand.svg"
alt="Firebreak"
width="240"
height="268"
class="mx-auto h-auto w-full max-w-24" />
<h1 class="mt-6 text-2xl font-semibold text-[#f7f2e8]">
{{ "Reconfigure" if reconfiguring else "Setup" }}
</h1>
{% if reconfiguring %}
<p class="mt-2 text-sm leading-6 text-[#f7f2e8]/60">
Update your Forgejo OAuth connection. Make sure the OAuth application
is registered in your Forgejo instance before continuing.
</p>
{% else %}
<p class="mt-2 text-sm leading-6 text-[#f7f2e8]/60">
Connect Firebreak to your Forgejo instance. You'll need to
<a href="https://forgejo.org/docs/latest/user/oauth2-provider/"
target="_blank"
rel="noopener"
class="underline underline-offset-2 text-[#f7f2e8]/80 hover:text-[#f7f2e8]">register an OAuth application</a>
in Forgejo first.
</p>
{% endif %}
</div>
{% if not reconfiguring %}
<div class="mb-8 rounded-lg border border-[#f7f2e8]/10 bg-[#1f2226]/60 px-5 py-4 text-xs leading-5 text-[#f7f2e8]/50">
<p class="font-medium text-[#f7f2e8]/70 mb-2.5">How to get your OAuth credentials:</p>
<ol class="list-decimal list-inside space-y-1.5">
<li>
In Forgejo, go to <strong class="text-[#f7f2e8]/70">Settings &rarr; Applications</strong>
</li>
<li>
Under <strong class="text-[#f7f2e8]/70">Manage OAuth2 Applications</strong>, create a new app
</li>
<li>
Set the redirect URI to
<br />
<code class="mt-1 inline-block rounded bg-[#f7f2e8]/8 px-1.5 py-0.5 font-mono text-[10px] text-[#f7f2e8]/60">{{ oauth_callback_url }}</code>
</li>
<li>
Copy the <strong class="text-[#f7f2e8]/70">Client ID</strong> and <strong class="text-[#f7f2e8]/70">Client Secret</strong> into the form below
</li>
</ol>
</div>
{% endif %}
<form method="post" action="/setup" class="space-y-5">
{% if not reconfiguring %}
<div>
<label for="setup_token"
class="block text-xs font-semibold uppercase tracking-[0.05em] text-[#f7f2e8]/50 mb-1.5">
Setup Token
</label>
<input type="password"
id="setup_token"
name="setup_token"
class="block w-full rounded-md border border-[#f7f2e8]/14 bg-[#1f2226] px-3 py-2.5 font-mono text-sm text-[#f7f2e8] placeholder:text-[#f7f2e8]/30 focus:border-[#f7f2e8]/30 focus:outline-none focus:ring-2 focus:ring-[#f7f2e8]/10"
placeholder="Paste the token from your server logs"
required />
<p class="mt-1.5 text-xs text-[#f7f2e8]/30">Printed to the server console on first boot.</p>
</div>
{% endif %}
<div>
<label for="forgejo_base_url"
class="block text-xs font-semibold uppercase tracking-[0.05em] text-[#f7f2e8]/50 mb-1.5">
Forgejo Instance URL
</label>
<input type="url"
id="forgejo_base_url"
name="forgejo_base_url"
class="block w-full rounded-md border border-[#f7f2e8]/14 bg-[#1f2226] px-3 py-2.5 text-sm text-[#f7f2e8] placeholder:text-[#f7f2e8]/30 focus:border-[#f7f2e8]/30 focus:outline-none focus:ring-2 focus:ring-[#f7f2e8]/10"
placeholder="https://git.example.com"
value="{{ forgejo_base_url }}"
required />
</div>
<div>
<label for="forgejo_oauth_client_id"
class="block text-xs font-semibold uppercase tracking-[0.05em] text-[#f7f2e8]/50 mb-1.5">
OAuth Client ID
</label>
<input type="text"
id="forgejo_oauth_client_id"
name="forgejo_oauth_client_id"
class="block w-full rounded-md border border-[#f7f2e8]/14 bg-[#1f2226] px-3 py-2.5 font-mono text-sm text-[#f7f2e8] placeholder:text-[#f7f2e8]/30 focus:border-[#f7f2e8]/30 focus:outline-none focus:ring-2 focus:ring-[#f7f2e8]/10"
placeholder="c8ab3315-537d-44f3-..."
value="{{ forgejo_oauth_client_id }}"
required />
</div>
<div>
<label for="forgejo_oauth_client_secret"
class="block text-xs font-semibold uppercase tracking-[0.05em] text-[#f7f2e8]/50 mb-1.5">
OAuth Client Secret
{% if reconfiguring %}
<span class="ml-1 normal-case tracking-normal font-normal text-[#f7f2e8]/30">(leave blank to keep current)</span>
{% endif %}
</label>
<input type="password"
id="forgejo_oauth_client_secret"
name="forgejo_oauth_client_secret"
class="block w-full rounded-md border border-[#f7f2e8]/14 bg-[#1f2226] px-3 py-2.5 font-mono text-sm text-[#f7f2e8] placeholder:text-[#f7f2e8]/30 focus:border-[#f7f2e8]/30 focus:outline-none focus:ring-2 focus:ring-[#f7f2e8]/10"
placeholder="gto_wkxxnv4ewa..."
{{ "" if reconfiguring else "required" }} />
</div>
<div>
<label for="firebreak_public_base_url"
class="block text-xs font-semibold uppercase tracking-[0.05em] text-[#f7f2e8]/50 mb-1.5">
Public Base URL
<span class="ml-1 normal-case tracking-normal font-normal text-[#f7f2e8]/30">(optional)</span>
</label>
<input type="url"
id="firebreak_public_base_url"
name="firebreak_public_base_url"
class="block w-full rounded-md border border-[#f7f2e8]/14 bg-[#1f2226] px-3 py-2.5 text-sm text-[#f7f2e8] placeholder:text-[#f7f2e8]/30 focus:border-[#f7f2e8]/30 focus:outline-none focus:ring-2 focus:ring-[#f7f2e8]/10"
placeholder="https://share.example.com"
value="{{ firebreak_public_base_url }}" />
<p class="mt-1.5 text-xs text-[#f7f2e8]/30">
Your production domain for OAuth redirects. Leave blank on localhost &mdash; Firebreak will use <code class="font-mono text-[#f7f2e8]/40">http://localhost:8000</code> automatically.
</p>
</div>
<button type="submit" class="btn btn-primary w-full mt-2">
{{ "Save Forgejo settings" if reconfiguring else "Complete Setup" }}
</button>
</form>
</div>
</section>
{% endblock %}