| 1 | <div class="container admin-page">
|
|---|
| 2 | <h1><%= t('agoog.title') %></h1>
|
|---|
| 3 | <p><a href="/admin/settings" class="btn">← <%= t('agoog.back') %></a></p>
|
|---|
| 4 |
|
|---|
| 5 | <% if (success) { %><div class="alert alert-success"><%= success %></div><% } %>
|
|---|
| 6 | <% if (typeof error !== 'undefined' && error) { %><div class="alert alert-error"><%= error %></div><% } %>
|
|---|
| 7 |
|
|---|
| 8 | <section class="set-card">
|
|---|
| 9 | <h2><%= t('agoog.card_title') %></h2>
|
|---|
| 10 | <p class="set-help"><%= t('agoog.card_help_pre') %> <strong><%= t('agoog.card_help_own') %></strong>
|
|---|
| 11 | <%= t('agoog.card_help_mid') %>
|
|---|
| 12 | <a href="https://console.cloud.google.com/apis/credentials" target="_blank" rel="noopener">console.cloud.google.com</a>
|
|---|
| 13 | <%= t('agoog.card_help_post') %>
|
|---|
| 14 | <% if (google && google.configured) { %><strong><%= t('agoog.status_set') %></strong><% } else { %><%= t('agoog.status_unset') %><% } %></p>
|
|---|
| 15 |
|
|---|
| 16 | <details class="set-google-guide">
|
|---|
| 17 | <summary><%= t('agoog.guide_summary') %></summary>
|
|---|
| 18 | <ol class="set-google-steps">
|
|---|
| 19 | <li><%= t('agoog.step1_pre') %> <a href="https://console.cloud.google.com/" target="_blank" rel="noopener">Google Cloud Console</a> <%= t('agoog.step1_post') %></li>
|
|---|
| 20 | <li><strong>APIs & Services → OAuth consent screen</strong>: <%= t('agoog.step2_usertype') %> <strong>External</strong>. <%= t('agoog.step2_scopes_pre') %> <code>email</code>, <code>profile</code> <%= t('agoog.step2_scopes_and') %> <code>openid</code> <%= t('agoog.step2_scopes_post') %> <%= t('agoog.step2_testmode') %></li>
|
|---|
| 21 | <li><strong>APIs & Services → Credentials → Create credentials → OAuth client ID</strong>, <%= t('agoog.step3_type') %> <strong>Web application</strong>.</li>
|
|---|
| 22 | <li><%= t('agoog.step4_pre') %> <strong>Authorized redirect URIs</strong><%= t('agoog.step4_post') %></li>
|
|---|
| 23 | <li><%= t('agoog.step5_pre') %> <strong>Client ID</strong> + <strong>Client Secret</strong> <%= t('agoog.step5_post') %></li>
|
|---|
| 24 | </ol>
|
|---|
| 25 | <p class="set-help" style="margin:.5rem 0 0"><strong><%= t('agoog.note_label') %></strong> <%= t('agoog.note_pre') %> <strong><%= t('agoog.note_noapi') %></strong> <%= t('agoog.note_mid') %> <em><%= t('agoog.note_not') %></em> <%= t('agoog.note_post') %></p>
|
|---|
| 26 | </details>
|
|---|
| 27 |
|
|---|
| 28 | <% if (google && google.redirectUri) { %>
|
|---|
| 29 | <div class="set-redirect">
|
|---|
| 30 | <div class="set-redirect-label"><%= t('agoog.redirect_label') %></div>
|
|---|
| 31 | <code class="set-redirect-url" style="user-select:all"><%= google.redirectUri %></code>
|
|---|
| 32 | <ol class="set-redirect-steps">
|
|---|
| 33 | <li><%= t('agoog.rstep1_pre') %> <a href="https://console.cloud.google.com/apis/credentials" target="_blank" rel="noopener">Google Cloud Console → APIs & Services → Credentials</a>.</li>
|
|---|
| 34 | <li><%= t('agoog.rstep2') %></li>
|
|---|
| 35 | <li><%= t('agoog.rstep3_pre') %> <strong>Authorized redirect URIs</strong> → <%= t('agoog.rstep3_mid') %> <strong>+ ADD URI</strong> <%= t('agoog.rstep3_post') %></li>
|
|---|
| 36 | <li><%= t('agoog.rstep4_pre') %> <strong>Save</strong> <%= t('agoog.rstep4_post') %></li>
|
|---|
| 37 | </ol>
|
|---|
| 38 | <p class="set-redirect-warn"><%= t('agoog.warn_pre') %> <strong><%= t('agoog.warn_exact') %></strong> <%= t('agoog.warn_mid1') %> <code>https://</code> (<%= t('agoog.warn_nohttp') %> <code>http</code>)<%= t('agoog.warn_mid2') %> <strong><%= t('agoog.warn_noslash') %></strong> <%= t('agoog.warn_mid3') %> <em><%= t('agoog.warn_error') %></em>.</p>
|
|---|
| 39 | </div>
|
|---|
| 40 | <% } else { %>
|
|---|
| 41 | <p class="set-help" style="color:var(--accent)"><%= t('agoog.set_baseurl_pre') %> <code>PUBLIC_BASE_URL</code> <%= t('agoog.set_baseurl_post') %></p>
|
|---|
| 42 | <% } %>
|
|---|
| 43 |
|
|---|
| 44 | <form method="post" action="/admin/settings/google" class="set-form">
|
|---|
| 45 | <label class="set-field">
|
|---|
| 46 | <span><%= t('agoog.client_id') %></span>
|
|---|
| 47 | <input type="text" name="google_client_id" value="<%= google ? google.clientId : '' %>" placeholder="123-abc.apps.googleusercontent.com" autocomplete="off">
|
|---|
| 48 | </label>
|
|---|
| 49 | <label class="set-field">
|
|---|
| 50 | <span><%= t('agoog.client_secret') %> <% if (google && google.secretSet) { %><small style="font-weight:400">— <%= t('agoog.client_secret_set') %></small><% } %></span>
|
|---|
| 51 | <input type="password" name="google_client_secret" placeholder="<%= (google && google.secretSet) ? t('agoog.secret_ph_set') : 'GOCSPX-…' %>" autocomplete="off">
|
|---|
| 52 | </label>
|
|---|
| 53 | <div class="set-actions">
|
|---|
| 54 | <button type="submit" class="btn btn-primary"><%= t('agoog.save') %></button>
|
|---|
| 55 | <% if (google && (google.clientId || google.secretSet)) { %>
|
|---|
| 56 | <button type="submit" name="clear" value="1" class="btn"><%= t('agoog.disconnect') %></button>
|
|---|
| 57 | <% } %>
|
|---|
| 58 | </div>
|
|---|
| 59 | </form>
|
|---|
| 60 | <% if (typeof premiumEnabled !== 'undefined' && premiumEnabled && !isPremium) { %>
|
|---|
| 61 | <p class="set-help" style="margin-top:.7rem; color:var(--accent)"><%= t('agoog.premium_locked') %></p>
|
|---|
| 62 | <% } %>
|
|---|
| 63 | </section>
|
|---|
| 64 | </div>
|
|---|
| 65 |
|
|---|
| 66 | <style>
|
|---|
| 67 | .admin-page { max-width: 700px; margin: 3rem auto; padding: 0 1rem; }
|
|---|
| 68 | .admin-page h1 { font-family: var(--font-display, serif); font-size: 2rem; margin: 0 0 0.75rem; }
|
|---|
| 69 | .set-card { background: var(--paper-2); border: 1px solid var(--rule); border-radius: 12px; padding: 1.25rem; }
|
|---|
| 70 | .set-card h2 { font-family: var(--font-display, serif); font-size: 1.25rem; margin: 0 0 0.5rem; }
|
|---|
| 71 | .set-help { color: var(--ink-muted); font-size: 0.9rem; margin: 0 0 1.25rem; }
|
|---|
| 72 | .set-google-guide { margin: 0 0 1rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); }
|
|---|
| 73 | .set-google-guide > summary { cursor: pointer; padding: 0.6rem 0.85rem; font-size: 0.9rem; font-weight: 600; color: var(--accent); list-style: none; }
|
|---|
| 74 | .set-google-guide > summary::-webkit-details-marker { display: none; }
|
|---|
| 75 | .set-google-guide > summary::before { content: "▸ "; }
|
|---|
| 76 | .set-google-guide[open] > summary::before { content: "▾ "; }
|
|---|
| 77 | .set-google-steps { margin: 0; padding: 0 1rem 0.6rem 2rem; font-size: 0.88rem; color: var(--ink); line-height: 1.5; }
|
|---|
| 78 | .set-google-steps li { margin: 0.35rem 0; }
|
|---|
| 79 | .set-google-guide code { background: var(--paper-2); padding: 0.05rem 0.35rem; border-radius: 4px; font-size: 0.85em; }
|
|---|
| 80 | .set-google-guide .set-help { padding: 0 0.85rem; }
|
|---|
| 81 | .set-form { display: flex; flex-direction: column; gap: 1rem; max-width: 460px; }
|
|---|
| 82 | .set-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.25rem; }
|
|---|
| 83 | .set-field { display: flex; flex-direction: column; gap: 0.3rem; }
|
|---|
| 84 | .set-field > span { font-size: 0.8rem; font-weight: 600; color: var(--ink-soft, var(--ink-muted)); }
|
|---|
| 85 | .set-field input {
|
|---|
| 86 | width: 100%; box-sizing: border-box; padding: 0.55rem 0.7rem;
|
|---|
| 87 | border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--ink);
|
|---|
| 88 | font: inherit; font-size: 0.95rem;
|
|---|
| 89 | }
|
|---|
| 90 | .set-field input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
|
|---|
| 91 | .alert { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; }
|
|---|
| 92 | .alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
|
|---|
| 93 | .set-redirect { border: 1px solid var(--accent); border-radius: 10px; padding: 1rem; margin: 0 0 1.25rem; background: var(--paper); }
|
|---|
| 94 | .set-redirect-label { font-weight: 700; font-size: 0.9rem; margin-bottom: 0.5rem; }
|
|---|
| 95 | .set-redirect-url { display: block; padding: 0.6rem 0.8rem; background: var(--paper-2); border: 1px dashed var(--rule); border-radius: 6px; font-size: 0.9rem; word-break: break-all; }
|
|---|
| 96 | .set-redirect-steps { margin: 0.85rem 0 0; padding-left: 1.3rem; font-size: 0.9rem; line-height: 1.55; color: var(--ink); }
|
|---|
| 97 | .set-redirect-steps li { margin: 0.3rem 0; }
|
|---|
| 98 | .set-redirect-steps a { color: var(--accent); }
|
|---|
| 99 | .set-redirect-warn { margin: 0.85rem 0 0; font-size: 0.85rem; color: var(--ink-muted); }
|
|---|
| 100 | .set-redirect-warn code { background: var(--paper-2); padding: 0.05rem 0.35rem; border-radius: 4px; }
|
|---|
| 101 | </style>
|
|---|