mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 02:39:33 +02:00
Add ability for instances to follow any actor
This commit is contained in:
parent
7f28f2ddba
commit
4d029ef8ec
45 changed files with 884 additions and 528 deletions
|
@ -1,4 +1,4 @@
|
|||
import { exists } from './misc'
|
||||
import { exists, isArray } from './misc'
|
||||
import { FollowState } from '@shared/models'
|
||||
|
||||
function isFollowStateValid (value: FollowState) {
|
||||
|
@ -7,8 +7,24 @@ function isFollowStateValid (value: FollowState) {
|
|||
return value === 'pending' || value === 'accepted'
|
||||
}
|
||||
|
||||
function isRemoteHandleValid (value: string) {
|
||||
if (!exists(value)) return false
|
||||
if (typeof value !== 'string') return false
|
||||
|
||||
return value.includes('@')
|
||||
}
|
||||
|
||||
function isEachUniqueHandleValid (handles: string[]) {
|
||||
return isArray(handles) &&
|
||||
handles.every(handle => {
|
||||
return isRemoteHandleValid(handle) && handles.indexOf(handle) === handles.lastIndexOf(handle)
|
||||
})
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export {
|
||||
isFollowStateValid
|
||||
isFollowStateValid,
|
||||
isRemoteHandleValid,
|
||||
isEachUniqueHandleValid
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ function isHostValid (host: string) {
|
|||
|
||||
function isEachUniqueHostValid (hosts: string[]) {
|
||||
return isArray(hosts) &&
|
||||
hosts.length !== 0 &&
|
||||
hosts.every(host => {
|
||||
return isHostValid(host) && hosts.indexOf(host) === hosts.lastIndexOf(host)
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue