Search node aliases for mentions

Mentioning someone starts from their alias, but aliases are
self-declared and unrelated nodes often share one. Results say who is
followed or is you, so the composer can tell them apart.

Co-Authored-By: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
Brandon Oxendine
2026-10-05 17:29:02 +02:00
committed by Rūdolfs Ošiņš
co-authored by Rūdolfs Ošiņš
parent b461f0bce2
commit bee84e9d40
6 changed files with 213 additions and 1 deletions
+13
View File
@@ -145,6 +145,7 @@ pub fn router(shared: Shared) -> Router {
.route("/startup", post(startup_handler))
.route("/config", post(config_handler))
.route("/alias", post(alias_handler))
.route("/search_aliases", post(search_aliases_handler))
.route("/authenticate", post(auth_handler))
.route("/check_radicle_cli", post(check_radicle_cli_handler))
.route("/node_running", post(node_running_handler))
@@ -287,6 +288,18 @@ async fn node_running_handler(Ctx(ctx): Ctx) -> impl IntoResponse {
Ok::<_, Error>(Json(ctx.node_running()))
}
#[derive(Deserialize)]
struct SearchAliasesBody {
pub query: Option<String>,
}
async fn search_aliases_handler(
Ctx(ctx): Ctx,
Json(SearchAliasesBody { query }): Json<SearchAliasesBody>,
) -> impl IntoResponse {
Ok::<_, Error>(Json(ctx.search_aliases(query)))
}
#[derive(Serialize, Deserialize)]
pub struct Options {
show: Show,