wip: relay manegament screen

This commit is contained in:
Ren Amamiya
2023-09-30 19:07:17 +07:00
parent a2e3247432
commit 11ed618a7f
10 changed files with 248 additions and 38 deletions

View File

@@ -310,6 +310,13 @@ export class LumeStorage {
}
public async createRelay(relay: string, purpose?: string) {
const existRelays: Relays[] = await this.db.select(
'SELECT * FROM relays WHERE relay = $1 AND account_id = $2 ORDER BY id DESC LIMIT 1;',
[relay, this.account.id]
);
if (existRelays.length > 0) return false;
return await this.db.execute(
'INSERT OR IGNORE INTO relays (account_id, relay, purpose) VALUES ($1, $2, $3);',
[this.account.id, relay, purpose || '']