frontend: update context service and models to use SecurityPreferences, remove background image handling, and clean up app component

This commit is contained in:
juancarmore 2025-05-31 00:15:00 +02:00
parent 5ee89437b5
commit 1a94a24329
7 changed files with 22 additions and 38 deletions

View File

@ -7,12 +7,20 @@ import { MatSidenav, MatSidenavModule } from '@angular/material/sidenav';
import { MatToolbarModule } from '@angular/material/toolbar'; import { MatToolbarModule } from '@angular/material/toolbar';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { ConsoleNavLink } from '../../models/sidenav.model'; import { ConsoleNavLink } from '../../models/sidenav.model';
import { ContextService } from 'shared-meet-components';
import packageJson from 'package.json';
@Component({ @Component({
selector: 'ov-console-nav', selector: 'ov-console-nav',
standalone: true, standalone: true,
imports: [CommonModule, MatToolbarModule, MatListModule, MatButtonModule, MatIconModule, MatSidenavModule, RouterModule], imports: [
CommonModule,
MatToolbarModule,
MatListModule,
MatButtonModule,
MatIconModule,
MatSidenavModule,
RouterModule
],
templateUrl: './console-nav.component.html', templateUrl: './console-nav.component.html',
styleUrl: './console-nav.component.scss' styleUrl: './console-nav.component.scss'
}) })
@ -21,11 +29,15 @@ export class ConsoleNavComponent {
isMobile = false; isMobile = false;
isTablet = false; isTablet = false;
isSideMenuCollapsed = false; isSideMenuCollapsed = false;
version: string = packageJson.version; version = '';
@Input() navLinks: ConsoleNavLink[] = [];
@Input() navLinks: ConsoleNavLink[] = [];
@Output() onLogoutClicked: EventEmitter<void> = new EventEmitter<void>(); @Output() onLogoutClicked: EventEmitter<void> = new EventEmitter<void>();
constructor(private contextService: ContextService) {
this.version = this.contextService.getVersion();
}
async toggleSideMenu() { async toggleSideMenu() {
if (this.isMobile) { if (this.isMobile) {
this.isSideMenuCollapsed = false; this.isSideMenuCollapsed = false;

View File

@ -2,7 +2,7 @@ import {
OpenViduMeetPermissions, OpenViduMeetPermissions,
ParticipantRole, ParticipantRole,
RecordingPermissions, RecordingPermissions,
SecurityPreferencesDTO SecurityPreferences
} from 'projects/shared-meet-components/src/public-api'; } from 'projects/shared-meet-components/src/public-api';
export interface ContextData { export interface ContextData {
@ -10,9 +10,8 @@ export interface ContextData {
edition: Edition; edition: Edition;
version: string; version: string;
parentDomain: string; parentDomain: string;
securityPreferences?: SecurityPreferencesDTO; securityPreferences?: SecurityPreferences;
openviduLogoUrl: string; openviduLogoUrl: string;
backgroundImageUrl: string;
roomId: string; roomId: string;
secret: string; secret: string;
participantName: string; participantName: string;

View File

@ -18,7 +18,6 @@ export class ContextService {
parentDomain: '', parentDomain: '',
securityPreferences: undefined, securityPreferences: undefined,
openviduLogoUrl: '', openviduLogoUrl: '',
backgroundImageUrl: '',
roomId: '', roomId: '',
secret: '', secret: '',
participantName: '', participantName: '',
@ -90,28 +89,9 @@ export class ContextService {
return this.context.openviduLogoUrl; return this.context.openviduLogoUrl;
} }
setBackgroundImageUrl(backgroundImageUrl: string): void { async getAuthModeToAccessRoom(): Promise<AuthMode> {
this.context.backgroundImageUrl = backgroundImageUrl;
}
getBackgroundImageUrl(): string {
return this.context.backgroundImageUrl;
}
async canUsersCreateRooms(): Promise<boolean> {
await this.getSecurityPreferences(); await this.getSecurityPreferences();
return this.context.securityPreferences!.roomCreationPolicy.allowRoomCreation; return this.context.securityPreferences!.authentication.authModeToAccessRoom;
}
async isAuthRequiredToCreateRooms(): Promise<boolean> {
await this.getSecurityPreferences();
const requireAuthentication = this.context.securityPreferences!.roomCreationPolicy.requireAuthentication;
return requireAuthentication !== undefined && requireAuthentication;
}
async getAuthModeToEnterRoom(): Promise<AuthMode> {
await this.getSecurityPreferences();
return this.context.securityPreferences!.authentication.authMode;
} }
setRoomId(roomId: string): void { setRoomId(roomId: string): void {

View File

@ -7,7 +7,7 @@ import {
MeetRoomPreferences, MeetRoomPreferences,
MeetRoomRoleAndPermissions, MeetRoomRoleAndPermissions,
ParticipantOptions, ParticipantOptions,
SecurityPreferencesDTO, SecurityPreferences,
User User
} from '@lib/typings/ce'; } from '@lib/typings/ce';
import { lastValueFrom } from 'rxjs'; import { lastValueFrom } from 'rxjs';
@ -66,12 +66,7 @@ export class HttpService {
return this.postRequest(`${this.INTERNAL_API_PATH_PREFIX}/participants/token/refresh`, participantOptions); return this.postRequest(`${this.INTERNAL_API_PATH_PREFIX}/participants/token/refresh`, participantOptions);
} }
/** getSecurityPreferences(): Promise<SecurityPreferences> {
* Retrieves security preferences.
*
* @returns {Promise<GlobalPreferences>} A promise that resolves to the global preferences.
*/
getSecurityPreferences(): Promise<SecurityPreferencesDTO> {
return this.getRequest(`${this.INTERNAL_API_PATH_PREFIX}/preferences/security`); return this.getRequest(`${this.INTERNAL_API_PATH_PREFIX}/preferences/security`);
} }

View File

@ -1,2 +1 @@
<!--The content below is only a placeholder and can be replaced.-->
<router-outlet></router-outlet> <router-outlet></router-outlet>

View File

@ -16,6 +16,5 @@ export class AppComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.contextService.setVersion(packageInfo.version); this.contextService.setVersion(packageInfo.version);
this.contextService.setOpenViduLogoUrl('assets/images/openvidu_logo.png'); this.contextService.setOpenViduLogoUrl('assets/images/openvidu_logo.png');
this.contextService.setBackgroundImageUrl('/assets/images/bg.webp');
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB