[APP-1784] Proper fix for Live Now status not showing (#9779)

* Be sure to validate if actor is allowed to be live on certain domain

* Rename for clarity

* Memoize
This commit is contained in:
Eric Bailey
2026-01-27 16:44:27 -06:00
committed by GitHub
parent 26605ee730
commit 39e7132fd8
4 changed files with 38 additions and 21 deletions
+7 -1
View File
@@ -3,6 +3,7 @@ import {
type $Typed,
type AppBskyActorDefs,
AppBskyEmbedExternal,
AtUri,
} from '@atproto/api'
import {isAfter, parseISO} from 'date-fns'
@@ -73,10 +74,15 @@ export function isStatusValidForViewers(
config: LiveNowConfig,
) {
if (status.status !== 'app.bsky.actor.status#live') return false
if (!status.uri) return false // should not happen, just backwards compat
try {
const {host: liveDid} = new AtUri(status.uri)
if (AppBskyEmbedExternal.isView(status.embed)) {
const url = new URL(status.embed.external.uri)
return config.allSupportedDomains.has(url.hostname)
const exception = config.allowedHostsExceptionsByDid.get(liveDid)
const isValidException = exception ? exception.has(url.hostname) : false
const isValidForAnyone = config.defaultAllowedHosts.has(url.hostname)
return isValidException || isValidForAnyone
} else {
return false
}