respect user's relay list (kind 10002)

This commit is contained in:
Ren Amamiya
2023-09-19 08:01:57 +07:00
parent 380d1fb930
commit 60e93965ea
7 changed files with 30 additions and 26 deletions

View File

@@ -283,15 +283,14 @@ export class LumeStorage {
}
public async getExplicitRelayUrls() {
if (!this.account) return null;
if (!this.account) return FULL_RELAYS;
const result: Relays[] = await this.db.select(
`SELECT * FROM relays WHERE account_id = "${this.account.id}" ORDER BY id DESC LIMIT 50;`
);
if (result.length < 1) return FULL_RELAYS;
// return [...new Set(result.map((el) => el.relay))];
return FULL_RELAYS;
if (!result || result.length < 1) return FULL_RELAYS;
return result.map((el) => el.relay);
}
public async createRelay(relay: string, purpose?: string) {