Federation (#327)
* initial commit federation * more federation * more federation * more federation * completes follow, accept, undo * add trail create activity * process trail create activity * more trail create activity * adds missing endpoints * adds update and delete activity * adds comment activities * adds activities back * adds summit logs activities * deletes follow counts table * fixes migrations * fixes migrations * fixes migrations * fixes migrations * adds remote profiles * ctd * ctd * we are getting closer... * adds public summit logs * fixes federated trails in lists * adds remote lists * adds list activites * fixes lists * adds notifications * adds iri redirect * fixes comments and summitlogs * fixes follows and profiles * adds asynchronous send * fixes list search * adds encryption key * bug fixes * fixes activity signing * removes custon activity object types * adds html editor * fixes html editor * fixes display issues on mastodon * adds federated sharing * finishes announcements * fixes small summit log issues * adds trail likes * finalizes likes * fixes images for komoot * add disable federation option * adds private profiles * updates docs * adds federated comments * adds trail and comments actvitiypub routes * adds mentions to editor * adds mentions to trails, comments, summit logs * updates theme * updates theme * update docs * update docs * updates docs * fixes various frontend problems * fixes activitypub follows api * updates docs * updates docs --------- Co-authored-by: Christian Beutel <>
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import { env } from "$env/dynamic/public";
|
||||
import { defaultTrailSearchAttributes } from "$lib/models/trail";
|
||||
import type { Actor } from "$lib/models/activitypub/actor";
|
||||
import { defaultTrailSearchAttributes, type TrailSearchResult } from "$lib/models/trail";
|
||||
import { APIError } from "$lib/util/api_util";
|
||||
import type { Hits, MultiSearchParams, MultiSearchResponse, MultiSearchResult, SearchParams, SearchResponse } from "meilisearch";
|
||||
import type { ListResult } from "pocketbase";
|
||||
|
||||
export type LocationSearchResult = {
|
||||
name: string;
|
||||
@@ -12,37 +14,23 @@ export type LocationSearchResult = {
|
||||
type: string;
|
||||
}
|
||||
|
||||
export type TrailSearchResult = {
|
||||
id: string;
|
||||
_geo: {
|
||||
lat: number,
|
||||
lon: number
|
||||
}
|
||||
author: string;
|
||||
category: string;
|
||||
completed: boolean;
|
||||
created: number;
|
||||
date: number;
|
||||
description: string;
|
||||
difficulty: "easy" | "moderate" | "difficult"
|
||||
distance: number;
|
||||
duration: number
|
||||
elevation_gain: number;
|
||||
elevation_loss: number
|
||||
location: string;
|
||||
name: string;
|
||||
public: boolean;
|
||||
polyline?: string;
|
||||
}
|
||||
|
||||
export type ListSearchResult = {
|
||||
id: string;
|
||||
author: string;
|
||||
author_name: string;
|
||||
author_avatar: string;
|
||||
avatar?: string;
|
||||
created: number;
|
||||
description: string;
|
||||
name: string;
|
||||
elevation_gain: number;
|
||||
elevation_loss: number;
|
||||
distance: number,
|
||||
duration: number,
|
||||
public: boolean;
|
||||
trails: string[]
|
||||
trails: number
|
||||
shares?: string[];
|
||||
iri?: string;
|
||||
}
|
||||
|
||||
type NominatimResponse = {
|
||||
@@ -202,4 +190,21 @@ export async function searchMulti(options: MultiSearchParams): Promise<MultiSear
|
||||
|
||||
|
||||
return response.results
|
||||
}
|
||||
|
||||
export async function searchActors(q: string, includeSelf: boolean = true): Promise<Actor[]> {
|
||||
try {
|
||||
const r = await fetch(`/api/v1/search/actor?q=${q}&includeSelf=${includeSelf}`,)
|
||||
|
||||
if (!r.ok) {
|
||||
return []
|
||||
}
|
||||
const response: ListResult<Actor> = await r.json()
|
||||
|
||||
return response.items
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
|
||||
return []
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user