Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@internxt/css-config": "^1.0.2",
"@internxt/eslint-config-internxt": "^2.0.0",
"@internxt/lib": "^1.2.0",
"@internxt/sdk": "=1.11.8",
"@internxt/sdk": "=1.11.9",
"@internxt/ui": "0.0.25",
"@jitsi/excalidraw": "https://github.com/jitsi/excalidraw/releases/download/v0.0.17/jitsi-excalidraw-0.0.17.tgz",
"@jitsi/js-utils": "2.2.1",
Expand Down
7 changes: 7 additions & 0 deletions react/features/base/connection/actions.any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
} from '../util/uri';

import { setJoinRoomError } from "../meet/general/store/errors/actions";
import { LocalStorageManager } from "../meet/LocalStorageManager";
import MeetingService from "../meet/services/meeting.service";
import {
CONNECTION_DISCONNECTED,
Expand Down Expand Up @@ -238,10 +239,16 @@ export function _connectInternal({

if (room !== NEW_MEETING_URL)
try {
let userUUID: string | undefined;

if (isAnonymous) {
userUUID = LocalStorageManager.instance.getOrCreateAnonymousUUID();
}
const { token: jwt, appId } = await MeetingService.instance.joinCall(room, {
name: displayName ?? name ?? "",
lastname: lastname ?? "",
anonymous: !!isAnonymous,
anonymousId: userUUID,
});

const newOptions = get8x8Options(options, appId, room);
Expand Down
4 changes: 2 additions & 2 deletions react/features/base/connection/actions.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function connect(id?: string, password?: string) {
password,
name: user?.name,
lastname: user?.lastname,
isAnonymous: !!user,
isAnonymous: !user,
})
)
);
Expand All @@ -67,7 +67,7 @@ export function connect(id?: string, password?: string) {
password,
name: user?.name,
lastname: user?.lastname,
isAnonymous: !!user,
isAnonymous: !user,
})
);
};
Expand Down
39 changes: 39 additions & 0 deletions react/features/base/meet/LocalStorageManager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { UserSubscription } from "@internxt/sdk/dist/drive/payments/types/types";
import { v4 } from "uuid";
import { User } from "./general/store/user/types";

/**
Expand All @@ -19,6 +20,7 @@ export class LocalStorageManager {
MNEMONIC: "xMnemonic",
USER: "xUser",
SUBSCRIPTION: "xSubscription",
ANONYMOUS_USER_UUID: "xAnonymousUserUUID",
};

private constructor() {}
Expand Down Expand Up @@ -184,6 +186,42 @@ export class LocalStorageManager {
this.remove(LocalStorageManager.KEYS.SUBSCRIPTION);
}

/**
* Generates and stores a UUID for anonymous users
* @returns The generated or existing UUID
*/
public getOrCreateAnonymousUUID(): string {
let uuid = this.get<string>(LocalStorageManager.KEYS.ANONYMOUS_USER_UUID);

if (!uuid) {
uuid = v4();
this.set(LocalStorageManager.KEYS.ANONYMOUS_USER_UUID, uuid);
}

return uuid;
}

/**
* Gets the anonymous user UUID
*/
public getAnonymousUUID(): string | null | undefined {
return this.get<string>(LocalStorageManager.KEYS.ANONYMOUS_USER_UUID);
}

/**
* Sets the anonymous user UUID
*/
public setAnonymousUUID(uuid: string): void {
this.set(LocalStorageManager.KEYS.ANONYMOUS_USER_UUID, uuid);
}

/**
* Removes the anonymous user UUID
*/
public removeAnonymousUUID(): void {
this.remove(LocalStorageManager.KEYS.ANONYMOUS_USER_UUID);
}

/**
* Saves the session credentials
* @param token Token
Expand Down Expand Up @@ -218,6 +256,7 @@ export class LocalStorageManager {
this.remove(LocalStorageManager.KEYS.MNEMONIC);
this.remove(LocalStorageManager.KEYS.USER);
this.remove(LocalStorageManager.KEYS.SUBSCRIPTION);
this.remove(LocalStorageManager.KEYS.ANONYMOUS_USER_UUID);
}

public clearStorage(): void {
Expand Down
Loading