Builtin Prosody: use Peertube domain instead of localhost.

This commit is contained in:
John Livingston
2021-05-06 13:31:55 +02:00
parent 2e7c5b295a
commit f590cf2c7b
6 changed files with 43 additions and 19 deletions

View File

@ -1,7 +1,10 @@
import { getProsodyDomain } from './domain'
interface Affiliations { [jid: string]: 'outcast' | 'none' | 'member' | 'admin' | 'owner' }
async function getVideoAffiliations (options: RegisterServerOptions, video: MVideoThumbnail): Promise<Affiliations> {
const peertubeHelpers = options.peertubeHelpers
const prosodyDomain = await getProsodyDomain(options)
// Get all admins and moderators
const [results] = await peertubeHelpers.database.query(
'SELECT "username" FROM "user"' +
@ -19,7 +22,7 @@ async function getVideoAffiliations (options: RegisterServerOptions, video: MVid
if (!('username' in result)) {
throw new Error('getVideoAffiliations: no username field in result')
}
const jid = (result.username as string) + '@localhost'
const jid = (result.username as string) + '@' + prosodyDomain
r[jid] = 'owner'
}
@ -29,7 +32,7 @@ async function getVideoAffiliations (options: RegisterServerOptions, video: MVid
if (!video.remote) {
// don't add the video owner if it is a remote video!
const userName = await _getVideoOwnerUsername(options, video)
const userJid = userName + '@localhost'
const userJid = userName + '@' + prosodyDomain
r[userJid] = 'admin'
}
} catch (error) {