replace queue with worker

This commit is contained in:
Jon Staab
2024-03-26 11:35:30 -07:00
parent 0b5a4e8511
commit bc21228f04
7 changed files with 144 additions and 126 deletions
+8 -2
View File
@@ -17,7 +17,13 @@ export const isShareableRelayUrl = (url: string) =>
!url.slice(6).match(/\/npub/)
)
export const normalizeRelayUrl = (url: string) => {
type NormalizeRelayUrlOpts = {
allowInsecure?: boolean
}
export const normalizeRelayUrl = (url: string, {allowInsecure = false}: NormalizeRelayUrlOpts = {}) => {
const prefix = allowInsecure ? url.match(/^wss?:\/\//)?.[0] || "wss://" : "wss://"
// Use our library to normalize
url = normalizeUrl(url, {stripHash: true, stripAuthentication: false})
@@ -29,5 +35,5 @@ export const normalizeRelayUrl = (url: string) => {
url += "/"
}
return "wss://" + url
return prefix + url
}