diff --git a/src/components/note/note-contents.tsx b/src/components/note/note-contents.tsx index 095c66fd3..9f34a842d 100644 --- a/src/components/note/note-contents.tsx +++ b/src/components/note/note-contents.tsx @@ -47,7 +47,8 @@ const embeds: EmbedType[] = [ }, // Twitter tweet { - regexp: /https?:\/\/twitter\.com\/(?:\#!\/)?(\w+)\/status(es)?\/(\d+)[^\s]*/im, + regexp: + /https?:\/\/twitter\.com\/(?:\#!\/)?(\w+)\/status(es)?\/(\d+)(\??(?:[\?#\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?/im, render: (match) => , name: "Tweet", isMedia: true, @@ -96,7 +97,7 @@ const embeds: EmbedType[] = [ }, // Youtube Music { - regexp: /https?:\/\/music\.youtube\.com\/watch\?v=(\w+)[^\s]*/, + regexp: /https?:\/\/music\.youtube\.com\/watch\?v=(\w+)(\??(?:[\?#\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?/, render: (match) => ( { const isList = match[1] === "album" || match[1] === "playlist"; return ( @@ -152,7 +154,7 @@ const embeds: EmbedType[] = [ // note1tvqk2mu829yr6asf7w5dgpp8t0mlp2ax5t26ctfdx8m0ptkssamqsleeux // note1ygx9tec3af92704d92jwrj3zs7cws2jl29yvrlxzqlcdlykhwssqpupa7t { - regexp: /https?:\/\/music\.apple\.com\/[^\s]*/im, + regexp: /https?:\/\/music\.apple\.com(?:\/[\+~%\/\.\w\-_]*)?(\??(?:[\?#\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?/, render: (match) => ( { const ImageComponent = trusted || !settings.blurImages.value ? Image : BlurredImage; return ; @@ -178,14 +182,18 @@ const embeds: EmbedType[] = [ }, // Video { - regexp: /(https?:\/\/)([\da-z\.-]+\.[a-z\.]{2,6})([\/\w\.-]+\.(mp4|mkv|webm|mov))[^\s]*/im, + regexp: + /https?:\/\/([\dA-z\.-]+\.[A-z\.]{2,6})((?:\/[\+~%\/\.\w\-_]*)?\.(?:mp4|mkv|webm|mov))(\??(?:[\?#\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?/, render: (match) => , name: "Video", isMedia: true, }, // Link + // based on http://urlregex.com/ + // note1c34vht0lu2qzrgr4az3u8jn5xl3fycr2gfpahkepthg7hzlqg26sr59amt { - regexp: /(https?:\/\/[^\s]*)/im, + regexp: + /https?:\/\/([\dA-z\.-]+\.[A-z\.]{2,6})((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?/, render: (match) => ( {match[0]} diff --git a/src/services/client-relays.ts b/src/services/client-relays.ts index 27f718c2c..4c1c8ad9f 100644 --- a/src/services/client-relays.ts +++ b/src/services/client-relays.ts @@ -35,7 +35,12 @@ class ClientRelayService { lastSubject = undefined; } - lastSubject = userRelaysService.requestRelays(account.pubkey, Array.from(this.bootstrapRelays), true); + // load the relays from cache or bootstrap relays + lastSubject = userRelaysService.requestRelays(account.pubkey, Array.from(this.bootstrapRelays)); + setTimeout(() => { + // double check for new relay notes + userRelaysService.requestRelays(account.pubkey, this.getWriteUrls(), true); + }, 1000); lastSubject.subscribe(this.handleRelayChanged, this); }); diff --git a/src/views/relays/index.tsx b/src/views/relays/index.tsx index b0b7eb233..946ab4b03 100644 --- a/src/views/relays/index.tsx +++ b/src/views/relays/index.tsx @@ -22,6 +22,7 @@ import { RelayConfig, RelayMode } from "../../classes/relay"; import { useList } from "react-use"; import { RelayUrlInput } from "../../components/relay-url-input"; import useSubject from "../../hooks/use-subject"; +import { RelayStatus } from "../../components/relay-status"; export const RelaysView = () => { const relays = useSubject(clientRelaysService.relays); @@ -71,6 +72,7 @@ export const RelaysView = () => { Url + Status @@ -83,6 +85,9 @@ export const RelaysView = () => { {relay.url} + + + {pendingAdd.includes(relay) && (