From 2402fc31ed46eb72a7d402cb41465bd78dc900f3 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Sun, 7 Apr 2024 17:05:36 +0200 Subject: [PATCH] [DEV] it works without security --- front/src/app/app-routing.module.ts | 36 ++++++++--------- front/src/app/app.component.html | 3 -- front/src/app/app.component.ts | 39 ++++++++----------- front/src/app/app.module.ts | 8 ++-- .../element-player-audio.less | 6 +-- front/src/app/scene/home/home.html | 2 +- front/src/app/scene/home/home.ts | 14 +++---- front/src/app/service/album.ts | 1 + front/src/app/service/ariane.ts | 2 +- front/src/app/service/artist.ts | 1 + front/src/app/service/gender.ts | 1 + front/src/app/service/playlist.ts | 1 + front/src/app/service/track.ts | 1 + front/src/environments/environment.prod.ts | 4 +- front/src/environments/environment.ts | 27 +++---------- 15 files changed, 61 insertions(+), 85 deletions(-) diff --git a/front/src/app/app-routing.module.ts b/front/src/app/app-routing.module.ts index 089dd1c..4bc414f 100644 --- a/front/src/app/app-routing.module.ts +++ b/front/src/app/app-routing.module.ts @@ -29,13 +29,12 @@ const routes: Routes = [ { path: 'home', component: HomeScene, - canActivate: [OnlyUsersGuardHome], // this route to unregistered path when not logged ==> permit to simplify display + // canActivate: [OnlyUsersGuardHome], // this route to unregistered path when not logged ==> permit to simplify display }, - /* { path: 'unregistered', component: HomeOutScene, - canActivate: [OnlyUnregisteredGuardHome], // jump to the home when registered + // canActivate: [OnlyUnregisteredGuardHome], // jump to the home when registered }, // ------------------------------------ // -- SSO Generic interface @@ -56,7 +55,7 @@ const routes: Routes = [ { path: 'upload', component: UploadScene, - canActivate: [OnlyAdminGuard], + // canActivate: [OnlyAdminGuard], }, // ------------------------------------ // -- gender: @@ -65,13 +64,13 @@ const routes: Routes = [ { path: 'gender', component: GenderScene, - canActivate: [OnlyUsersGuard], + // canActivate: [OnlyUsersGuard], }, // display all (artist | album | traks) { path: 'gender/:genderId', component: GenderScene, - canActivate: [OnlyUsersGuard], + // canActivate: [OnlyUsersGuard], }, //{ path: 'gender-edit/:genderId', component: GenderEditScene }, @@ -84,12 +83,12 @@ const routes: Routes = [ { path: 'playlist', component: PlaylistScene, - canActivate: [OnlyUsersGuard], + // canActivate: [OnlyUsersGuard], }, { path: 'playlist/:playlistId', component: PlaylistScene, - canActivate: [OnlyUsersGuard], + // canActivate: [OnlyUsersGuard], }, //{ path: 'playlist-edit/:playlistId', component: PlaylistEditScene }, @@ -101,23 +100,23 @@ const routes: Routes = [ { path: 'artist', component: ArtistsScene, - canActivate: [OnlyUsersGuard], + // canActivate: [OnlyUsersGuard], }, // display list af all artist with a specific gender { path: 'artist/:artistId', component: ArtistScene, - canActivate: [OnlyUsersGuard], + // canActivate: [OnlyUsersGuard], }, { path: 'artist/:artistId/edit', component: ArtistEditScene, - canActivate: [OnlyAdminGuard], + // canActivate: [OnlyAdminGuard], }, { path: 'artist/:artistId/:albumId', component: ArtistAlbumScene, - canActivate: [OnlyUsersGuard], + // canActivate: [OnlyUsersGuard], }, // ------------------------------------ @@ -127,17 +126,17 @@ const routes: Routes = [ { path: 'album', component: AlbumsScene, - canActivate: [OnlyUsersGuard], + // canActivate: [OnlyUsersGuard], }, { path: 'album/:albumId/edit', component: AlbumEditScene, - canActivate: [OnlyAdminGuard], + // canActivate: [OnlyAdminGuard], }, { path: 'album/:albumId', component: AlbumScene, - canActivate: [OnlyUsersGuard], + // canActivate: [OnlyUsersGuard], }, // ------------------------------------ @@ -146,12 +145,12 @@ const routes: Routes = [ { path: 'track/:trackId/edit', component: TrackEditScene, - canActivate: [OnlyAdminGuard], + // canActivate: [OnlyAdminGuard], }, { path: 'track/:genderId/:artistId/:albumId/:trackId', component: TrackScene, - canActivate: [OnlyUsersGuard], + // canActivate: [OnlyUsersGuard], }, // ------------------------------------ @@ -160,13 +159,12 @@ const routes: Routes = [ { path: 'settings', component: SettingsScene, - canActivate: [OnlyUsersGuard], + // canActivate: [OnlyUsersGuard], }, { path: '**', component: NotFound404Scene, }, -*/ ]; @NgModule({ diff --git a/front/src/app/app.component.html b/front/src/app/app.component.html index 023d639..e123bdb 100644 --- a/front/src/app/app.component.html +++ b/front/src/app/app.component.html @@ -1,8 +1,6 @@ - - \ No newline at end of file diff --git a/front/src/app/app.component.ts b/front/src/app/app.component.ts index 9de00ce..234cb0a 100644 --- a/front/src/app/app.component.ts +++ b/front/src/app/app.component.ts @@ -45,11 +45,11 @@ export class AppComponent implements OnInit { location: string = "home"; constructor( - /*private userService: UserService, private sessionService: SessionService, private ssoService: SSOService, - private arianeService: ArianeService - */) { + private arianeService: ArianeService, + private userService: UserService + ) { } @@ -58,7 +58,6 @@ export class AppComponent implements OnInit { this.isConnected = false; this.updateMainMenu(); let self = this; - /* this.sessionService.change.subscribe((isConnected) => { console.log(`receive event from session ...${isConnected}`); self.isConnected = isConnected; @@ -109,13 +108,11 @@ export class AppComponent implements OnInit { //console.log(`>>> change trackId=${trackId}`); self.updateMainMenu(); }); - */ } eventOnMenu(data: EventOnMenu): void { //console.log(`plopppppppppp ${JSON.stringify(this.route.snapshot.url)}`); - //console.log(`Get event on menu: ${JSON.stringify(data, null, 4)}`); - /* + console.log(`Get event on menu: ${JSON.stringify(data, null, 4)}`); switch (data.menu.otherData) { case MenuEventType.SSO_LOGIN: this.ssoService.requestSignIn(); @@ -154,8 +151,6 @@ export class AppComponent implements OnInit { case MenuEventType.PLAYLIST: break; } - */ - } updateMainMenu(): void { console.log("update main menu :"); @@ -187,35 +182,35 @@ export class AppComponent implements OnInit { title: this.getSegmentDisplayable(), otherData: MenuEventType.TYPE, callback: true, - enable: true//!isNullOrUndefined(this.arianeService.getTypeId()), + enable: !isNullOrUndefined(this.arianeService.getTypeId()), }, { position: MenuPosition.LEFT, icon: "person", - title: "true", //this.arianeService.getArtistName(), + title: this.arianeService.getArtistName(), otherData: MenuEventType.ARTIST, callback: true, - enable: true// !isNullOrUndefined(this.arianeService.getArtistId()), + enable: !isNullOrUndefined(this.arianeService.getArtistId()), }, { position: MenuPosition.LEFT, icon: "album", - title: "true", //this.arianeService.getAlbumName(), + title: this.arianeService.getAlbumName(), otherData: MenuEventType.ALBUM, callback: true, - enable: true// !isNullOrUndefined(this.arianeService.getAlbumId()), + enable: !isNullOrUndefined(this.arianeService.getAlbumId()), }, { position: MenuPosition.LEFT, icon: "music_note", - title: "true", //this.arianeService.getTrackName(), + title: this.arianeService.getTrackName(), otherData: MenuEventType.TRACK, callback: true, - enable: true// !isNullOrUndefined(this.arianeService.getTrackId()), + enable: !isNullOrUndefined(this.arianeService.getTrackId()), }, { position: MenuPosition.LEFT, icon: "queue_music", title: "true",//this.arianeService.getPlaylistName(), otherData: MenuEventType.PLAYLIST, callback: true, - enable: true// !isNullOrUndefined(this.arianeService.getPlaylistId()), + enable: !isNullOrUndefined(this.arianeService.getPlaylistId()), } ], }, { @@ -225,14 +220,14 @@ export class AppComponent implements OnInit { subMenu: [ { position: MenuPosition.LEFT, - hover: "true", //`You are logged as: ${this.sessionService.getLogin()}`, - title: "true", //`Sign in as ${this.sessionService.getLogin()}`, + hover: `You are logged as: ${this.sessionService.getLogin()}`, + title: `Sign in as ${this.sessionService.getLogin()}`, }, { position: MenuPosition.LEFT, icon: "add_circle", title: "Add media", navigateTo: "upload", - enable: true, //this.sessionService.hasRight(UserRoles222.admin), + enable: this.sessionService.hasRight(UserRoles222.admin), }, { position: MenuPosition.LEFT, icon: "settings", @@ -284,7 +279,6 @@ export class AppComponent implements OnInit { } getSegmentDisplayable(): string { - /* let segment = this.arianeService.getCurrrentSegment(); if (segment === "artist") { return "Artists" @@ -299,9 +293,8 @@ export class AppComponent implements OnInit { return "Tracks" } if (segment === "playlist") { - return "Playlistq" + return "Playlist" } - */ return ""; } } diff --git a/front/src/app/app.module.ts b/front/src/app/app.module.ts index 57ee770..f3ff7ce 100644 --- a/front/src/app/app.module.ts +++ b/front/src/app/app.module.ts @@ -24,7 +24,7 @@ import { GenderService, DataService, PlaylistService, ArtistService, AlbumServic import { UploadScene } from './scene/upload/upload'; import { ElementSeriesComponent, ElementTrackComponent, ElementSeasonComponent, ElementVideoComponent, ElementPlayerAudioComponent, DescriptionAreaComponent } from './component'; import { ALL_COMPONENTS, ALL_SCENES, ALL_SERVICES, ALL_GUARDS, KarCWModule, UserService, TopMenuComponent } from '@kangaroo-and-rabbit/kar-cw'; -import { KarusicEnvironmentService, environment } from 'environments/environment'; +import { environment } from 'environments/environment'; import { FormsModule, ReactiveFormsModule } from "@angular/forms"; import { CommonModule } from "@angular/common"; @@ -72,10 +72,10 @@ import { CommonModule } from "@angular/common"; KarCWModule, ], providers: [ - /*KarusicEnvironmentService, - { provide: 'ENVIRONMENT', useValue: KarusicEnvironmentService }, + { provide: 'ENVIRONMENT', useValue: environment }, //...ALL_SERVICES, //...ALL_GUARDS, + ArianeService, PlayerService, GenderService, DataService, @@ -83,8 +83,6 @@ import { CommonModule } from "@angular/common"; ArtistService, AlbumService, TrackService, - ArianeService, - */ ], exports: [ //...ALL_COMPONENTS, diff --git a/front/src/app/component/element-player-audio/element-player-audio.less b/front/src/app/component/element-player-audio/element-player-audio.less index 9eae344..7ffc572 100644 --- a/front/src/app/component/element-player-audio/element-player-audio.less +++ b/front/src/app/component/element-player-audio/element-player-audio.less @@ -17,8 +17,8 @@ .controls-inner { position: relative; - width: fill; - height: fill; + //width: fill; + //height: fill; font-family: monospace; color: white; margin: 10px 15px 1px 15px; @@ -44,7 +44,7 @@ .slider { position: relative; - -webkit-appearance: none; + //-webkit-appearance: none; width: 100%; height: 10px; top: 5px; diff --git a/front/src/app/scene/home/home.html b/front/src/app/scene/home/home.html index 553da3f..a555117 100644 --- a/front/src/app/scene/home/home.html +++ b/front/src/app/scene/home/home.html @@ -5,7 +5,7 @@
@for (data of dataList; track data.id) {
- +
}
diff --git a/front/src/app/scene/home/home.ts b/front/src/app/scene/home/home.ts index 4f2962e..ad55ff5 100644 --- a/front/src/app/scene/home/home.ts +++ b/front/src/app/scene/home/home.ts @@ -11,7 +11,7 @@ import { ArianeService, GenderService } from 'app/service'; @Component({ selector: 'app-home', templateUrl: './home.html', - styleUrls: [ './home.less' ] + styleUrls: ['./home.less'] }) export class HomeScene implements OnInit { dataList = [ @@ -53,17 +53,17 @@ export class HomeScene implements OnInit { */ this.arianeService.reset(); } - onSelectType(event: any, idSelected: number):void { + onSelectType(event: any, idSelected: number): void { if (idSelected === 1) { - this.arianeService.navigateGender({newWindows: event.which === 2}); + this.arianeService.navigateGender({ newWindows: event.which === 2 }); } else if (idSelected === 2) { - this.arianeService.navigateArtist({newWindows: event.which === 2}); + this.arianeService.navigateArtist({ newWindows: event.which === 2 }); } else if (idSelected === 3) { - this.arianeService.navigateAlbum({newWindows: event.which === 2}); + this.arianeService.navigateAlbum({ newWindows: event.which === 2 }); } else if (idSelected === 4) { - this.arianeService.navigateTrack({newWindows: event.which === 2}); + this.arianeService.navigateTrack({ newWindows: event.which === 2 }); } else if (idSelected === 5) { - this.arianeService.navigatePlaylist({newWindows: event.which === 2}); + this.arianeService.navigatePlaylist({ newWindows: event.which === 2 }); } } } diff --git a/front/src/app/service/album.ts b/front/src/app/service/album.ts index eb87c21..cb72d1b 100644 --- a/front/src/app/service/album.ts +++ b/front/src/app/service/album.ts @@ -28,6 +28,7 @@ export class AlbumService extends GenericDataService { constructor(private session: SessionService) { super(); + console.log('Start AlbumService'); this.setStore(new DataStore(() => this.lambdaGets())); } diff --git a/front/src/app/service/ariane.ts b/front/src/app/service/ariane.ts index e870e30..daea519 100644 --- a/front/src/app/service/ariane.ts +++ b/front/src/app/service/ariane.ts @@ -58,7 +58,7 @@ export class ArianeService { private artistService: ArtistService, private albumService: AlbumService, private trackService: TrackService) { - //console.log('Start ArianeService'); + console.log('Start ArianeService'); //this.route. let self = this; this.router.events.subscribe((event: any) => { diff --git a/front/src/app/service/artist.ts b/front/src/app/service/artist.ts index 5d3e512..8aabdce 100644 --- a/front/src/app/service/artist.ts +++ b/front/src/app/service/artist.ts @@ -28,6 +28,7 @@ export class ArtistService extends GenericDataService { constructor(private session: SessionService) { super(); + console.log('Start ArtistService'); const self = this; this.setStore(new DataStore(() => self.lambdaGets())); } diff --git a/front/src/app/service/gender.ts b/front/src/app/service/gender.ts index 4c806e5..afcb9bb 100644 --- a/front/src/app/service/gender.ts +++ b/front/src/app/service/gender.ts @@ -33,6 +33,7 @@ export class GenderService extends GenericDataService { constructor(private session: SessionService) { super(); + console.log('Start GenderService'); const self = this; this.setStore(new DataStore(() => this.lambdaGets())); } diff --git a/front/src/app/service/playlist.ts b/front/src/app/service/playlist.ts index 621b336..2ca46ee 100644 --- a/front/src/app/service/playlist.ts +++ b/front/src/app/service/playlist.ts @@ -27,6 +27,7 @@ export class PlaylistService extends GenericDataService { constructor(private session: SessionService) { super(); + console.log('Start PlaylistService'); const self = this; this.setStore(new DataStore(() => this.lambdaGets())); } diff --git a/front/src/app/service/track.ts b/front/src/app/service/track.ts index a9b3a6c..82ba984 100644 --- a/front/src/app/service/track.ts +++ b/front/src/app/service/track.ts @@ -27,6 +27,7 @@ export class TrackService extends GenericDataService { constructor(private session: SessionService) { super(); + console.log('Start TrackService'); const self = this; this.setStore(new DataStore(() => this.lambdaGets())); } diff --git a/front/src/environments/environment.prod.ts b/front/src/environments/environment.prod.ts index 496f691..a3781a5 100644 --- a/front/src/environments/environment.prod.ts +++ b/front/src/environments/environment.prod.ts @@ -3,7 +3,9 @@ // `ng build --env=prod` then `environment.prod.ts` will be used instead. // The list of which env maps to which file can be found in `.angular-cli.json`. -export const environment = { +import { Environment } from "@kangaroo-and-rabbit/kar-cw"; + +export const environment: Environment = { production: true, // URL of development API applName: "karusic", diff --git a/front/src/environments/environment.ts b/front/src/environments/environment.ts index ab7fa03..8f255f3 100644 --- a/front/src/environments/environment.ts +++ b/front/src/environments/environment.ts @@ -3,12 +3,11 @@ // `ng build --env=prod` then `environment.prod.ts` will be used instead. // The list of which env maps to which file can be found in `.angular-cli.json`. -import { Injectable } from "@angular/core"; -import { EnvironmentService } from '@kangaroo-and-rabbit/kar-cw'; +import { Environment } from "@kangaroo-and-rabbit/kar-cw"; const serverSSOAddress = 'http://atria-soft.org' -const environment_back_prod = { +const environment_back_prod: Environment = { production: false, // URL of development API applName: "karusic", @@ -24,7 +23,7 @@ const environment_back_prod = { tokenStoredInPermanentStorage: false, }; -const environment_local = { +const environment_local: Environment = { production: false, // URL of development API applName: "karusic", @@ -40,7 +39,7 @@ const environment_local = { tokenStoredInPermanentStorage: false, }; -const environment_full_local = { +const environment_full_local: Environment = { production: false, // URL of development API applName: "karusic", @@ -56,7 +55,7 @@ const environment_full_local = { tokenStoredInPermanentStorage: false, }; -const environment_hybrid = { +const environment_hybrid: Environment = { production: false, // URL of development API applName: "karusic", @@ -73,19 +72,3 @@ const environment_hybrid = { }; export const environment = environment_local; - - -@Injectable({ providedIn: 'root' }) -export class KarusicEnvironmentService extends EnvironmentService { - - public production = environment.production; - // URL of development API - public applName = environment.applName; - public defaultServer = environment.defaultServer; - public server = environment.server; - public ssoSite = environment.ssoSite; - public ssoSignIn = environment.ssoSignIn; - public ssoSignUp = environment.ssoSignUp; - public ssoSignOut = environment.ssoSignOut; - public tokenStoredInPermanentStorage = environment.tokenStoredInPermanentStorage; -}; \ No newline at end of file