{% extends "space-settings-base.html" %} {% from "ui.html" import csrf_field, action, when, copyable, reveal_notice with context %} {% set section = "git" %} {% set status_labels = {"never": _("Never synchronized"), "ok": _("Up to date"), "error": _("Error", context="status"), "conflict": _("In conflict")} %} {% set status_class = {"never": "", "ok": "status-ok", "error": "status-error", "conflict": "status-warn"} %} {% block section %}

{{ _("Status") }}

{% if space.repo_url %}{{ status_labels[space.sync_status] }}{% endif %}
{% if space.repo_url %} {% if space.sync_error %}{% endif %} {# Sync requested, in progress or next attempt: the page reloads on its own as long as the result may arrive at any moment. #} {% set sync = sync_activity %} {% if sync %} {% if sync.poll %}{% endif %}

{%- if sync.state == 'running' %}{{ _("Synchronizing…") }} {%- elif sync.state == 'retry' %}{{ (_("Automatic retry on {when}, after {n} failures. “Synchronize now” runs it right away.")|e).format(when=when(sync.at), n=sync.failures) if sync.failures > 1 else (_("Automatic retry on {when}. “Synchronize now” runs it right away.")|e).format(when=when(sync.at)) }} {%- elif sync.stalled %}{{ (_("Synchronization requested on {when}: the worker has not picked it up yet.")|e).format(when=when(sync.at)) }} {%- else %}{{ _("Synchronization requested: it starts as soon as the worker is free.") }}{% endif %} {%- if sync.poll %} {% endif -%}

{% endif %} {% if contribute %}
{{ action("/o/" ~ org.slug ~ "/" ~ space.slug ~ "/-/sync", _("Synchronize now"), small=false) }}
{% endif %} {% else %}

{{ _("No Git repository is linked: the wiki and the inbox stay empty until one is.") }}{% if not manage %} {{ _("Ask an organization administrator to link it.") }}{% endif %}

{% endif %}
{% if vocation_pending %}

{{ _("Space purpose chosen: it will be written to the repository at the first synchronization (unless it already has its own).") }} {{ _("Review or adapt the purpose") }}

{% endif %} {% if space.sync_status == 'conflict' %}

{{ _("Conflicts to resolve") }}

{% if manage %}

{{ _("These files were changed both in Synaptane and on the remote repository. Compare, then choose the version to keep; Git history keeps the other one.") }}

{{ csrf_field() }}
{% for path in space.conflict_paths %} {% endfor %}
{{ _("File") }}{{ _("Version to keep") }}
{{ path }} {{ _("Compare") }}
{% else %}

{{ _("An organization administrator must choose which version to keep for: {paths}.", paths=space.conflict_paths|join(", ")) }}

{% endif %}
{% endif %} {% if manage %}

1{{ _("Repository address") }}

{{ csrf_field() }}

{{ _("HTTPS (token) or SSH (deploy key).") }}

{% if space.repo_url %}

2{{ _("Repository access") }}

{% if credential_kind == 'https' %}{{ _("HTTPS access token saved.") }}{% elif credential_kind == 'ssh' %}{{ _("SSH key saved.") }}{% else %}{{ _("No credentials: only public repositories can be read.") }}{% endif %} {{ _("Secrets are encrypted and never shown again.") }}

{% if space.repo_url.startswith('https://') %}
{{ csrf_field() }}

{{ _("GitHub: fine-grained token limited to the repository, “Contents” read and write. GitLab: project access token with “write_repository”.") }}

{% elif ssh_remote %} {# Reading reloads the page: to be done before pasting the private key, hence the order. #}
{{ action("/o/" ~ org.slug ~ "/" ~ space.slug ~ "/-/git/scan", _("Read the SSH server keys")) }} {{ _("First: fills in the “Server keys” field below (the page reloads).") }}
{% if fingerprints %}

{{ _("Compare these fingerprints with those published by your host before saving:") }}

{% for line in fingerprints %}

{{ line }}

{% endfor %}
{% endif %}
{{ csrf_field() }}

{{ _("Filled in by “Read the SSH server keys” above, or copied from your host's documentation.") }}

{% endif %} {% if credential_kind %}
{{ action("/o/" ~ org.slug ~ "/" ~ space.slug ~ "/-/git/clear", _("Delete credentials"), confirm=_("Delete the credentials? Synaptane will no longer be able to write to the repository."), kind="danger") }}
{% endif %}

3{{ _("Webhook (optional)") }}

{{ _("Notifies Synaptane on every push for an immediate synchronization. Without a webhook, synchronization happens every few minutes.") }}

{% if revealed %}{{ reveal_notice(revealed, _("Copy this secret now into the webhook settings: it will not be shown again.")) }}{% endif %}

{{ _("GitHub: Settings → Webhooks, content type “application/json”, “push” event. GitLab: Settings → Webhooks, “Secret token”, “Push events”.") }}

{% if has_webhook_secret %} {{ action("/o/" ~ org.slug ~ "/" ~ space.slug ~ "/-/webhook", _("Generate a new secret"), confirm=_("The current webhook will stop working until you paste the new secret at your host. Continue?")) }} {% else %} {{ action("/o/" ~ org.slug ~ "/" ~ space.slug ~ "/-/webhook", _("Generate the secret")) }} {% endif %}
{% endif %} {% endif %}
{% endblock %}