todo.sr.ht/todosrht/templates/tracker-import-export.html

95 lines
3.3 KiB
HTML

{% extends "settings.html" %}
{% block title %}
<title>Configure {{tracker.owner}}/{{tracker.name}} &mdash; {{ cfg("sr.ht", "site-name") }}</title>
{% endblock %}
{% block content %}
<div class="row">
<div class="col-md-12">
<form method="POST" action="{{url_for('settings.export_POST',
owner=tracker.owner.canonical_name, name=tracker.name)}}">
{{csrf_token()}}
<h3>Export tracker dump</h3>
<p>
This tool will export a JSON dump which includes all data on this
tracker. The export format is a single JSON file including each ticket
and its events in the same format as provided via the
<a href="https://man.sr.ht/todo.sr.ht/api.md">todo.sr.ht API</a>.
</p>
<details style="margin-bottom: 1rem">
<summary class="text-muted">
Some of this data is cryptographically signed.
Expand this for details.
</summary>
<blockquote>
<p>
We provide cryptographic signatures for some ticket info and
comment details in the exported data. This can be used if you
re-import this dump into todo.sr.ht or into another instance
elsewhere to prove that the data is an authentic representation of
what each user had said.
</p>
<p>
For each ticket, the signature uses the
<a
href="https://man.sr.ht/api-conventions.md#webhook-signatures"
>webhook signature process</a>
after preparing the following JSON data as UTF-8:
</p>
<pre>{
"tracker_id": <strong>$trackerId</strong>,
"ticket_id": <strong>$ticketId</strong>,
"subject": <strong>$subject</strong>,
"body": <strong>$body</strong>,
"submitter_id": "<strong>$userId</strong>",
"upstream": "{{get_origin('todo.sr.ht', external=True)}}",
}</pre>
<p>
Comments use the same process with the following JSON data as UTF-8:
</p>
<pre>{
"tracker_id": <strong>$trackerId</strong>,
"ticket_id": <strong>$ticketId</strong>,
"comment": <strong>$comment</strong>,
"author_id": "<strong>$userId</strong>",
"upstream": "{{get_origin('todo.sr.ht', external=True)}}",
}</pre>
<p>
In each case, the resulting JSON is minified before being signed.
Signatures are only used for tickets and comments from users with
accounts; external users' emailed submissions are not signed.
</p>
</blockquote>
</details>
<button type="submit" class="btn btn-primary">
Export tracker data
{{icon('caret-right')}}
</button>
</form>
<form
method="POST"
action="{{url_for('settings.import_POST',
owner=tracker.owner.canonical_name, name=tracker.name)}}"
enctype="multipart/form-data"
>
{{csrf_token()}}
<h3>Import tracker dump</h3>
<p>
This tool will re-import a gzipped JSON dump generated by the export
tool on this or another todo.sr.ht instance.
</p>
<div class="form-group">
<input
type="file"
name="dump"
class="form-control {{valid.cls('dump')}}" />
{{valid.summary("dump")}}
</div>
<button type="submit" class="btn btn-primary">
Import tracker data
{{icon('caret-right')}}
</button>
</form>
</div>
</div>
{% endblock %}