From fbb6e786538a6196ce88801e9159a4b561c6bacc Mon Sep 17 00:00:00 2001 From: Carlos Santos <4a.santos@gmail.com> Date: Thu, 13 Mar 2025 12:39:05 +0100 Subject: [PATCH] frontend: remove unused StorageAppService and related credential handling in HomeComponent --- frontend/src/app/pages/home/home.component.ts | 15 +---- frontend/src/app/services/storage.service.ts | 57 ------------------- 2 files changed, 2 insertions(+), 70 deletions(-) delete mode 100644 frontend/src/app/services/storage.service.ts diff --git a/frontend/src/app/pages/home/home.component.ts b/frontend/src/app/pages/home/home.component.ts index 83f4357..f07d5d8 100644 --- a/frontend/src/app/pages/home/home.component.ts +++ b/frontend/src/app/pages/home/home.component.ts @@ -17,7 +17,6 @@ import { ActivatedRoute, Router } from '@angular/router'; import { Subscription } from 'rxjs'; // import { ConfigService } from '@app/services/config.service'; -import { StorageAppService } from '@app/services/storage.service'; import { HttpService, OpenViduMeetRoomOptions } from 'projects/shared-meet-components/src/public-api'; import packageInfo from '../../../../package.json'; @@ -47,7 +46,6 @@ export class HomeComponent implements OnInit, OnDestroy { private router: Router, public formBuilder: UntypedFormBuilder, private httpService: HttpService, - private storageService: StorageAppService, // private callService: ConfigService, private fb: FormBuilder, private route: ActivatedRoute @@ -74,13 +72,6 @@ export class HomeComponent implements OnInit, OnDestroy { // this.isPrivateAccess = this.callService.isPrivateAccess(); if (this.isPrivateAccess) { - const userCredentials = this.storageService.getParticipantCredentials(); - - if (!userCredentials) return; - - await this.httpService.userLogin(userCredentials); - this.storageService.setParticipantCredentials(userCredentials); - // this.username = this.storageService.getParticipantName(); this.isUserLogged = true; this.loginError = false; } @@ -121,7 +112,6 @@ export class HomeComponent implements OnInit, OnDestroy { try { await this.httpService.userLogin({ username: this.username, password }); - this.storageService.setParticipantCredentials({ username: this.username, password }); this.isUserLogged = true; } catch (error) { this.isUserLogged = false; @@ -133,7 +123,6 @@ export class HomeComponent implements OnInit, OnDestroy { async logout() { try { await this.httpService.userLogout(); - this.storageService.clearParticipantCredentials(); this.loginError = false; this.isUserLogged = false; } catch (error) { @@ -160,14 +149,14 @@ export class HomeComponent implements OnInit, OnDestroy { this.roomForm.get('roomNamePrefix')?.setValue(roomNamePrefix); - const publisherUrl = new URL(room.publisherRoomUrl); + const publisherUrl = new URL(room.moderatorRoomUrl); const queryParams = publisherUrl.searchParams; const path = publisherUrl.pathname.slice(1); // !FIXME here, the participantName is not set and the guard of VideoRoomComponent will need it. // Possibly, when standalone mode, the room should be created in prejoin page instead of home page. - this.router.navigate(['/',path], { queryParams: { secret: queryParams.get('secret') } }); + this.router.navigate(['/', path], { queryParams: { secret: queryParams.get('secret') } }); } catch (error) { console.error('Error creating room ', error); } diff --git a/frontend/src/app/services/storage.service.ts b/frontend/src/app/services/storage.service.ts deleted file mode 100644 index c37a4f4..0000000 --- a/frontend/src/app/services/storage.service.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { Injectable } from '@angular/core'; -// import { LoggerService, StorageService } from 'openvidu-components-angular'; -// import { STORAGE_PREFIX, StorageAppKeys } from '../models/storage.model'; - -/** - * @internal - */ -@Injectable({ - providedIn: 'root' -}) -export class StorageAppService /*extends StorageService*/ { - // constructor(loggerSrv: LoggerService) { - // super(loggerSrv); - // this.PREFIX_KEY = STORAGE_PREFIX; - // } - - setAdminCredentials(credentials: { username: string; password: string }) { - // const encodedCredentials = btoa(`${credentials.username}:${credentials.password}`); - // this.set(StorageAppKeys.ADMIN_CREDENTIALS, encodedCredentials); - } - - getAdminCredentials(): { username: string; password: string } | undefined { - // const encodedCredentials = this.get(StorageAppKeys.ADMIN_CREDENTIALS); - - // if (encodedCredentials) { - // const [username, password] = atob(encodedCredentials).split(':'); - // return { username, password }; - // } - - return undefined; - } - - clearAdminCredentials() { - // this.remove(StorageAppKeys.ADMIN_CREDENTIALS); - } - - setParticipantCredentials(credentials: { username: string; password: string }) { - // const encodedCredentials = btoa(`${credentials.username}:${credentials.password}`); - // this.setParticipantName(credentials.username); - // this.set(StorageAppKeys.PARTICIPANT_CREDENTIALS, encodedCredentials); - } - - getParticipantCredentials(): { username: string; password: string } | null { - // const encodedCredentials = this.get(StorageAppKeys.PARTICIPANT_CREDENTIALS); - - // if (encodedCredentials) { - // const [username, password] = atob(encodedCredentials).split(':'); - // return { username, password }; - // } - - return null; - } - - clearParticipantCredentials() { - // this.remove(StorageAppKeys.PARTICIPANT_CREDENTIALS); - } -}