Add wss:// to user relays by default (#1412)

This commit is contained in:
ekzyis 2024-09-18 22:42:48 +02:00 committed by GitHub
parent 5088673b84
commit dcbe83f155
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -618,7 +618,7 @@ export const settingsSchema = object().shape({
string().nullable().matches(NOSTR_PUBKEY_HEX, 'must be 64 hex chars'),
string().nullable().matches(NOSTR_PUBKEY_BECH32, 'invalid bech32 encoding')], 'invalid pubkey'),
nostrRelays: array().of(
string().ws()
string().ws().transform(relay => relay.startsWith('wss://') ? relay : `wss://${relay}`)
).max(NOSTR_MAX_RELAY_NUM,
({ max, value }) => `${Math.abs(max - value.length)} too many`),
hideBookmarks: boolean(),

View File

@ -170,7 +170,9 @@ export default function Settings ({ ssrData }) {
}
}
const nostrRelaysFiltered = nostrRelays?.filter(word => word.trim().length > 0)
const nostrRelaysFiltered = nostrRelays
?.filter(word => word.trim().length > 0)
.map(relay => relay.startsWith('wss://') ? relay : `wss://${relay}`)
try {
await setSettings({