forked from coracle/flotilla
Publish default relay selections on signup
This commit is contained in:
@@ -11,6 +11,8 @@ VITE_PLATFORM_ACCENT="#7161FF"
|
||||
VITE_PLATFORM_SECONDARY="#EB5E28"
|
||||
VITE_PLATFORM_DESCRIPTION="Flotilla is nostr — for communities."
|
||||
VITE_INDEXER_RELAYS=purplepag.es,relay.damus.io,indexer.coracle.social
|
||||
VITE_DEFAULT_RELAYS=relay.damus.io,relay.primal.net,nostr.mom
|
||||
VITE_DEFAULT_MESSAGING_RELAYS=auth.nostr1.com
|
||||
VITE_SIGNER_RELAYS=relay.nsec.app,ephemeral.snowflare.cc,bucket.coracle.social
|
||||
VITE_NOTIFIER_PUBKEY=27b7c2ed89ef78322114225ea3ebf5f72c7767c2528d4d0c1854d039c00085df
|
||||
VITE_NOTIFIER_RELAY=anchor.coracle.social
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* Add support for blocked relays
|
||||
* Add authentication policy setting
|
||||
* Add login with key if no signer is detected
|
||||
* Publish default relay selections on signup
|
||||
|
||||
# 1.6.2
|
||||
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
<script lang="ts">
|
||||
import type {ClientOptions} from "@pomade/core"
|
||||
import type {Profile} from "@welshman/util"
|
||||
import {makeProfile, makeSecret, getPubkey} from "@welshman/util"
|
||||
import {loginWithNip01, loginWithPomade} from "@welshman/app"
|
||||
import {
|
||||
makeProfile,
|
||||
makeSecret,
|
||||
getPubkey,
|
||||
RELAYS,
|
||||
MESSAGING_RELAYS,
|
||||
makeEvent,
|
||||
} from "@welshman/util"
|
||||
import {loginWithNip01, loginWithPomade, publishThunk} from "@welshman/app"
|
||||
import Key from "@assets/icons/key-minimalistic.svg?dataurl"
|
||||
import Letter from "@assets/icons/letter.svg?dataurl"
|
||||
import {getKey, setKey} from "@lib/implicit"
|
||||
@@ -17,7 +24,13 @@
|
||||
import {setChecked} from "@app/util/notifications"
|
||||
import {pushModal, clearModals} from "@app/util/modal"
|
||||
import {initProfile} from "@app/core/commands"
|
||||
import {POMADE_SIGNERS, PLATFORM_NAME} from "@app/core/state"
|
||||
import {
|
||||
POMADE_SIGNERS,
|
||||
PLATFORM_NAME,
|
||||
INDEXER_RELAYS,
|
||||
DEFAULT_RELAYS,
|
||||
DEFAULT_MESSAGING_RELAYS,
|
||||
} from "@app/core/state"
|
||||
|
||||
setKey("signup.email", "")
|
||||
setKey("signup.secret", makeSecret())
|
||||
@@ -28,6 +41,29 @@
|
||||
|
||||
const login = () => pushModal(LogIn)
|
||||
|
||||
const completeSignup = () => {
|
||||
// Add default outbox/inbox relays
|
||||
publishThunk({
|
||||
event: makeEvent(RELAYS, {tags: DEFAULT_RELAYS.map(url => ["r", url])}),
|
||||
relays: [...INDEXER_RELAYS, ...DEFAULT_RELAYS],
|
||||
})
|
||||
|
||||
// Add default messaging relays
|
||||
publishThunk({
|
||||
event: makeEvent(MESSAGING_RELAYS, {tags: DEFAULT_MESSAGING_RELAYS.map(url => ["r", url])}),
|
||||
relays: DEFAULT_RELAYS,
|
||||
})
|
||||
|
||||
// Save the user's profile
|
||||
initProfile(getKey<Profile>("signup.profile")!)
|
||||
|
||||
// Don't show any notifications for old content
|
||||
setChecked("*")
|
||||
|
||||
// Go to the dashboard
|
||||
clearModals()
|
||||
}
|
||||
|
||||
const flows = {
|
||||
email: {
|
||||
start: () => pushModal(SignUpEmail, {next: flows.email.profile}),
|
||||
@@ -36,13 +72,10 @@
|
||||
finalize: () => {
|
||||
const email = getKey<string>("signup.email")!
|
||||
const secret = getKey<string>("signup.secret")!
|
||||
const profile = getKey<Profile>("signup.profile")!
|
||||
const clientOptions = getKey<ClientOptions>("signup.clientOptions")!
|
||||
|
||||
loginWithPomade(getPubkey(secret), email, clientOptions!)
|
||||
initProfile(profile)
|
||||
setChecked("*")
|
||||
clearModals()
|
||||
loginWithPomade(getPubkey(secret), email, clientOptions)
|
||||
completeSignup()
|
||||
},
|
||||
},
|
||||
nostr: {
|
||||
@@ -51,12 +84,9 @@
|
||||
complete: () => pushModal(SignUpComplete, {next: flows.nostr.finalize}),
|
||||
finalize: () => {
|
||||
const secret = getKey<string>("signup.secret")!
|
||||
const profile = getKey<Profile>("signup.profile")!
|
||||
|
||||
loginWithNip01(secret)
|
||||
initProfile(profile)
|
||||
setChecked("*")
|
||||
clearModals()
|
||||
completeSignup()
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -142,6 +142,12 @@ export const SIGNER_RELAYS = fromCsv(import.meta.env.VITE_SIGNER_RELAYS).map(nor
|
||||
|
||||
export const INDEXER_RELAYS = fromCsv(import.meta.env.VITE_INDEXER_RELAYS).map(normalizeRelayUrl)
|
||||
|
||||
export const DEFAULT_RELAYS = fromCsv(import.meta.env.VITE_DEFAULT_RELAYS).map(normalizeRelayUrl)
|
||||
|
||||
export const DEFAULT_MESSAGING_RELAYS = fromCsv(import.meta.env.VITE_DEFAULT_MESSAGING_RELAYS).map(
|
||||
normalizeRelayUrl,
|
||||
)
|
||||
|
||||
export const PLATFORM_RELAYS = fromCsv(import.meta.env.VITE_PLATFORM_RELAYS).map(normalizeRelayUrl)
|
||||
|
||||
export const PLATFORM_URL = import.meta.env.VITE_PLATFORM_URL
|
||||
|
||||
Reference in New Issue
Block a user