feat: use close relays
This commit is contained in:
14
packages/app/src/External/SnortApi.ts
vendored
14
packages/app/src/External/SnortApi.ts
vendored
@ -68,6 +68,16 @@ export interface TranslationResponse {
|
||||
}>;
|
||||
}
|
||||
|
||||
export interface RelayDistance {
|
||||
url: string;
|
||||
distance: number;
|
||||
users: number;
|
||||
country?: string;
|
||||
city?: string;
|
||||
is_paid?: boolean;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export default class SnortApi {
|
||||
#url: string;
|
||||
#publisher?: EventPublisher;
|
||||
@ -121,6 +131,10 @@ export default class SnortApi {
|
||||
return this.#getJson<TranslationResponse | object>("api/v1/translate", "POST", tx);
|
||||
}
|
||||
|
||||
closeRelays(lat: number, lon: number, count = 5) {
|
||||
return this.#getJson<Array<RelayDistance>>(`api/v1/relays?count=${count}`, "POST", { lat, lon });
|
||||
}
|
||||
|
||||
async #getJsonAuthd<T>(
|
||||
path: string,
|
||||
method?: "GET" | string,
|
||||
|
Reference in New Issue
Block a user