diff --git a/src/components/Config.tsx b/src/components/Config.tsx index 2486ce1..91ff0b5 100644 --- a/src/components/Config.tsx +++ b/src/components/Config.tsx @@ -6,13 +6,13 @@ type ConfigProps = { }; const RelayConfig = () => { - const { config, setConfig, addRelay, removeRelay } = useConfig(); + const { config, addRelay, removeRelay } = useConfig(); const [relayUrlInput, setRelayUrlInput] = createSignal(''); const handleClickAddRelay: JSX.EventHandler = (ev) => { ev.preventDefault(); - if (relayUrlInput().length > 0) return; + if (relayUrlInput().length === 0) return; addRelay(relayUrlInput()); setRelayUrlInput(''); }; diff --git a/src/components/notification/Reaction.tsx b/src/components/notification/Reaction.tsx index f1afed9..4ce89b7 100644 --- a/src/components/notification/Reaction.tsx +++ b/src/components/notification/Reaction.tsx @@ -44,7 +44,7 @@ const Reaction: Component = (props) => {
-
+
= (props) => { return (
-
+
{/* TODO 画像は脆弱性回避のためにimgじゃない方法で読み込みたい */} void; }; -const InitialLoginStatus = { +const InitialPersistStatus = { loggedIn: false, agreeWithNostrBuild: false, }; @@ -25,25 +25,21 @@ const deserializer = (json: string): PersistStatus => JSON.parse(json) as Persis const storage = createStorageWithSerializer(() => window.localStorage, serializer, deserializer); -const [persistStatus, setLoginStatus] = createSignalWithStorage( - 'RabbitLoginStatus', - InitialLoginStatus, +const [persistStatus, setPersistStatus] = createSignalWithStorage( + 'RabbitPersistStatus', + InitialPersistStatus, storage, ); const usePersistStatus = (): UsePersistStatus => { const loggedIn = () => { - setLoginStatus((current) => ({ ...current, loggedIn: true })); + setPersistStatus((current) => ({ ...current, loggedIn: true })); }; return { persistStatus: () => ({ - get loggedIn() { - return persistStatus().loggedIn ?? false; - }, - get agreeWithNostrBuild() { - return persistStatus().agreeWithNostrBuild ?? false; - }, + ...InitialPersistStatus, + ...persistStatus(), }), loggedIn, }; diff --git a/src/nostr/useConfig.ts b/src/nostr/useConfig.ts index 1bddc9d..8e2ac48 100644 --- a/src/nostr/useConfig.ts +++ b/src/nostr/useConfig.ts @@ -20,7 +20,7 @@ type UseConfig = { const InitialConfig: Config = { relayUrls: [ 'wss://relay-jp.nostr.wirednet.jp', - 'wss://nostr.h3z.jp/', + 'wss://nostr.h3z.jp', 'wss://relay.damus.io', 'wss://nos.lol', 'wss://relay.snort.social', @@ -55,7 +55,12 @@ const useConfig = (): UseConfig => { })); }; - return { config, setConfig, addRelay, removeRelay }; + return { + config: () => ({ ...InitialConfig, ...config() }), + setConfig, + addRelay, + removeRelay, + }; }; export default useConfig; diff --git a/src/utils/imageUrl.ts b/src/utils/imageUrl.ts index a569ddf..3cc04c8 100644 --- a/src/utils/imageUrl.ts +++ b/src/utils/imageUrl.ts @@ -1,8 +1,5 @@ -const domains = ['i.imgur.com', 'imgur.com', 'i.gyazo.com']; - export const isImageUrl = (url: URL): boolean => { if (url.pathname.match(/\.(jpeg|jpg|png|gif|webp)$/i)) return true; - if (domains.includes(url.host)) return true; return false; };