···394394 ) -> Result<HashMap<String, HashMap<String, CountsByCount>>> {
395395 let data = self.0.lock().unwrap();
396396 let mut out: HashMap<String, HashMap<String, CountsByCount>> = HashMap::new();
397397- if let Some(asdf) = data.targets.get(&Target::new(target)) {
398398- for (Source { collection, path }, linkers) in asdf {
397397+ if let Some(source_linker_pairs) = data.targets.get(&Target::new(target)) {
398398+ for (Source { collection, path }, linkers) in source_linker_pairs {
399399 let records = linkers.iter().flatten().count() as u64;
400400 let distinct_dids = linkers
401401 .iter()
+49
constellation/templates/get-distinct.html.j2
···11+{% extends "base.html.j2" %}
22+{% import "try-it-macros.html.j2" as try_it %}
33+44+{% block title %}DIDs{% endblock %}
55+{% block description %}Distinct DIDs with records in {{ query.source }} linking to {{ query.subject }} {% endblock %}
66+77+{% block content %}
88+99+ {% call try_it::get_distinct(query.subject, query.source) %}
1010+1111+ <h2>
1212+ Distinct DIDs with links to <code>{{ query.subject }}</code> from <code>{{ query.source }}</code>
1313+ {% if let Some(browseable_uri) = query.subject|to_browseable %}
1414+ <small style="font-weight: normal; font-size: 1rem"><a href="{{ browseable_uri }}">browse record</a></small>
1515+ {% endif %}
1616+ </h2>
1717+1818+ <p><strong>{{ total|human_number }} distinct DIDs</strong> with links to <code>{{ query.subject }}</code> from <code>{{ query.source }}</code></p>
1919+2020+ <ul>
2121+ <li>See direct backlinks at <code>/xrpc/blue.microcosm.links.getBacklinks</code>: <a href="/xrpc/blue.microcosm.links.getBacklinks?subject={{ query.subject|urlencode }}&source={{ query.source|urlencode }}">/xrpc/blue.microcosm.links.getBacklinks?subject={{ query.subject }}&source={{ query.source }}</a></li>
2222+ <li>See all links to this target at <code>/links/all</code>: <a href="/links/all?target={{ query.subject|urlencode }}">/links/all?target={{ query.subject }}</a></li>
2323+ </ul>
2424+2525+ <h3>DIDs, most recent first:</h3>
2626+2727+ {% for did in linking_dids %}
2828+ <pre style="display: block; margin: 1em 2em" class="code"><strong>DID</strong>: {{ did.0 }}
2929+ -> see <a href="/links/all?target={{ did.0|urlencode }}">links to this DID</a>
3030+ -> browse <a href="https://pdsls.dev/at://{{ did.0 }}">this DID record</a></pre>
3131+ {% endfor %}
3232+3333+ {% if let Some(c) = cursor %}
3434+ <form method="get" action="/xrpc/blue.microcosm.links.getDistinct">
3535+ <input type="hidden" name="subject" value="{{ query.subject }}" />
3636+ <input type="hidden" name="source" value="{{ query.source }}" />
3737+ <input type="hidden" name="cursor" value={{ c|json|safe }} />
3838+ <button type="submit">next page…</button>
3939+ </form>
4040+ {% else %}
4141+ <button disabled><em>end of results</em></button>
4242+ {% endif %}
4343+4444+ <details>
4545+ <summary>Raw JSON response</summary>
4646+ <pre class="code">{{ self|tojson }}</pre>
4747+ </details>
4848+4949+{% endblock %}
+45
constellation/templates/hello.html.j2
···8181 ) %}
828283838484+ <h3 class="route"><code>GET /xrpc/blue.microcosm.links.getCounts</code></h3>
8585+8686+ <p>The total number of links pointing at a given target.</p>
8787+8888+ <h4>Query parameters:</h4>
8989+9090+ <ul>
9191+ <li><code>subject</code>: required, must url-encode. The target being linked to. Example: <code>did:plc:vc7f4oafdgxsihk4cry2xpze</code> or <code>at://did:plc:vc7f4oafdgxsihk4cry2xpze/app.bsky.feed.post/3lgwdn7vd722r</code></li>
9292+ <li><code>source</code>: required. Collection and path specification for the primary link. Example: <code>app.bsky.feed.like:subject.uri</code></li>
9393+ </ul>
9494+9595+ <p style="margin-bottom: 0"><strong>Try it:</strong></p>
9696+ {% call try_it::get_counts("did:plc:vc7f4oafdgxsihk4cry2xpze", "app.bsky.graph.block:subject.uri") %}
9797+9898+9999+ <h3 class="route"><code>GET /xrpc/blue.microcosm.links.getDistinct</code></h3>
100100+101101+ <p>A list of distinct DIDs (identities) with links to a target.</p>
102102+103103+ <h4>Query parameters:</h4>
104104+105105+ <ul>
106106+ <li><code>subject</code>: required, must url-encode. The target being linked to. Example: <code>did:plc:vc7f4oafdgxsihk4cry2xpze</code> or <code>at://did:plc:vc7f4oafdgxsihk4cry2xpze/app.bsky.feed.post/3lgwdn7vd722r</code></li>
107107+ <li><code>source</code>: required. Collection and path specification for the primary link. Example: <code>app.bsky.feed.like:subject.uri</code></li>
108108+ <li><code>limit</code>: optional. Number of results to return. Default: <code>16</code>. Maximum: <code>100</code></li>
109109+ <li><code>cursor</code>: optional, see Definitions.</li>
110110+ </ul>
111111+112112+ <p style="margin-bottom: 0"><strong>Try it:</strong></p>
113113+ {% call try_it::get_distinct("at://did:plc:vc7f4oafdgxsihk4cry2xpze/app.bsky.feed.post/3lgwdn7vd722r", "app.bsky.feed.like:subject.uri") %}
114114+115115+84116 <h3 class="route"><code>GET /links</code></h3>
8511786118 <p>A list of records linking to a target.</p>
···101133 <p style="margin-bottom: 0"><strong>Try it:</strong></p>
102134 {% call try_it::links("at://did:plc:a4pqq234yw7fqbddawjo7y35/app.bsky.feed.post/3m237ilwc372e", "app.bsky.feed.like", ".subject.uri", [""], 16) %}
103135136136+ <h3 class="route"><code>GET /xrpc/blue.microcosm.links.getBacklinks</code></h3>
137137+138138+ <p>A list of distinct DIDs (identities) with links to a target.</p>
139139+140140+ <h4>Query parameters:</h4>
141141+142142+ <ul>
143143+ <li><code>subject</code>: required, must url-encode. Example: <code>at://did:plc:vc7f4oafdgxsihk4cry2xpze/app.bsky.feed.post/3lgwdn7vd722r</code></li>
144144+ <li><code>source</code>: required, must url-encode. Example: <code>app.bsky.feed.post:.subject.uri</code></li>
145145+ </ul>
146146+147147+ <p style="margin-bottom: 0"><strong>Try it:</strong></p>
148148+ {% call try_it::get_distinct("at://did:plc:vc7f4oafdgxsihk4cry2xpze/app.bsky.feed.post/3lgwdn7vd722r", "app.bsky.feed.like:.subject.uri") %}
104149105150 <h3 class="route"><code>GET /links/distinct-dids</code></h3>
106151