Add server domain
This commit is contained in:
parent
857360c4d2
commit
bbe5e468ce
@ -4,7 +4,7 @@ import adminAccessToken from '../config/synapse_access_token.json'
|
|||||||
import { IdMapping } from '../entity/IdMapping'
|
import { IdMapping } from '../entity/IdMapping'
|
||||||
import log from '../helpers/logger'
|
import log from '../helpers/logger'
|
||||||
import { createMembership, getUserId, save } from '../helpers/storage'
|
import { createMembership, getUserId, save } from '../helpers/storage'
|
||||||
import { axios } from '../helpers/synapse'
|
import { axios, getUserDomain } from '../helpers/synapse'
|
||||||
|
|
||||||
export type RcUser = {
|
export type RcUser = {
|
||||||
_id: string
|
_id: string
|
||||||
@ -76,7 +76,7 @@ async function registerUser(user: MatrixUser): Promise<AccessToken> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function userAlreadyExists(user: MatrixUser): Promise<boolean> {
|
async function userAlreadyExists(user: MatrixUser): Promise<boolean> {
|
||||||
const user_data = (await axios.get('/_synapse/admin/v2/users/' + user.username)).data
|
const user_data = (await axios.get('/_synapse/admin/v2/users/@' + user.username + ":" + getUserDomain())).data
|
||||||
log.debug(`Mapping exists:`, user_data)
|
log.debug(`Mapping exists:`, user_data)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,6 +14,10 @@ export interface SessionOptions {
|
|||||||
[others: string]: unknown
|
[others: string]: unknown
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getUserDomain(): string {
|
||||||
|
return "m-rc.jennett-wheeler.co.uk"
|
||||||
|
}
|
||||||
|
|
||||||
export { default as axios } from 'axios'
|
export { default as axios } from 'axios'
|
||||||
export const whoami = () =>
|
export const whoami = () =>
|
||||||
new Promise<void>((resolve, reject) => {
|
new Promise<void>((resolve, reject) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user