forked from
microcosm.blue/microcosm-rs
Constellation, Spacedust, Slingshot, UFOs: atproto crates and services for microcosm
1{% extends "base.html.j2" %}
2{% import "try-it-macros.html.j2" as try_it %}
3
4{% block title %}Links{% endblock %}
5{% block description %}All {{ query.collection }} records with links to {{ query.target }} at JSON path {{ query.path }}{% endblock %}
6
7{% block content %}
8
9 {% call try_it::links(query.target, query.collection, query.path, query.did, query.limit) %}
10
11 <h2>
12 Links to <code>{{ query.target }}</code>
13 {% if let Some(browseable_uri) = query.target|to_browseable %}
14 <small style="font-weight: normal; font-size: 1rem"><a href="{{ browseable_uri }}">browse record</a></small>
15 {% endif %}
16 </h2>
17
18 <p><strong>{{ total|human_number }} links</strong> from <code>{{ query.collection }}</code> at <code>{{ query.path }}</code></p>
19
20 <ul>
21 <li>See distinct linking DIDs at <code>/links/distinct-dids</code>: <a href="/links/distinct-dids?target={{ query.target|urlencode }}&collection={{ query.collection|urlencode }}&path={{ query.path|urlencode }}">/links/distinct-dids?target={{ query.target }}&collection={{ query.collection }}&path={{ query.path }}</a></li>
22 <li>See all links to this target at <code>/links/all</code>: <a href="/links/all?target={{ query.target|urlencode }}">/links/all?target={{ query.target }}</a></li>
23 </ul>
24
25 <h3>Links, most recent first:</h3>
26
27 {% for record in linking_records %}
28 <pre style="display: block; margin: 1em 2em" class="code"><strong>DID</strong>: {{ record.did().0 }} (<a href="/links/all?target={{ record.did().0|urlencode }}">DID links</a>)
29<strong>Collection</strong>: {{ record.collection }}
30<strong>RKey</strong>: {{ record.rkey }}
31-> <a href="https://pdsls.dev/at://{{ record.did().0 }}/{{ record.collection }}/{{ record.rkey }}">browse record</a></pre>
32 {% endfor %}
33
34 {% if let Some(c) = cursor %}
35 <form method="get" action="/links">
36 <input type="hidden" name="target" value="{{ query.target }}" />
37 <input type="hidden" name="collection" value="{{ query.collection }}" />
38 <input type="hidden" name="path" value="{{ query.path }}" />
39 <input type="hidden" name="cursor" value={{ c|json|safe }} />
40 <button type="submit">next page…</button>
41 </form>
42 {% else %}
43 <button disabled><em>end of results</em></button>
44 {% endif %}
45
46 <details>
47 <summary>Raw JSON response</summary>
48 <pre class="code">{{ self|tojson }}</pre>
49 </details>
50
51{% endblock %}