mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 02:09:37 +02:00
Follow works
This commit is contained in:
parent
e34c85e527
commit
350e31d6b6
39 changed files with 431 additions and 169 deletions
25
server/helpers/custom-validators/webfinger.ts
Normal file
25
server/helpers/custom-validators/webfinger.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import 'express-validator'
|
||||
import 'multer'
|
||||
import { CONFIG } from '../../initializers/constants'
|
||||
import { exists } from './misc'
|
||||
|
||||
function isWebfingerResourceValid (value: string) {
|
||||
if (!exists(value)) return false
|
||||
if (value.startsWith('acct:') === false) return false
|
||||
|
||||
const accountWithHost = value.substr(5)
|
||||
const accountParts = accountWithHost.split('@')
|
||||
if (accountParts.length !== 2) return false
|
||||
|
||||
const host = accountParts[1]
|
||||
|
||||
if (host !== CONFIG.WEBSERVER.HOST) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export {
|
||||
isWebfingerResourceValid
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue