| 1 | <div class="container" style="max-width:640px;margin:1.5rem auto 3rem;padding:0 1rem">
|
|---|
| 2 | <h1 style="margin:0 0 .3rem"><%= t('push.t') %></h1>
|
|---|
| 3 | <p style="color:var(--ink-soft,#888);margin:0 0 1.2rem">
|
|---|
| 4 | <%= t('push.intro') %>
|
|---|
| 5 | </p>
|
|---|
| 6 |
|
|---|
| 7 | <% if (!vapidKey) { %>
|
|---|
| 8 | <p style="color:#c0392b"><%= t('push.unavailable') %></p>
|
|---|
| 9 | <% } else { %>
|
|---|
| 10 |
|
|---|
| 11 | <div id="np-unsupported" hidden style="color:#c0392b;margin:0 0 1rem">
|
|---|
| 12 | <%= t('push.unsupported') %>
|
|---|
| 13 | </div>
|
|---|
| 14 | <div id="np-ios-hint" hidden style="border:1px solid var(--border,#333);border-radius:10px;padding:.8rem 1rem;margin:0 0 1rem;font-size:.92rem;color:var(--ink-soft,#888)">
|
|---|
| 15 | <%= t('push.ios_hint') %>
|
|---|
| 16 | </div>
|
|---|
| 17 |
|
|---|
| 18 | <section style="border:1px solid var(--border,#333);border-radius:12px;padding:1rem 1.1rem;margin:0 0 1.2rem">
|
|---|
| 19 | <p style="margin:0 0 .6rem"><strong><%= t('push.this_device') %></strong> <span id="np-state"><%= t('push.checking') %></span></p>
|
|---|
| 20 | <div style="display:flex;gap:.6rem;flex-wrap:wrap">
|
|---|
| 21 | <button type="button" id="np-on" class="btn btn-primary" hidden><%= t('push.enable') %></button>
|
|---|
| 22 | <button type="button" id="np-off" class="btn" hidden><%= t('push.disable') %></button>
|
|---|
| 23 | <button type="button" id="np-test" class="btn" hidden><%= t('push.test') %></button>
|
|---|
| 24 | </div>
|
|---|
| 25 | <fieldset id="np-alerts" hidden style="border:none;padding:0;margin:1rem 0 0">
|
|---|
| 26 | <legend style="font-weight:600;margin-bottom:.4rem"><%= t('push.what') %></legend>
|
|---|
| 27 | <label style="display:block"><input type="checkbox" data-alert="follow"> <%= t('push.a_follow') %></label>
|
|---|
| 28 | <label style="display:block"><input type="checkbox" data-alert="reply"> <%= t('push.a_reply') %></label>
|
|---|
| 29 | <label style="display:block"><input type="checkbox" data-alert="like"> <%= t('push.a_like') %></label>
|
|---|
| 30 | <label style="display:block"><input type="checkbox" data-alert="boost"> <%= t('push.a_boost') %></label>
|
|---|
| 31 | <label style="display:block"><input type="checkbox" data-alert="dm"> <%= t('push.a_dm') %></label>
|
|---|
| 32 | <p id="np-saved" hidden style="color:var(--accent);margin:.4rem 0 0"><%= t('push.saved') %></p>
|
|---|
| 33 | </fieldset>
|
|---|
| 34 | </section>
|
|---|
| 35 |
|
|---|
| 36 | <% if (subscriptions.length) { %>
|
|---|
| 37 | <h2 style="font-size:1.05rem;margin:0 0 .5rem"><%= t('push.devices') %></h2>
|
|---|
| 38 | <ul style="list-style:none;padding:0;margin:0 0 1.2rem">
|
|---|
| 39 | <% subscriptions.forEach(function (s) { %>
|
|---|
| 40 | <li data-endpoint="<%= s.endpoint %>" style="display:flex;justify-content:space-between;gap:.8rem;align-items:center;padding:.45rem 0;border-bottom:1px solid var(--border,#2a2a2a)">
|
|---|
| 41 | <span style="min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap"><%= s.ua_label || t('push.device') %> <small style="color:var(--ink-soft,#888)"><%= t('push.since') %> <%= String(s.created_at || '').slice(0, 10) %></small></span>
|
|---|
| 42 | <button type="button" class="btn np-remove" data-endpoint="<%= s.endpoint %>"><%= t('push.remove') %></button>
|
|---|
| 43 | </li>
|
|---|
| 44 | <% }); %>
|
|---|
| 45 | </ul>
|
|---|
| 46 | <% } %>
|
|---|
| 47 |
|
|---|
| 48 | <% } %>
|
|---|
| 49 |
|
|---|
| 50 | <p style="margin-top:1.5rem"><a href="/admin">← <%= t('admin.back') %></a></p>
|
|---|
| 51 | </div>
|
|---|
| 52 |
|
|---|
| 53 | <% if (vapidKey) { %>
|
|---|
| 54 | <script id="np-data" type="application/json"><%- JSON.stringify({
|
|---|
| 55 | vapid: vapidKey,
|
|---|
| 56 | alerts: defaultAlerts,
|
|---|
| 57 | saved: subscriptions.reduce(function (m, s) { try { m[s.endpoint] = JSON.parse(s.alert_types || '{}'); } catch (e) { m[s.endpoint] = {}; } return m; }, {}),
|
|---|
| 58 | i18n: { on: t('push.state_on'), off: t('push.state_off'), denied: t('push.state_denied'), unknown: t('push.state_unknown'), unsupported: t('push.state_unsupported'), failed: t('push.enable_failed') },
|
|---|
| 59 | }).replace(/</g, '\\u003c') %></script>
|
|---|
| 60 | <%# Het script van deze pagina staat in assets/js/mod/admin-push.js (shaer-bqr). %>
|
|---|
| 61 | <% } %>
|
|---|