Fixed events on server when user logs in.
parent
b5dd7f0ee4
commit
549176b86e
|
|
@ -192,7 +192,14 @@ class Peer extends EventEmitter
|
|||
|
||||
set displayName(displayName)
|
||||
{
|
||||
this._displayName = displayName;
|
||||
if (displayName !== this._displayName)
|
||||
{
|
||||
const oldDisplayName = this._displayName;
|
||||
|
||||
this._displayName = displayName;
|
||||
|
||||
this.emit('displayNameChanged', { oldDisplayName });
|
||||
}
|
||||
}
|
||||
|
||||
get picture()
|
||||
|
|
@ -202,7 +209,14 @@ class Peer extends EventEmitter
|
|||
|
||||
set picture(picture)
|
||||
{
|
||||
this._picture = picture;
|
||||
if (picture !== this._picture)
|
||||
{
|
||||
const oldPicture = this._picture;
|
||||
|
||||
this._picture = picture;
|
||||
|
||||
this.emit('pictureChanged', { oldPicture });
|
||||
}
|
||||
}
|
||||
|
||||
get email()
|
||||
|
|
|
|||
|
|
@ -339,6 +339,33 @@ class Room extends EventEmitter
|
|||
this.selfDestructCountdown();
|
||||
}
|
||||
});
|
||||
|
||||
peer.on('displayNameChanged', ({ oldDisplayName }) =>
|
||||
{
|
||||
// Ensure the Peer is joined.
|
||||
if (!peer.data.joined)
|
||||
throw new Error('Peer not yet joined');
|
||||
|
||||
// Spread to others
|
||||
this._notification(peer.socket, 'changeDisplayName', {
|
||||
peerId : peer.id,
|
||||
displayName : peer.displayName,
|
||||
oldDisplayName : oldDisplayName
|
||||
}, true);
|
||||
});
|
||||
|
||||
peer.on('pictureChanged', () =>
|
||||
{
|
||||
// Ensure the Peer is joined.
|
||||
if (!peer.data.joined)
|
||||
throw new Error('Peer not yet joined');
|
||||
|
||||
// Spread to others
|
||||
this._notification(peer.socket, 'changePicture', {
|
||||
peerId : peer.id,
|
||||
picture : peer.picture
|
||||
}, true);
|
||||
});
|
||||
}
|
||||
|
||||
async _handleSocketRequest(peer, request, cb)
|
||||
|
|
|
|||
|
|
@ -177,10 +177,8 @@ async function setupAuth(oidcIssuer)
|
|||
// any of the supported values directly, i.e. "S256" (recommended) or "plain"
|
||||
const usePKCE = false;
|
||||
|
||||
const client = oidcClient;
|
||||
|
||||
oidcStrategy = new Strategy(
|
||||
{ client, params, passReqToCallback, usePKCE },
|
||||
{ client: oidcClient, params, passReqToCallback, usePKCE },
|
||||
(tokenset, userinfo, done) =>
|
||||
{
|
||||
const user =
|
||||
|
|
@ -286,6 +284,8 @@ async function setupAuth(oidcIssuer)
|
|||
const peer = peers.get(state.id);
|
||||
|
||||
peer && (peer.authenticated = true);
|
||||
peer && (peer.displayName = displayName);
|
||||
peer && (peer.picture = picture);
|
||||
|
||||
res.send(httpHelper({
|
||||
displayName,
|
||||
|
|
|
|||
Loading…
Reference in New Issue