This commit is contained in:
Eric Bailey
2026-01-27 16:26:24 -06:00
parent 6d8effee3f
commit 82938bdaac
+20 -18
View File
@@ -97,28 +97,30 @@ export function useLiveNowConfig(): LiveNowConfig {
const ctx = useContext(LiveNowContext) const ctx = useContext(LiveNowContext)
const canGoLive = useCanGoLive() const canGoLive = useCanGoLive()
const {currentAccount} = useSession() const {currentAccount} = useSession()
const defaultAllowedHosts = new Set(DEFAULT_LIVE_ALLOWED_DOMAINS) return useMemo(() => {
const allowedHostsExceptionsByDid = new Map<string, Set<string>>() const defaultAllowedHosts = new Set(DEFAULT_LIVE_ALLOWED_DOMAINS)
for (const live of ctx) { const allowedHostsExceptionsByDid = new Map<string, Set<string>>()
allowedHostsExceptionsByDid.set( for (const live of ctx) {
live.did, allowedHostsExceptionsByDid.set(
new Set(DEFAULT_LIVE_ALLOWED_DOMAINS.concat(live.domains)), live.did,
) new Set(DEFAULT_LIVE_ALLOWED_DOMAINS.concat(live.domains)),
} )
if (!currentAccount?.did || !canGoLive) }
if (!currentAccount?.did || !canGoLive)
return {
currentAccountAllowedHosts: new Set(),
defaultAllowedHosts,
allowedHostsExceptionsByDid,
}
const vip = ctx.find(live => live.did === currentAccount.did)
return { return {
currentAccountAllowedHosts: new Set(), currentAccountAllowedHosts: new Set(
DEFAULT_LIVE_ALLOWED_DOMAINS.concat(vip ? vip.domains : []),
),
defaultAllowedHosts, defaultAllowedHosts,
allowedHostsExceptionsByDid, allowedHostsExceptionsByDid,
} }
const vip = ctx.find(live => live.did === currentAccount.did) }, [ctx, currentAccount, canGoLive])
return {
currentAccountAllowedHosts: new Set(
DEFAULT_LIVE_ALLOWED_DOMAINS.concat(vip ? vip.domains : []),
),
defaultAllowedHosts,
allowedHostsExceptionsByDid,
}
} }
export function useCanGoLive() { export function useCanGoLive() {