| 1 | <div class="container" style="max-width:640px;margin:1.5rem auto 3rem;padding:0 1rem">
|
|---|
| 2 | <h1 style="margin:0 0 .3rem"><%= t('apaid.t') %></h1>
|
|---|
| 3 | <p style="color:var(--ink-soft,#888);margin:0 0 1.2rem">
|
|---|
| 4 | <%= t('apaid.intro') %>
|
|---|
| 5 | </p>
|
|---|
| 6 |
|
|---|
| 7 | <% if (saved) { %><p style="color:var(--accent);font-weight:600"><%= t('apaid.saved') %></p><% } %>
|
|---|
| 8 | <% if (error) { %><p style="color:#c0392b"><%= error %></p><% } %>
|
|---|
| 9 | <% if (!secretReady) { %>
|
|---|
| 10 | <p style="color:#c0392b"><%= t('apaid.nokey') %></p>
|
|---|
| 11 | <% } %>
|
|---|
| 12 |
|
|---|
| 13 | <p style="margin:.2rem 0 1.2rem">
|
|---|
| 14 | <%= t('apaid.status') %>
|
|---|
| 15 | <% if (status.connected) { %>
|
|---|
| 16 | <strong style="color:var(--accent)"><%= t('apaid.connected') %></strong> (<%= t('apaid.campaign') %> <%= status.campaignId %>)
|
|---|
| 17 | <% } else if (status.configured) { %>
|
|---|
| 18 | <strong><%= t('apaid.configured') %></strong>
|
|---|
| 19 | <% } else { %>
|
|---|
| 20 | <strong><%= t('apaid.notyet') %></strong>
|
|---|
| 21 | <% } %>
|
|---|
| 22 | </p>
|
|---|
| 23 |
|
|---|
| 24 | <div style="border:1px solid var(--border,#333);border-radius:10px;padding:.9rem 1rem;margin:0 0 1.3rem;background:color-mix(in srgb,var(--accent,#6b8f71) 8%,transparent)">
|
|---|
| 25 | <p style="margin:0 0 .4rem;font-weight:600"><%= t('apaid.redirect_h') %></p>
|
|---|
| 26 | <p style="margin:0 0 .6rem;color:var(--ink-soft,#888);font-size:.9rem">
|
|---|
| 27 | <%= t('apaid.redirect_p') %>
|
|---|
| 28 | </p>
|
|---|
| 29 | <div style="display:flex;gap:.5rem;align-items:center">
|
|---|
| 30 | <input id="pd-redirect" type="text" readonly value="<%= redirectUri %>" style="flex:1;min-width:0;font-family:monospace;font-size:.9rem">
|
|---|
| 31 | <button type="button" id="pd-copy" class="btn" data-copied="<%= t('apaid.copied') %>"><%= t('apaid.copy') %></button>
|
|---|
| 32 | </div>
|
|---|
| 33 | </div>
|
|---|
| 34 |
|
|---|
| 35 | <form method="post" action="/admin/paid" style="display:flex;flex-direction:column;gap:.9rem">
|
|---|
| 36 | <label><%= t('apaid.client_id') %>
|
|---|
| 37 | <input type="text" name="client_id" value="<%= status.clientId || '' %>" autocomplete="off" style="width:100%">
|
|---|
| 38 | </label>
|
|---|
| 39 | <label><%= t('apaid.client_secret') %>
|
|---|
| 40 | <input type="password" name="client_secret" placeholder="<%= status.hasSecret ? t('apaid.unchanged') : '' %>" autocomplete="off" style="width:100%">
|
|---|
| 41 | <small style="color:var(--ink-soft,#888)"><%= t('apaid.keep') %></small>
|
|---|
| 42 | </label>
|
|---|
| 43 | <label><%= t('apaid.campaign_id') %>
|
|---|
| 44 | <input type="text" name="campaign_id" value="<%= status.campaignId || '' %>" autocomplete="off" style="width:100%">
|
|---|
| 45 | </label>
|
|---|
| 46 | <label><%= t('apaid.public_page') %>
|
|---|
| 47 | <input type="url" name="patreon_url" value="<%= status.patreonUrl || '' %>" placeholder="https://www.patreon.com/jouwnaam" autocomplete="off" style="width:100%">
|
|---|
| 48 | <small style="color:var(--ink-soft,#888)"><%= t('apaid.public_help') %></small>
|
|---|
| 49 | </label>
|
|---|
| 50 | <label><%= t('apaid.access') %>
|
|---|
| 51 | <input type="password" name="access_token" placeholder="<%= t('apaid.unchanged') %>" autocomplete="off" style="width:100%">
|
|---|
| 52 | </label>
|
|---|
| 53 | <label><%= t('apaid.refresh') %>
|
|---|
| 54 | <input type="password" name="refresh_token" placeholder="<%= t('apaid.unchanged') %>" autocomplete="off" style="width:100%">
|
|---|
| 55 | <small style="color:var(--ink-soft,#888)"><%= t('apaid.token_help') %></small>
|
|---|
| 56 | </label>
|
|---|
| 57 | <label><%= t('apaid.min_eur') %>
|
|---|
| 58 | <input type="text" name="default_min_eur" value="<%= status.defaultMinCents ? (status.defaultMinCents/100).toFixed(2) : '' %>" inputmode="decimal" style="width:120px">
|
|---|
| 59 | </label>
|
|---|
| 60 | <div style="display:flex;gap:.6rem;align-items:center">
|
|---|
| 61 | <button type="submit" class="btn btn-primary"><%= t('apaid.save') %></button>
|
|---|
| 62 | </div>
|
|---|
| 63 | </form>
|
|---|
| 64 |
|
|---|
| 65 | <% if (status.configured || status.connected) { %>
|
|---|
| 66 | <form method="post" action="/admin/paid/disconnect" data-confirm="<%= t('apaid.disconnect_confirm') %>" style="margin-top:1rem">
|
|---|
| 67 | <button type="submit" class="btn btn-danger"><%= t('apaid.disconnect') %></button>
|
|---|
| 68 | </form>
|
|---|
| 69 | <% } %>
|
|---|
| 70 |
|
|---|
| 71 | <p style="margin-top:1.5rem"><a href="/admin">← <%= t('admin.back') %></a></p>
|
|---|
| 72 | </div>
|
|---|
| 73 |
|
|---|
| 74 | <script>
|
|---|
| 75 | (function () {
|
|---|
| 76 | var field = document.getElementById('pd-redirect');
|
|---|
| 77 | var btn = document.getElementById('pd-copy');
|
|---|
| 78 | if (!field || !btn) return;
|
|---|
| 79 | field.addEventListener('focus', function () { field.select(); });
|
|---|
| 80 | btn.addEventListener('click', function () {
|
|---|
| 81 | field.select();
|
|---|
| 82 | var done = function () { var t = btn.textContent; btn.textContent = document.getElementById('pd-copy').getAttribute('data-copied'); setTimeout(function () { btn.textContent = t; }, 1400); };
|
|---|
| 83 | if (navigator.clipboard && navigator.clipboard.writeText) { navigator.clipboard.writeText(field.value).then(done, function () { try { document.execCommand('copy'); done(); } catch (e) {} }); }
|
|---|
| 84 | else { try { document.execCommand('copy'); done(); } catch (e) {} }
|
|---|
| 85 | });
|
|---|
| 86 | })();
|
|---|
| 87 | </script>
|
|---|