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

View File

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

View File

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

View File

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

View File

@ -16,6 +16,5 @@ export class AppComponent implements OnInit {
ngOnInit() {
this.contextService.setVersion(packageInfo.version);
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