{% extends "base.html" %} {% import "_macros.html" as m with context %} {% block title %}Pageboy · {{ t('settings.title') }}{% endblock %} {% block subtitle %}{{ t('settings.subtitle') }}{% endblock %} {% block content %} {% if flash_saved %}

{{ th('flash.saved', what=flash_saved) }}

{% endif %} {% if flash_ok %}

{{ flash_ok }}

{% endif %} {% if flash_err %} {% endif %} {% for row in channels %} {% set g = row.guide %}

{{ g.title }}

{% if row.running %}{{ t('status.receiving') }}{% elif row.enabled %}{{ t('status.enabled_waiting') }}{% else %}{{ t('status.off') }}{% endif %}

{{ t('settings.summary') }} {{ g.blurb }}

{{ g.what_it_does }}

{% if g.name != 'telegram' %}

{{ t('settings.prepare') }}

    {% for step in g.steps %}
  1. {{ step }}
  2. {% endfor %}
{% endif %} {% if g.name == 'telegram' %} {% set bot_step = row.bot_step %} {% set bot_order = ['token', 'enable', 'pair', 'protected'] %} {% set bot_pos = bot_order.index(bot_step) %} {% set token_field = g.fields | selectattr('secret_name', 'equalto', 'bot_token') | first %} {% set allowlist_field = g.fields | selectattr('secret_name', 'equalto', 'allowlist') | first %}

{{ t('bot.section_title') }} {{ t('bot.section_sub') }}

    {% for label in [t('bot.step1'), t('bot.step2'), t('bot.step3'), t('bot.step4')] %}
  1. {{ label }}
  2. {% endfor %}
{# 1 · bot token #} {% if bot_step == 'token' %}

{{ t('bot.token_title') }}

{% set bot_links %}{% for link in g.links %}{{ link.label }}{% if not loop.last %} · {% endif %}{% endfor %}{% endset %}

{{ th('bot.token_from', links=bot_links) }}

{{ m.secret_field(g.name, token_field, row.secret_flags) }} {% else %}
{{ t('bot.token_saved') }} {{ t('common.change') }}

{{ t('bot.token_change_note') }}

{{ m.secret_field(g.name, token_field, row.secret_flags) }}
{% endif %} {# 2 · enable (also receiving error / not started) #} {% if bot_step == 'enable' %}

{{ t('bot.enable_title') }}

{% if row.enabled and not row.receiving_ok %}
{% else %}

{{ t('bot.enable_note') }}

{% endif %} {% elif bot_step in ['pair', 'protected'] %}
{{ t('bot.on_receiving') }}
{% endif %} {# 3 · pairing / allowlist #} {% if bot_step == 'pair' %}

{{ t('bot.pair_title') }}

{{ th('bot.pair_note') }}

{{ m.pairing_form(row.pairing_active) }}
{{ t('bot.edit_directly') }} {{ t('bot.allowlist_ids') }} {{ m.secret_field(g.name, allowlist_field, row.secret_flags) }}
{% elif bot_step == 'protected' %}
{{ t('bot.protected') }}

{{ th('bot.protected_note') }}

{{ t('bot.repair') }} {{ m.pairing_form(row.pairing_active) }} {{ m.secret_field(g.name, allowlist_field, row.secret_flags) }}
{% endif %}

{% set ag = row.app_guide %} {% set step = row.app_step %} {% set order = ['credentials', 'phone', 'code', 'connected'] %} {% set pos = order.index('code' if step == 'password' else step) %}

{{ ag.title }}

{{ ag.blurb }}

    {% for label in [t('app.step1'), t('app.step2'), t('app.step3_2fa') if step == 'password' else t('app.step3_code'), t('app.step4')] %}
  1. {{ label }}
  2. {% endfor %}
{# 1 · App API credentials — open form until both are saved, then a one-line summary #} {% if step == 'credentials' %}

{{ t('app.cred_title') }}

{% set app_links %}{% for link in ag.links %}{{ link.label }}{% endfor %}{% endset %}

{{ th('app.cred_note', links=app_links) }}

{{ m.secret_group('telegram', ag.fields, row.secret_flags, t('app.save_cred')) }} {% else %}
{{ t('app.cred_saved') }} {{ t('common.change') }}

{{ t('app.cred_change_note') }}

{{ m.secret_group('telegram', ag.fields, row.secret_flags, t('app.save_cred')) }}
{% endif %} {# 2 · phone #} {% if step == 'phone' %}

{{ t('app.phone_title') }}

{% elif step in ['code', 'password'] %}
{{ th('app.code_sent', phone=row.app_phone_masked) }}
{% endif %} {# 3 · code, then 2FA password only if Telegram asks for it #} {% if step == 'code' %}

{{ t('app.code_title') }}

{{ t('app.code_note') }}

{% elif step == 'password' %}
{{ t('app.code_ok') }}

{{ t('app.2fa_title') }}

{{ t('app.2fa_note') }}

{% endif %} {# done #} {% if step == 'connected' %}

{{ th('app.connected') }}

{% endif %}
{% else %} {{ m.secret_group(g.name, g.fields, row.secret_flags, t('channel.save_tokens')) }}
{% if row.enabled %}
{% else %}
{% if not row.has_secret %} {{ t('channel.need_tokens') }} {% else %} {{ t('channel.enable_note') }} {% endif %} {% endif %}
{% endif %}
{% endfor %}

{{ jira_info.title }}

{{ t('settings.summary') }} {{ jira_info.blurb }}

{{ jira_info.what_it_does }}

{{ t('jira.how_to') }}

    {% for step in jira_info.steps %}
  1. {{ step }}
  2. {% endfor %}

{{ jira_info.note }}

{{ t('harness.title') }}

{{ t('harness.note') }}

{% for field in harness_secrets %}
{% endfor %}
{% endblock %}