F: implemented config service in components

This commit is contained in:
X4Lo committed 2025-02-15 23:58:27 +01:00
1 parent cfda451f71
commit 4c5a355dc6
11 files changed
+74 -43

No files matched your search

@@ -7,11 +7,11 @@ import {
} from '@fullcalendar/core';
import dayGridPlugin from '@fullcalendar/daygrid';
import interactionPlugin from '@fullcalendar/interaction';
import { environment } from '../../../../environments/environment.prod';
import { Entry } from '../../../shared/models/entry.model';
import { Router } from '@angular/router';
import { ToastService } from '../../../shared/services/toast.service';
import { EntryService } from '../../../core/services/entry.service';
import { ConfigService } from '../../../core/services/config.service';
@Component({
selector: 'app-calendar-page',
@@ -41,7 +41,8 @@ export class CalendarPageComponent implements OnInit {
private episodeService: EpisodeService,
private toastService: ToastService,
private entryService: EntryService,
private router: Router
private router: Router,
private configService: ConfigService
) {}
ngOnInit() {
@@ -182,7 +183,10 @@ export class CalendarPageComponent implements OnInit {
selectedPosters[0].path
) {
const name = selectedPosters[0].path;
return environment.API_URL + `/media/entries/posters/preview/${name}`;
return (
this.configService.getBackendApiUrl() +
`/media/entries/posters/preview/${name}`
);
}
}
@@ -5,7 +5,7 @@ import { trigger, transition, style, animate } from '@angular/animations';
import { CollectionService } from '../../../../core/services/collection.service';
import { Router } from '@angular/router';
import { ConfirmModalComponent } from '../../../../shared/components/modals/confirm-modal/confirm-modal.component';
import { environment } from '../../../../../environments/environment.prod';
import { ConfigService } from '../../../../core/services/config.service';
@Component({
selector: 'app-collection-entry-card',
@@ -28,6 +28,7 @@ export class CollectionEntryCardComponent implements OnInit {
constructor(
private collectionService: CollectionService,
private configService: ConfigService,
public dialog: MatDialog,
private router: Router
) {}
@@ -64,7 +65,10 @@ export class CollectionEntryCardComponent implements OnInit {
selectedPosters[0].path
) {
const name = selectedPosters[0].path;
return environment.API_URL + `/media/entries/posters/preview/${name}`;
return (
this.configService.getBackendApiUrl() +
`/media/entries/posters/preview/${name}`
);
}
}
@@ -12,7 +12,7 @@ import { trigger, transition, style, animate } from '@angular/animations';
import { CollectionService } from '../../../../core/services/collection.service';
import { Router } from '@angular/router';
import { ConfirmModalComponent } from '../../../../shared/components/modals/confirm-modal/confirm-modal.component';
import { environment } from '../../../../../environments/environment.prod';
import { ConfigService } from '../../../../core/services/config.service';
@Component({
selector: 'tr [app-collection-entry-line]',
@@ -36,6 +36,7 @@ export class CollectionEntryLineComponent implements OnInit {
constructor(
private collectionService: CollectionService,
private configService: ConfigService,
public dialog: MatDialog,
private router: Router
) {}
@@ -72,7 +73,7 @@ export class CollectionEntryLineComponent implements OnInit {
const name = selectedLogos[0].path.split('.')[0];
const extention = selectedLogos[0].path.split('.')[1];
return (
environment.API_URL +
this.configService.getBackendApiUrl() +
`/media/entries/logos/original/${name}.${extention}`
);
}
@@ -8,7 +8,7 @@ import { MatDialog } from '@angular/material/dialog';
import { ConfirmModalComponent } from '../../../../shared/components/modals/confirm-modal/confirm-modal.component';
import { ScreenshotService } from '../../../../core/services/screenshot.service';
import { CollectionEntryDTO } from '../../../../shared/models/dtos/collection-entry-dto.model';
import { environment } from '../../../../../environments/environment.prod';
import { ConfigService } from '../../../../core/services/config.service';
@Component({
selector: 'app-collection-info-page',
@@ -28,6 +28,7 @@ export class CollectionInfoPageComponent implements OnInit {
private route: ActivatedRoute,
private collectionService: CollectionService,
private screenshotService: ScreenshotService,
private configService: ConfigService,
private datePipe: DatePipe,
public dialog: MatDialog,
private router: Router
@@ -211,9 +212,7 @@ export class CollectionInfoPageComponent implements OnInit {
await this.collection.entries.forEach((entry) => {
const year = new Date(entry.release_date).getFullYear();
if (entry.is_tvseries) {
str += `${entry.title} (${year} - Seasons: ${
entry.seasons.length
})\n`;
str += `${entry.title} (${year} - Seasons: ${entry.seasons.length})\n`;
} else {
str += `${entry.title} (${year})\n`;
}
@@ -318,7 +317,7 @@ export class CollectionInfoPageComponent implements OnInit {
}
return (
environment.API_URL +
this.configService.getBackendApiUrl() +
`/media/collections/posters/preview/${selectedPoster}`
);
}
@@ -356,7 +355,7 @@ export class CollectionInfoPageComponent implements OnInit {
}
return (
environment.API_URL +
this.configService.getBackendApiUrl() +
`/media/collections/backdrops/preview/${selectedBackdrop}`
);
}
@@ -10,7 +10,7 @@ import {
trigger,
} from '@angular/animations';
import { Entry } from '../../../../shared/models/entry.model';
import { environment } from '../../../../../environments/environment.prod';
import { ConfigService } from '../../../../core/services/config.service';
@Component({
selector: 'app-collections-page',
@@ -34,7 +34,10 @@ export class CollectionsPageComponent implements OnInit {
lockActions: boolean = false;
constructor(private collectionsService: CollectionService) {}
constructor(
private collectionsService: CollectionService,
private configService: ConfigService
) {}
ngOnInit() {
this.getCollections();
@@ -136,7 +139,7 @@ export class CollectionsPageComponent implements OnInit {
}
return (
environment.API_URL +
this.configService.getBackendApiUrl() +
`/media/collections/posters/preview/${selectedPoster}`
);
} else if (collection.entries && collection.entries.length != 0) {
@@ -167,7 +170,10 @@ export class CollectionsPageComponent implements OnInit {
if (selectedPosters.length != 0) {
const name = selectedPosters[0].path;
return environment.API_URL + `/media/entries/posters/preview/${name}`;
return (
this.configService.getBackendApiUrl() +
`/media/entries/posters/preview/${name}`
);
}
}
@@ -12,7 +12,6 @@ import { SeenModalComponent } from '../../../shared/components/modals/seen-modal
import { ConfirmModalComponent } from '../../../shared/components/modals/confirm-modal/confirm-modal.component';
import { EntrySeenService } from '../../../core/services/entry-seen.service';
import { EntryRatingsService } from '../../../core/services/entry-ratings.service';
import { EntryService } from '../../../core/services/entry.service';
import { EpisodeSeenService } from '../../../core/services/episode-seen.service';
import { SeasonService } from '../../../core/services/season.service';
@@ -21,9 +20,9 @@ import { ToastrService } from 'ngx-toastr';
import { EntrySeen } from '../../../shared/models/entry-seen.model';
import { EpisodeSeenModalComponent } from '../../../shared/components/modals/episode-seen-modal/episode-seen-modal.component';
import { MediaModalComponent } from '../media-modal/media-modal.component';
import { environment } from '../../../../environments/environment.prod';
import { Collection } from '../../../shared/models/collection.model';
import { EntrySettingsModalComponent } from '../entry-settings-modal/entry-settings-modal.component';
import { ConfigService } from '../../../core/services/config.service';
@Component({
selector: 'app-alternate-entry-page',
@@ -64,7 +63,7 @@ export class AlternateEntryPageComponent implements OnInit {
private entryService: EntryService,
private seasonService: SeasonService,
private entrySeenService: EntrySeenService,
private entryRatingsService: EntryRatingsService,
private configService: ConfigService,
private libraryService: LibraryService,
private dialog: MatDialog,
private route: ActivatedRoute,
@@ -369,7 +368,7 @@ export class AlternateEntryPageComponent implements OnInit {
}
return (
environment.API_URL +
this.configService.getBackendApiUrl() +
`/media/collections/backdrops/preview/${selectedBackdrop}`
);
}
@@ -687,7 +686,7 @@ export class AlternateEntryPageComponent implements OnInit {
selectedPosters[0].path
) {
poster =
environment.API_URL +
this.configService.getBackendApiUrl() +
`/media/entries/posters/original/${selectedPosters[0].path}`;
}
}
@@ -776,7 +775,7 @@ export class AlternateEntryPageComponent implements OnInit {
selectedPosters[0].path
) {
return (
environment.API_URL +
this.configService.getBackendApiUrl() +
`/media/entries/posters/original/${selectedPosters[0].path}`
);
}
@@ -803,7 +802,7 @@ export class AlternateEntryPageComponent implements OnInit {
selectedBackdrop[0].path
) {
return (
environment.API_URL +
this.configService.getBackendApiUrl() +
`/media/entries/backdrops/original/${selectedBackdrop[0].path}`
);
}
@@ -12,7 +12,6 @@ import { SeenModalComponent } from '../../../shared/components/modals/seen-modal
import { ConfirmModalComponent } from '../../../shared/components/modals/confirm-modal/confirm-modal.component';
import { EntrySeenService } from '../../../core/services/entry-seen.service';
import { EntryRatingsService } from '../../../core/services/entry-ratings.service';
import { EntryService } from '../../../core/services/entry.service';
import { EpisodeSeenService } from '../../../core/services/episode-seen.service';
import { SeasonService } from '../../../core/services/season.service';
@@ -21,9 +20,9 @@ import { ToastrService } from 'ngx-toastr';
import { EntrySeen } from '../../../shared/models/entry-seen.model';
import { EpisodeSeenModalComponent } from '../../../shared/components/modals/episode-seen-modal/episode-seen-modal.component';
import { MediaModalComponent } from '../media-modal/media-modal.component';
import { environment } from '../../../../environments/environment.prod';
import { Collection } from '../../../shared/models/collection.model';
import { EntrySettingsModalComponent } from '../entry-settings-modal/entry-settings-modal.component';
import { ConfigService } from '../../../core/services/config.service';
@Component({
selector: 'app-entry-page',
@@ -64,7 +63,7 @@ export class EntryPageComponent implements OnInit {
private entryService: EntryService,
private seasonService: SeasonService,
private entrySeenService: EntrySeenService,
private entryRatingsService: EntryRatingsService,
private configService: ConfigService,
private libraryService: LibraryService,
private dialog: MatDialog,
private route: ActivatedRoute,
@@ -369,7 +368,7 @@ export class EntryPageComponent implements OnInit {
}
return (
environment.API_URL +
this.configService.getBackendApiUrl() +
`/media/collections/backdrops/preview/${selectedBackdrop}`
);
}
@@ -687,7 +686,7 @@ export class EntryPageComponent implements OnInit {
selectedPosters[0].path
) {
poster =
environment.API_URL +
this.configService.getBackendApiUrl() +
`/media/entries/posters/original/${selectedPosters[0].path}`;
}
}
@@ -776,7 +775,7 @@ export class EntryPageComponent implements OnInit {
selectedPosters[0].path
) {
return (
environment.API_URL +
this.configService.getBackendApiUrl() +
`/media/entries/posters/original/${selectedPosters[0].path}`
);
}
@@ -803,7 +802,7 @@ export class EntryPageComponent implements OnInit {
selectedBackdrop[0].path
) {
return (
environment.API_URL +
this.configService.getBackendApiUrl() +
`/media/entries/backdrops/original/${selectedBackdrop[0].path}`
);
}
@@ -5,9 +5,9 @@ import {
MatDialog,
} from '@angular/material/dialog';
import { Entry } from '../../../shared/models/entry.model';
import { environment } from '../../../../environments/environment.prod';
import { MediaUploadModalComponent } from '../media-upload-modal/media-upload-modal.component';
import { EntryService } from '../../../core/services/entry.service';
import { ConfigService } from '../../../core/services/config.service';
@Component({
selector: 'app-media-modal',
@@ -22,7 +22,8 @@ export class MediaModalComponent implements OnInit {
public dialogRef: MatDialogRef<MediaModalComponent>,
@Inject(MAT_DIALOG_DATA) public data: any,
private dialog: MatDialog,
private entryService: EntryService
private entryService: EntryService,
private configService: ConfigService
) {}
ngOnInit(): void {
@@ -58,7 +59,7 @@ export class MediaModalComponent implements OnInit {
}
getPath(fileType: string, filePath: string) {
return `${environment.API_URL}/media/entries/${fileType}/preview/${filePath}`;
return `${this.configService.getBackendApiUrl()}/media/entries/${fileType}/preview/${filePath}`;
}
setTab(tab: string) {
@@ -96,7 +97,9 @@ export class MediaModalComponent implements OnInit {
}
expandMedia(media: any) {
const fullSizePath = `${environment.API_URL}/media/entries/${media.type}s/original/${media.path}`;
const fullSizePath = `${this.configService.getBackendApiUrl()}/media/entries/${
media.type
}s/original/${media.path}`;
window.open(fullSizePath, '_blank');
}
}
@@ -12,7 +12,7 @@ import { LibraryService } from '../../../core/services/library.service';
import { MatDialog } from '@angular/material/dialog';
import { ConfirmModalComponent } from '../../../shared/components/modals/confirm-modal/confirm-modal.component';
import { UserCollectionsModalComponent } from '../../../shared/components/modals/list-selection-modal/user-collections-modal.component';
import { environment } from '../../../../environments/environment.prod';
import { ConfigService } from '../../../core/services/config.service';
@Component({
selector: 'tr [app-library-table-line]',
@@ -40,6 +40,7 @@ export class LibraryTableLineComponent {
constructor(
private libraryService: LibraryService,
private configService: ConfigService,
public dialog: MatDialog,
private router: Router
) {}
@@ -198,7 +199,10 @@ export class LibraryTableLineComponent {
selectedPosters[0].path
) {
const name = selectedPosters[0].path;
return environment.API_URL + `/media/entries/posters/preview/${name}`;
return (
this.configService.getBackendApiUrl() +
`/media/entries/posters/preview/${name}`
);
}
}
@@ -224,7 +228,10 @@ export class LibraryTableLineComponent {
if (selectedLogos.length && selectedLogos[0] && selectedLogos[0].path) {
const name = selectedLogos[0].path;
return environment.API_URL + `/media/entries/logos/original/${name}`;
return (
this.configService.getBackendApiUrl() +
`/media/entries/logos/original/${name}`
);
}
}
@@ -1,8 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { CustomMediaService } from '../../../core/services/custom-media.service';
import { Media } from '../../../shared/models/media.model';
import { environment } from '../../../../environments/environment.prod';
import { EntryService } from '../../../core/services/entry.service';
import { ConfigService } from '../../../core/services/config.service';
@Component({
selector: 'app-media-page',
@@ -15,6 +15,7 @@ export class MediaPageComponent implements OnInit {
constructor(
private customMediaService: CustomMediaService,
private configService: ConfigService,
private entryService: EntryService
) {}
@@ -37,7 +38,9 @@ export class MediaPageComponent implements OnInit {
let category = 'entries';
if (media.mediaable == 'collection') category = 'collections';
return `${environment.API_URL}/media/${category}/${type}/preview/${media.path}`;
return `${this.configService.getBackendApiUrl()}/media/${category}/${type}/preview/${
media.path
}`;
}
setTab(tab: string) {
@@ -78,7 +81,9 @@ export class MediaPageComponent implements OnInit {
let category = 'entries';
if (media.mediaable == 'collection') category = 'collections';
const fullSizePath = `${environment.API_URL}/media/${category}/${media.type}s/original/${media.path}`;
const fullSizePath = `${this.configService.getBackendApiUrl()}/media/${category}/${
media.type
}s/original/${media.path}`;
window.open(fullSizePath, '_blank');
}
}