Add some commands for setting relays
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@welshman",
|
"name": "@welshman",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.8.8",
|
"version": "0.8.9",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@welshman/app",
|
"name": "@welshman/app",
|
||||||
"version": "0.8.8",
|
"version": "0.8.9",
|
||||||
"author": "hodlbod",
|
"author": "hodlbod",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "A collection of svelte stores for use in building nostr client applications.",
|
"description": "A collection of svelte stores for use in building nostr client applications.",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {get} from "svelte/store"
|
import {get} from "svelte/store"
|
||||||
import {uniq, now, nthNe, removeUndefined, nthEq} from "@welshman/lib"
|
import {uniq, reject, nth, now, nthNe, removeUndefined, nthEq} from "@welshman/lib"
|
||||||
import {
|
import {
|
||||||
sendManagementRequest,
|
sendManagementRequest,
|
||||||
ManagementRequest,
|
ManagementRequest,
|
||||||
@@ -104,6 +104,34 @@ export const setRelays = async (tags: string[][]) => {
|
|||||||
return publishThunk({event, relays})
|
return publishThunk({event, relays})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const setReadRelays = async (urls: string[]) => {
|
||||||
|
await forceLoadUserRelayList([])
|
||||||
|
|
||||||
|
const list = get(userRelayList) || makeList({kind: RELAYS})
|
||||||
|
const writeRelays = reject(nthEq(2, RelayMode.Read), getRelayTags(getListTags(list))).map(nth(1))
|
||||||
|
const writeTags = writeRelays.map(url => ["r", url, RelayMode.Write])
|
||||||
|
const readTags = urls.map(url => ["r", url, RelayMode.Read])
|
||||||
|
const tags = [...writeTags, ...readTags]
|
||||||
|
const event = {kind: list.kind, content: list.event?.content || "", tags}
|
||||||
|
const relays = Router.get().FromUser().policy(addMaximalFallbacks).getUrls()
|
||||||
|
|
||||||
|
return publishThunk({event, relays})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const setWriteRelays = async (urls: string[]) => {
|
||||||
|
await forceLoadUserRelayList([])
|
||||||
|
|
||||||
|
const list = get(userRelayList) || makeList({kind: RELAYS})
|
||||||
|
const readRelays = reject(nthEq(2, RelayMode.Write), getRelayTags(getListTags(list))).map(nth(1))
|
||||||
|
const readTags = readRelays.map(url => ["r", url, RelayMode.Read])
|
||||||
|
const writeTags = urls.map(url => ["r", url, RelayMode.Write])
|
||||||
|
const tags = [...readTags, ...writeTags]
|
||||||
|
const event = {kind: list.kind, content: list.event?.content || "", tags}
|
||||||
|
const relays = Router.get().FromUser().policy(addMaximalFallbacks).getUrls()
|
||||||
|
|
||||||
|
return publishThunk({event, relays})
|
||||||
|
}
|
||||||
|
|
||||||
// NIP 17
|
// NIP 17
|
||||||
|
|
||||||
export const removeMessagingRelay = async (url: string) => {
|
export const removeMessagingRelay = async (url: string) => {
|
||||||
@@ -133,7 +161,7 @@ export const setMessagingRelays = async (urls: string[]) => {
|
|||||||
return publishThunk({event, relays})
|
return publishThunk({event, relays})
|
||||||
}
|
}
|
||||||
|
|
||||||
// NIP 51
|
// Blocked Relays
|
||||||
|
|
||||||
export const removeBlockedRelay = async (url: string) => {
|
export const removeBlockedRelay = async (url: string) => {
|
||||||
await forceLoadUserBlockedRelayList([])
|
await forceLoadUserBlockedRelayList([])
|
||||||
@@ -162,6 +190,8 @@ export const setBlockedRelays = async (urls: string[]) => {
|
|||||||
return publishThunk({event, relays})
|
return publishThunk({event, relays})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Search Relays
|
||||||
|
|
||||||
export const removeSearchRelay = async (url: string) => {
|
export const removeSearchRelay = async (url: string) => {
|
||||||
await forceLoadUserSearchRelayList([])
|
await forceLoadUserSearchRelayList([])
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@welshman/content",
|
"name": "@welshman/content",
|
||||||
"version": "0.8.8",
|
"version": "0.8.9",
|
||||||
"author": "hodlbod",
|
"author": "hodlbod",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "A collection of utilities for parsing nostr note content.",
|
"description": "A collection of utilities for parsing nostr note content.",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@welshman/editor",
|
"name": "@welshman/editor",
|
||||||
"version": "0.8.8",
|
"version": "0.8.9",
|
||||||
"author": "hodlbod",
|
"author": "hodlbod",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "A batteries-included nostr editor.",
|
"description": "A batteries-included nostr editor.",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@welshman/feeds",
|
"name": "@welshman/feeds",
|
||||||
"version": "0.8.8",
|
"version": "0.8.9",
|
||||||
"author": "hodlbod",
|
"author": "hodlbod",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "Utilities for building dynamic nostr feeds.",
|
"description": "Utilities for building dynamic nostr feeds.",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@welshman/lib",
|
"name": "@welshman/lib",
|
||||||
"version": "0.8.8",
|
"version": "0.8.9",
|
||||||
"author": "hodlbod",
|
"author": "hodlbod",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "A collection of utilities.",
|
"description": "A collection of utilities.",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@welshman/net",
|
"name": "@welshman/net",
|
||||||
"version": "0.8.8",
|
"version": "0.8.9",
|
||||||
"author": "hodlbod",
|
"author": "hodlbod",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "Utilities for connecting with nostr relays.",
|
"description": "Utilities for connecting with nostr relays.",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@welshman/router",
|
"name": "@welshman/router",
|
||||||
"version": "0.8.8",
|
"version": "0.8.9",
|
||||||
"author": "hodlbod",
|
"author": "hodlbod",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "A collection of utilities for nostr relay selection.",
|
"description": "A collection of utilities for nostr relay selection.",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@welshman/signer",
|
"name": "@welshman/signer",
|
||||||
"version": "0.8.8",
|
"version": "0.8.9",
|
||||||
"author": "hodlbod",
|
"author": "hodlbod",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "A nostr signer implemenation supporting several login methods.",
|
"description": "A nostr signer implemenation supporting several login methods.",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@welshman/store",
|
"name": "@welshman/store",
|
||||||
"version": "0.8.8",
|
"version": "0.8.9",
|
||||||
"author": "hodlbod",
|
"author": "hodlbod",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "A collection of utilities based on svelte/store for use with welshman",
|
"description": "A collection of utilities based on svelte/store for use with welshman",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@welshman/util",
|
"name": "@welshman/util",
|
||||||
"version": "0.8.8",
|
"version": "0.8.9",
|
||||||
"author": "hodlbod",
|
"author": "hodlbod",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "A collection of nostr-related utilities.",
|
"description": "A collection of nostr-related utilities.",
|
||||||
|
|||||||
Reference in New Issue
Block a user