From 09f58297b7c271d47fd4ebc32c2a28c3d8fa2418 Mon Sep 17 00:00:00 2001 From: mxngls Date: Sun, 25 Jan 2026 14:15:56 +0900 Subject: [PATCH] Modify backlinks counting XRPC endpoint name Now matches the existing XRPC getBacklinks endpoint naming scheme. This should fix the white-space issue for the` try-it-macros` template as well. --- constellation/src/server/mod.rs | 8 ++++---- ...t-counts.html.j2 => get-backlinks-count.html.j2} | 2 +- constellation/templates/hello.html.j2 | 4 ++-- constellation/templates/try-it-macros.html.j2 | 13 +++++-------- .../{getCounts.json => getBacklinksCount.json} | 2 +- 5 files changed, 13 insertions(+), 16 deletions(-) rename constellation/templates/{get-counts.html.j2 => get-backlinks-count.html.j2} (97%) rename lexicons/blue.microcosm/links/{getCounts.json => getBacklinksCount.json} (94%) diff --git a/constellation/src/server/mod.rs b/constellation/src/server/mod.rs index 0a16dda..6fa7913 100644 --- a/constellation/src/server/mod.rs +++ b/constellation/src/server/mod.rs @@ -78,11 +78,11 @@ where }), ) .route( - "/xrpc/blue.microcosm.links.getCounts", + "/xrpc/blue.microcosm.links.getBacklinksCount", get({ let store = store.clone(); move |accept, query| async { - spawn_blocking(|| get_counts(accept, query, store)) + spawn_blocking(|| get_backlink_counts(accept, query, store)) .await .map_err(to500)? } @@ -378,13 +378,13 @@ struct GetItemsCountQuery { source: String, } #[derive(Template, Serialize)] -#[template(path = "get-counts.html.j2")] +#[template(path = "get-backlinks-count.html.j2")] struct GetItemsCountResponse { total: u64, #[serde(skip_serializing)] query: GetItemsCountQuery, } -fn get_counts( +fn get_backlink_counts( accept: ExtractAccept, query: axum_extra::extract::Query, store: impl LinkReader, diff --git a/constellation/templates/get-counts.html.j2 b/constellation/templates/get-backlinks-count.html.j2 similarity index 97% rename from constellation/templates/get-counts.html.j2 rename to constellation/templates/get-backlinks-count.html.j2 index 5bbec0a..14aeac7 100644 --- a/constellation/templates/get-counts.html.j2 +++ b/constellation/templates/get-backlinks-count.html.j2 @@ -6,7 +6,7 @@ {% block content %} - {% call try_it::get_counts( + {% call try_it::get_backlinks_count( query.subject, query.source, ) %} diff --git a/constellation/templates/hello.html.j2 b/constellation/templates/hello.html.j2 index 6b77a8e..442677d 100644 --- a/constellation/templates/hello.html.j2 +++ b/constellation/templates/hello.html.j2 @@ -137,7 +137,7 @@

Try it:

{% call try_it::links_count("did:plc:vc7f4oafdgxsihk4cry2xpze", "app.bsky.graph.block", ".subject") %} -

GET /xrpc/blue.microcosm.links.getCounts

+

GET /xrpc/blue.microcosm.links.getBacklinksCount

The total number of links pointing at a given target.

@@ -149,7 +149,7 @@

Try it:

- {% call try_it::get_counts("did:plc:vc7f4oafdgxsihk4cry2xpze", "app.bsky.graph.block:subject.uri") %} + {% call try_it::get_backlinks_count("did:plc:vc7f4oafdgxsihk4cry2xpze", "app.bsky.graph.block:subject.uri") %}

GET /links/count/distinct-dids

diff --git a/constellation/templates/try-it-macros.html.j2 b/constellation/templates/try-it-macros.html.j2 index ee6e4d9..a189529 100644 --- a/constellation/templates/try-it-macros.html.j2 +++ b/constellation/templates/try-it-macros.html.j2 @@ -104,14 +104,11 @@ {% endmacro %} -{% macro get_counts(subject, source) %} -
-
-	  GET /xrpc/blue.microcosm.links.getCounts
-      ?subject=     
-      &source=       
-      
-	
+{% macro get_backlinks_count(subject, source) %} + +
GET /xrpc/blue.microcosm.links.getBacklinksCount
+  ?subject=     
+  &source=       
{% endmacro %} diff --git a/lexicons/blue.microcosm/links/getCounts.json b/lexicons/blue.microcosm/links/getBacklinksCount.json similarity index 94% rename from lexicons/blue.microcosm/links/getCounts.json rename to lexicons/blue.microcosm/links/getBacklinksCount.json index 1c9dca9..60e5c3c 100644 --- a/lexicons/blue.microcosm/links/getCounts.json +++ b/lexicons/blue.microcosm/links/getBacklinksCount.json @@ -1,6 +1,6 @@ { "lexicon": 1, - "id": "blue.microcosm.links.getCounts", + "id": "blue.microcosm.links.getBacklinksCount", "defs": { "main": { "type": "query", -- 2.51.2