1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-03 09:49:20 +02:00

Support raw strings for AP to/cc

This commit is contained in:
Chocobozzz 2025-05-09 11:36:21 +02:00
parent 5138e28ff8
commit 8d3bc24c4b
No known key found for this signature in database
GPG key ID: 583A612D890159BE
9 changed files with 76 additions and 66 deletions

View file

@ -1,3 +1,4 @@
import { arrayify } from '@peertube/peertube-core-utils'
import { ContextType } from '@peertube/peertube-models'
import { ACTIVITY_PUB, REMOTE_SCHEME } from '@server/initializers/constants.js'
import { isArray } from './custom-validators/misc.js'
@ -53,12 +54,10 @@ export function getAPPublicValue (): 'https://www.w3.org/ns/activitystreams#Publ
return 'https://www.w3.org/ns/activitystreams#Public'
}
export function hasAPPublic (toOrCC: string[]) {
if (!isArray(toOrCC)) return false
export function hasAPPublic (toOrCC: string[] | string) {
const publicValue = getAPPublicValue()
return toOrCC.some(f => f === 'as:Public' || publicValue)
return arrayify(toOrCC).some(f => f === 'as:Public' || publicValue)
}
// ---------------------------------------------------------------------------