Merge branch 'develop' into new_custom_woka_scene
This commit is contained in:
@@ -320,10 +320,11 @@ export class AuthenticateController extends BaseHttpController {
|
||||
|
||||
//todo: what to do if the organizationMemberToken is already used?
|
||||
const organizationMemberToken: string | null = param.organizationMemberToken;
|
||||
const playUri: string | null = param.playUri;
|
||||
|
||||
try {
|
||||
if (typeof organizationMemberToken != "string") throw new Error("No organization token");
|
||||
const data = await adminApi.fetchMemberDataByToken(organizationMemberToken);
|
||||
const data = await adminApi.fetchMemberDataByToken(organizationMemberToken, playUri);
|
||||
const userUuid = data.userUuid;
|
||||
const email = data.email;
|
||||
const roomUrl = data.roomUrl;
|
||||
|
||||
@@ -21,6 +21,7 @@ import {
|
||||
FollowConfirmationMessage,
|
||||
FollowAbortMessage,
|
||||
VariableMessage,
|
||||
LockGroupPromptMessage,
|
||||
} from "../Messages/generated/messages_pb";
|
||||
import { UserMovesMessage } from "../Messages/generated/messages_pb";
|
||||
import { parse } from "query-string";
|
||||
@@ -561,6 +562,11 @@ export class IoSocketController {
|
||||
);
|
||||
} else if (message.hasFollowabortmessage()) {
|
||||
socketManager.handleFollowAbort(client, message.getFollowabortmessage() as FollowAbortMessage);
|
||||
} else if (message.hasLockgrouppromptmessage()) {
|
||||
socketManager.handleLockGroup(
|
||||
client,
|
||||
message.getLockgrouppromptmessage() as LockGroupPromptMessage
|
||||
);
|
||||
}
|
||||
|
||||
/* Ok is false if backpressure was built up, wait for drain */
|
||||
|
||||
@@ -13,14 +13,14 @@ export class OpenIdProfileController extends BaseHttpController {
|
||||
}
|
||||
try {
|
||||
const resCheckTokenAuth = await openIDClient.checkTokenAuth(accessToken as string);
|
||||
if (!resCheckTokenAuth.email) {
|
||||
if (!resCheckTokenAuth.sub) {
|
||||
throw new Error("Email was not found");
|
||||
}
|
||||
res.send(
|
||||
this.buildHtml(
|
||||
OPID_CLIENT_ISSUER,
|
||||
resCheckTokenAuth.email as string,
|
||||
resCheckTokenAuth.picture as string | undefined
|
||||
resCheckTokenAuth.sub
|
||||
/*resCheckTokenAuth.picture as string | undefined*/
|
||||
)
|
||||
);
|
||||
return;
|
||||
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
import { ClientReadableStream } from "grpc";
|
||||
import { PositionDispatcher } from "_Model/PositionDispatcher";
|
||||
import Debug from "debug";
|
||||
import { BoolValue, UInt32Value } from "google-protobuf/google/protobuf/wrappers_pb";
|
||||
|
||||
const debug = Debug("zone");
|
||||
|
||||
@@ -123,19 +124,25 @@ export class UserDescriptor {
|
||||
}
|
||||
|
||||
export class GroupDescriptor {
|
||||
private constructor(public readonly groupId: number, private groupSize: number, private position: PointMessage) {}
|
||||
private constructor(
|
||||
public readonly groupId: number,
|
||||
private groupSize: number | undefined,
|
||||
private position: PointMessage,
|
||||
private locked: boolean | undefined
|
||||
) {}
|
||||
|
||||
public static createFromGroupUpdateZoneMessage(message: GroupUpdateZoneMessage): GroupDescriptor {
|
||||
const position = message.getPosition();
|
||||
if (position === undefined) {
|
||||
throw new Error("Missing position");
|
||||
}
|
||||
return new GroupDescriptor(message.getGroupid(), message.getGroupsize(), position);
|
||||
return new GroupDescriptor(message.getGroupid(), message.getGroupsize(), position, message.getLocked());
|
||||
}
|
||||
|
||||
public update(groupDescriptor: GroupDescriptor) {
|
||||
this.groupSize = groupDescriptor.groupSize;
|
||||
this.position = groupDescriptor.position;
|
||||
this.locked = groupDescriptor.locked;
|
||||
}
|
||||
|
||||
public toGroupUpdateMessage(): GroupUpdateMessage {
|
||||
@@ -144,9 +151,13 @@ export class GroupDescriptor {
|
||||
throw new Error("GroupDescriptor.groupId is not an integer: " + this.groupId);
|
||||
}
|
||||
groupUpdateMessage.setGroupid(this.groupId);
|
||||
groupUpdateMessage.setGroupsize(this.groupSize);
|
||||
if (this.groupSize !== undefined) {
|
||||
groupUpdateMessage.setGroupsize(new UInt32Value().setValue(this.groupSize));
|
||||
}
|
||||
groupUpdateMessage.setPosition(this.position);
|
||||
|
||||
if (this.locked !== undefined) {
|
||||
groupUpdateMessage.setLocked(new BoolValue().setValue(this.locked));
|
||||
}
|
||||
return groupUpdateMessage;
|
||||
}
|
||||
}
|
||||
@@ -206,9 +217,7 @@ export class Zone {
|
||||
this.notifyGroupMove(groupDescriptor);
|
||||
} else {
|
||||
this.groups.set(groupId, groupDescriptor);
|
||||
|
||||
const fromZone = groupUpdateZoneMessage.getFromzone();
|
||||
|
||||
this.notifyGroupEnter(groupDescriptor, fromZone?.toObject());
|
||||
}
|
||||
} else if (message.hasUserleftzonemessage()) {
|
||||
|
||||
@@ -61,7 +61,7 @@ class AdminApi {
|
||||
|
||||
async fetchMemberDataByUuid(
|
||||
userIdentifier: string | null,
|
||||
roomId: string,
|
||||
playUri: string,
|
||||
ipAddress: string,
|
||||
characterLayers: string[]
|
||||
): Promise<FetchMemberDataByUuidResponse> {
|
||||
@@ -69,7 +69,12 @@ class AdminApi {
|
||||
return Promise.reject(new Error("No admin backoffice set!"));
|
||||
}
|
||||
const res = await Axios.get<unknown, AxiosResponse<unknown>>(ADMIN_API_URL + "/api/room/access", {
|
||||
params: { userIdentifier, roomId, ipAddress, characterLayers },
|
||||
params: {
|
||||
userIdentifier,
|
||||
playUri,
|
||||
ipAddress,
|
||||
characterLayers,
|
||||
},
|
||||
headers: { Authorization: `${ADMIN_API_TOKEN}` },
|
||||
paramsSerializer: (p) => {
|
||||
return qs.stringify(p, { arrayFormat: "brackets" });
|
||||
@@ -84,12 +89,13 @@ class AdminApi {
|
||||
return res.data;
|
||||
}
|
||||
|
||||
async fetchMemberDataByToken(organizationMemberToken: string): Promise<AdminApiData> {
|
||||
async fetchMemberDataByToken(organizationMemberToken: string, playUri: string | null): Promise<AdminApiData> {
|
||||
if (!ADMIN_API_URL) {
|
||||
return Promise.reject(new Error("No admin backoffice set!"));
|
||||
}
|
||||
//todo: this call can fail if the corresponding world is not activated or if the token is invalid. Handle that case.
|
||||
const res = await Axios.get(ADMIN_API_URL + "/api/login-url/" + organizationMemberToken, {
|
||||
params: { playUri },
|
||||
headers: { Authorization: `${ADMIN_API_TOKEN}` },
|
||||
});
|
||||
if (!isAdminApiData(res.data)) {
|
||||
|
||||
@@ -38,6 +38,7 @@ import {
|
||||
ErrorMessage,
|
||||
WorldFullMessage,
|
||||
PlayerDetailsUpdatedMessage,
|
||||
LockGroupPromptMessage,
|
||||
InvalidTextureMessage,
|
||||
} from "../Messages/generated/messages_pb";
|
||||
import { ProtobufUtils } from "../Model/Websocket/ProtobufUtils";
|
||||
@@ -297,6 +298,12 @@ export class SocketManager implements ZoneEventListener {
|
||||
client.backConnection.write(pusherToBackMessage);
|
||||
}
|
||||
|
||||
handleLockGroup(client: ExSocketInterface, message: LockGroupPromptMessage): void {
|
||||
const pusherToBackMessage = new PusherToBackMessage();
|
||||
pusherToBackMessage.setLockgrouppromptmessage(message);
|
||||
client.backConnection.write(pusherToBackMessage);
|
||||
}
|
||||
|
||||
onEmote(emoteMessage: EmoteEventMessage, listener: ExSocketInterface): void {
|
||||
const subMessage = new SubMessage();
|
||||
subMessage.setEmoteeventmessage(emoteMessage);
|
||||
|
||||
Reference in New Issue
Block a user