firebreak/web/app/templates/setup.html

128 lines
5.2 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="setup-shell">
<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="setup-logo" />
<h1 class="setup-title">{{ "Reconfigure" if reconfiguring else "Setup" }}</h1>
{% if reconfiguring %}
<p class="setup-copy">
Update your Forgejo OAuth connection. Make sure the OAuth application
is registered in your Forgejo instance before continuing.
</p>
{% else %}
<p class="setup-copy">
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="setup-link">register an OAuth application</a>
in Forgejo first.
</p>
{% endif %}
</div>
{% if not reconfiguring %}
<div class="setup-help-panel">
<p class="setup-help-title">How to get your OAuth credentials:</p>
<ol class="list-decimal list-inside space-y-1.5">
<li>
In Forgejo, go to <strong class="setup-strong">Settings &rarr; Applications</strong>
</li>
<li>
Under <strong class="setup-strong">Manage OAuth2 Applications</strong>, create a new app
</li>
<li>
Set the redirect URI to
<br />
<code class="setup-code">{{ oauth_callback_url }}</code>
</li>
<li>
Copy the <strong class="setup-strong">Client ID</strong> and <strong class="setup-strong">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="form-label">Setup Token</label>
<input type="password"
id="setup_token"
name="setup_token"
class="form-input form-input-mono"
placeholder="Paste the token from your server logs"
autocomplete="off"
spellcheck="false"
required />
<p class="form-hint">Printed to the server console on first boot.</p>
</div>
{% endif %}
<div>
<label for="forgejo_base_url" class="form-label">Forgejo Instance URL</label>
<input type="url"
id="forgejo_base_url"
name="forgejo_base_url"
class="form-input"
placeholder="https://git.example.com"
autocomplete="off"
value="{{ forgejo_base_url }}"
required />
</div>
<div>
<label for="forgejo_oauth_client_id" class="form-label">OAuth Client ID</label>
<input type="text"
id="forgejo_oauth_client_id"
name="forgejo_oauth_client_id"
class="form-input form-input-mono"
placeholder="c8ab3315-537d-44f3-…"
autocomplete="off"
spellcheck="false"
value="{{ forgejo_oauth_client_id }}"
required />
</div>
<div>
<label for="forgejo_oauth_client_secret" class="form-label">
OAuth Client Secret
{% if reconfiguring %}
<span class="form-label-note">(leave blank to keep current)</span>
{% endif %}
</label>
<input type="password"
id="forgejo_oauth_client_secret"
name="forgejo_oauth_client_secret"
class="form-input form-input-mono"
placeholder="gto_wkxxnv4ewa…"
autocomplete="off"
spellcheck="false"
{{ "" if reconfiguring else "required" }} />
</div>
<div>
<label for="firebreak_public_base_url" class="form-label">
Public Base URL
<span class="form-label-note">(optional)</span>
</label>
<input type="url"
id="firebreak_public_base_url"
name="firebreak_public_base_url"
class="form-input"
placeholder="https://share.example.com"
autocomplete="off"
value="{{ firebreak_public_base_url }}" />
<p class="form-hint">
Your production domain for OAuth redirects. Leave blank on localhost &mdash; Firebreak will use <code class="form-hint-code">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 %}