pull/3895/head
Jamie Rees 6 years ago
commit 8f3bf9dd29

@ -1,4 +1,4 @@
version: 3.0.{build} version: 4.0.{build}
configuration: Release configuration: Release
os: Visual Studio 2017 os: Visual Studio 2017
environment: environment:

@ -51,6 +51,7 @@ import { LayoutModule } from '@angular/cdk/layout';
import { SearchV2Service } from "./services/searchV2.service"; import { SearchV2Service } from "./services/searchV2.service";
import { NavSearchComponent } from "./my-nav/nav-search.component"; import { NavSearchComponent } from "./my-nav/nav-search.component";
import { OverlayModule } from "@angular/cdk/overlay"; import { OverlayModule } from "@angular/cdk/overlay";
import { getBaseLocation } from "./shared/functions/common-functions";
const routes: Routes = [ const routes: Routes = [
{ path: "*", component: PageNotFoundComponent }, { path: "*", component: PageNotFoundComponent },
@ -77,8 +78,8 @@ const routes: Routes = [
]; ];
// AoT requires an exported function for factories // AoT requires an exported function for factories
export function HttpLoaderFactory(http: HttpClient, platformLocation: PlatformLocation) { export function HttpLoaderFactory(http: HttpClient) {
const base = platformLocation.getBaseHrefFromDOM(); const base = getBaseLocation();
const version = Math.floor(Math.random() * 999999999); const version = Math.floor(Math.random() * 999999999);
if (base.length > 1) { if (base.length > 1) {
return new TranslateHttpLoader(http, `${base}/translations/`, `.json?v=${version}`); return new TranslateHttpLoader(http, `${base}/translations/`, `.json?v=${version}`);
@ -173,6 +174,10 @@ export function JwtTokenGetter() {
SearchService, SearchService,
SearchV2Service, SearchV2Service,
MessageService, MessageService,
{
provide: APP_BASE_HREF,
useFactory: getBaseLocation
}
], ],
bootstrap: [AppComponent], bootstrap: [AppComponent],
}) })

@ -1,6 +1,6 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { JwtHelperService } from "@auth0/angular-jwt"; import { JwtHelperService } from "@auth0/angular-jwt";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
@ -10,8 +10,8 @@ import { ILocalUser, IUserLogin } from "./IUserLogin";
@Injectable() @Injectable()
export class AuthService extends ServiceHelpers { export class AuthService extends ServiceHelpers {
constructor(http: HttpClient, public platformLocation: PlatformLocation, private jwtHelperService: JwtHelperService) { constructor(http: HttpClient, @Inject(APP_BASE_HREF) href:string, private jwtHelperService: JwtHelperService) {
super(http, "/api/v1/token", platformLocation); super(http, "/api/v1/token", href);
} }
public login(login: IUserLogin): Observable<any> { public login(login: IUserLogin): Observable<any> {

@ -140,7 +140,7 @@
<button mat-raised-button class="btn-green btn-spacing" *ngIf="tv.available"> {{ <button mat-raised-button class="btn-green btn-spacing" *ngIf="tv.available"> {{
'Common.Available' | translate }}</button> 'Common.Available' | translate }}</button>
<button mat-raised-button class="btn-orange btn-spacing" *ngIf="tv.partlyAvailable"> {{ <button mat-raised-button class="btn-orange btn-spacing" *ngIf="tv.partlyAvailable && !tv.available"> {{
'Common.PartlyAvailable' | translate }}</button> 'Common.PartlyAvailable' | translate }}</button>
<span *ngIf="tv.available"> <span *ngIf="tv.available">

@ -21,7 +21,6 @@ export interface IUser {
episodeRequestQuota: IRemainingRequests | null; episodeRequestQuota: IRemainingRequests | null;
movieRequestQuota: IRemainingRequests | null; movieRequestQuota: IRemainingRequests | null;
musicRequestQuota: IRemainingRequests | null; musicRequestQuota: IRemainingRequests | null;
checked: boolean;
} }
export interface IUserQualityProfiles { export interface IUserQualityProfiles {

@ -1,5 +1,5 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { Component, OnInit } from "@angular/core"; import { Component, OnInit, Inject } from "@angular/core";
import { ActivatedRoute } from "@angular/router"; import { ActivatedRoute } from "@angular/router";
import { AuthService } from "../auth/auth.service"; import { AuthService } from "../auth/auth.service";
@ -37,7 +37,7 @@ export class IssueDetailsComponent implements OnInit {
private notificationService: NotificationService, private notificationService: NotificationService,
private imageService: ImageService, private imageService: ImageService,
private sanitizer: DomSanitizer, private sanitizer: DomSanitizer,
private readonly platformLocation: PlatformLocation) { @Inject(APP_BASE_HREF) href:string) {
this.route.params this.route.params
.subscribe((params: any) => { .subscribe((params: any) => {
this.issueId = parseInt(params.id); this.issueId = parseInt(params.id);
@ -46,7 +46,7 @@ export class IssueDetailsComponent implements OnInit {
this.isAdmin = this.authService.hasRole("Admin") || this.authService.hasRole("PowerUser"); this.isAdmin = this.authService.hasRole("Admin") || this.authService.hasRole("PowerUser");
this.settingsService.getIssueSettings().subscribe(x => this.settings = x); this.settingsService.getIssueSettings().subscribe(x => this.settings = x);
const base = this.platformLocation.getBaseHrefFromDOM(); const base = href;
if (base) { if (base) {
this.defaultPoster = "../../.." + base + "/images/"; this.defaultPoster = "../../.." + base + "/images/";
} else { } else {

@ -1,5 +1,5 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { Component, OnDestroy, OnInit } from "@angular/core"; import { Component, OnDestroy, OnInit, Inject } from "@angular/core";
import { IMediaServerStatus } from "../interfaces"; import { IMediaServerStatus } from "../interfaces";
import { ICustomizationSettings, ILandingPageSettings } from "../interfaces"; import { ICustomizationSettings, ILandingPageSettings } from "../interfaces";
@ -25,9 +25,11 @@ export class LandingPageComponent implements OnDestroy, OnInit {
public baseUrl: string; public baseUrl: string;
private timer: any; private timer: any;
private href: string;
constructor(private settingsService: SettingsService, constructor(private settingsService: SettingsService,
private images: ImageService, private sanitizer: DomSanitizer, private landingPageService: LandingPageService, private images: ImageService, private sanitizer: DomSanitizer, private landingPageService: LandingPageService,
private location: PlatformLocation) { } @Inject(APP_BASE_HREF) href :string) { this.href = href }
public ngOnInit() { public ngOnInit() {
this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x); this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x);
@ -39,7 +41,7 @@ export class LandingPageComponent implements OnDestroy, OnInit {
this.cycleBackground(); this.cycleBackground();
}, 15000); }, 15000);
const base = this.location.getBaseHrefFromDOM(); const base = this.href;
if (base.length > 1) { if (base.length > 1) {
this.baseUrl = base; this.baseUrl = base;
} }

@ -1,9 +1,9 @@
import { Component, OnDestroy, OnInit } from "@angular/core"; import { Component, OnDestroy, OnInit, Inject } from "@angular/core";
import { FormBuilder, FormGroup, Validators } from "@angular/forms"; import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { ActivatedRoute, Router } from "@angular/router"; import { ActivatedRoute, Router } from "@angular/router";
import { TranslateService } from "@ngx-translate/core"; import { TranslateService } from "@ngx-translate/core";
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { AuthService } from "../auth/auth.service"; import { AuthService } from "../auth/auth.service";
import { IAuthenticationSettings, ICustomizationSettings } from "../interfaces"; import { IAuthenticationSettings, ICustomizationSettings } from "../interfaces";
import { NotificationService, PlexTvService } from "../services"; import { NotificationService, PlexTvService } from "../services";
@ -45,11 +45,13 @@ export class LoginComponent implements OnDestroy, OnInit {
private errorBody: string; private errorBody: string;
private errorValidation: string; private errorValidation: string;
private href: string;
constructor(private authService: AuthService, private router: Router, private notify: NotificationService, private status: StatusService, constructor(private authService: AuthService, private router: Router, private notify: NotificationService, private status: StatusService,
private fb: FormBuilder, private settingsService: SettingsService, private images: ImageService, private sanitizer: DomSanitizer, private fb: FormBuilder, private settingsService: SettingsService, private images: ImageService, private sanitizer: DomSanitizer,
private route: ActivatedRoute, private location: PlatformLocation, private translate: TranslateService, private plexTv: PlexTvService) { private route: ActivatedRoute, @Inject(APP_BASE_HREF) href:string, private translate: TranslateService, private plexTv: PlexTvService) {
this.route.params this.href = href;
this.route.params
.subscribe((params: any) => { .subscribe((params: any) => {
this.landingFlag = params.landing; this.landingFlag = params.landing;
if (!this.landingFlag) { if (!this.landingFlag) {
@ -89,7 +91,7 @@ export class LoginComponent implements OnDestroy, OnInit {
this.cycleBackground(); this.cycleBackground();
}, 15000); }, 15000);
const base = this.location.getBaseHrefFromDOM(); const base = this.href;
if (base.length > 1) { if (base.length > 1) {
this.baseUrl = base; this.baseUrl = base;
} }

@ -1,5 +1,5 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { Component, OnInit } from "@angular/core"; import { Component, OnInit, Inject } from "@angular/core";
import { FormBuilder, FormGroup, Validators } from "@angular/forms"; import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { DomSanitizer } from "@angular/platform-browser"; import { DomSanitizer } from "@angular/platform-browser";
@ -17,10 +17,12 @@ export class ResetPasswordComponent implements OnInit {
public emailSettingsEnabled: boolean; public emailSettingsEnabled: boolean;
public baseUrl: string; public baseUrl: string;
public background: any; public background: any;
private href: string;
constructor(private identityService: IdentityService, private notify: NotificationService, constructor(private identityService: IdentityService, private notify: NotificationService,
private fb: FormBuilder, private settingsService: SettingsService, private location: PlatformLocation, private fb: FormBuilder, private settingsService: SettingsService, @Inject(APP_BASE_HREF) href:string,
private images: ImageService, private sanitizer: DomSanitizer) { private images: ImageService, private sanitizer: DomSanitizer) {
this.href = href;
this.form = this.fb.group({ this.form = this.fb.group({
email: ["", [Validators.required]], email: ["", [Validators.required]],
}); });
@ -30,7 +32,7 @@ export class ResetPasswordComponent implements OnInit {
this.images.getRandomBackground().subscribe(x => { this.images.getRandomBackground().subscribe(x => {
this.background = this.sanitizer.bypassSecurityTrustStyle("linear-gradient(-10deg, transparent 20%, rgba(0,0,0,0.7) 20.0%, rgba(0,0,0,0.7) 80.0%, transparent 80%),url(" + x.url + ")"); this.background = this.sanitizer.bypassSecurityTrustStyle("linear-gradient(-10deg, transparent 20%, rgba(0,0,0,0.7) 20.0%, rgba(0,0,0,0.7) 80.0%, transparent 80%),url(" + x.url + ")");
}); });
const base = this.location.getBaseHrefFromDOM(); const base = this.href;
if (base.length > 1) { if (base.length > 1) {
this.baseUrl = base; this.baseUrl = base;
} }

@ -28,7 +28,7 @@ export class MyNavComponent {
public navItems: INavBar[] = [ public navItems: INavBar[] = [
{ name: "NavigationBar.Discover", icon: "find_replace", link: "/discover" }, { name: "NavigationBar.Discover", icon: "find_replace", link: "/discover" },
{ name: "NavigationBar.Requests", icon: "list", link: "/requests" }, { name: "NavigationBar.Requests", icon: "list", link: "/requests" },
{ name: "NavigationBar.UserManagement", icon: "account_circle", link: "/usermanagement" }, { name: "NavigationBar.UserManagement", icon: "account_circle", link: "/usermanagement" },
{ name: "NavigationBar.Settings", icon: "settings", link: "/Settings/About" }, { name: "NavigationBar.Settings", icon: "settings", link: "/Settings/About" },
] ]

@ -1,5 +1,5 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { Component, Input, OnInit } from "@angular/core"; import { Component, Input, OnInit, Inject } from "@angular/core";
import { DomSanitizer } from "@angular/platform-browser"; import { DomSanitizer } from "@angular/platform-browser";
import { Subject } from "rxjs"; import { Subject } from "rxjs";
import { debounceTime, distinctUntilChanged } from "rxjs/operators"; import { debounceTime, distinctUntilChanged } from "rxjs/operators";
@ -44,6 +44,7 @@ export class MovieRequestsComponent implements OnInit {
public totalMovies: number = 100; public totalMovies: number = 100;
public currentlyLoaded: number; public currentlyLoaded: number;
private amountToLoad: number; private amountToLoad: number;
private href: string;
constructor( constructor(
private requestService: RequestService, private requestService: RequestService,
@ -51,7 +52,8 @@ export class MovieRequestsComponent implements OnInit {
private notificationService: NotificationService, private notificationService: NotificationService,
private radarrService: RadarrService, private radarrService: RadarrService,
private sanitizer: DomSanitizer, private sanitizer: DomSanitizer,
private readonly platformLocation: PlatformLocation) { @Inject(APP_BASE_HREF) href:string) {
this.href = href;
this.searchChanged.pipe( this.searchChanged.pipe(
debounceTime(600), // Wait Xms after the last event before emitting last event debounceTime(600), // Wait Xms after the last event before emitting last event
distinctUntilChanged(), // only emit if value is different from previous value distinctUntilChanged(), // only emit if value is different from previous value
@ -68,7 +70,7 @@ export class MovieRequestsComponent implements OnInit {
}); });
}); });
this.defaultPoster = "../../../images/default_movie_poster.png"; this.defaultPoster = "../../../images/default_movie_poster.png";
const base = this.platformLocation.getBaseHrefFromDOM(); const base = this.href;
if (base) { if (base) {
this.defaultPoster = "../../.." + base + "/images/default_movie_poster.png"; this.defaultPoster = "../../.." + base + "/images/default_movie_poster.png";
} }

@ -1,5 +1,5 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { Component, Input, OnInit } from "@angular/core"; import { Component, Input, OnInit, Inject } from "@angular/core";
import { DomSanitizer } from "@angular/platform-browser"; import { DomSanitizer } from "@angular/platform-browser";
import { Subject } from "rxjs"; import { Subject } from "rxjs";
import { debounceTime, distinctUntilChanged } from "rxjs/operators"; import { debounceTime, distinctUntilChanged } from "rxjs/operators";
@ -41,13 +41,15 @@ export class MusicRequestsComponent implements OnInit {
public totalAlbums: number = 100; public totalAlbums: number = 100;
public currentlyLoaded: number; public currentlyLoaded: number;
private amountToLoad: number; private amountToLoad: number;
private href: string;
constructor( constructor(
private requestService: RequestService, private requestService: RequestService,
private auth: AuthService, private auth: AuthService,
private notificationService: NotificationService, private notificationService: NotificationService,
private sanitizer: DomSanitizer, private sanitizer: DomSanitizer,
private readonly platformLocation: PlatformLocation) { @Inject(APP_BASE_HREF) href:string) {
this.href = href;
this.searchChanged.pipe( this.searchChanged.pipe(
debounceTime(600), // Wait Xms after the last event before emitting last event debounceTime(600), // Wait Xms after the last event before emitting last event
distinctUntilChanged(), // only emit if value is different from previous value distinctUntilChanged(), // only emit if value is different from previous value
@ -64,7 +66,7 @@ export class MusicRequestsComponent implements OnInit {
}); });
}); });
this.defaultPoster = "../../../images/default-music-placeholder.png"; this.defaultPoster = "../../../images/default-music-placeholder.png";
const base = this.platformLocation.getBaseHrefFromDOM(); const base = this.href;
if (base) { if (base) {
this.defaultPoster = "../../.." + base + "/images/default-music-placeholder.png"; this.defaultPoster = "../../.." + base + "/images/default-music-placeholder.png";
} }

@ -1,5 +1,5 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { Component, Input, OnInit } from "@angular/core"; import { Component, Input, OnInit, Inject } from "@angular/core";
import { DomSanitizer } from "@angular/platform-browser"; import { DomSanitizer } from "@angular/platform-browser";
import { Subject } from "rxjs"; import { Subject } from "rxjs";
import { debounceTime, distinctUntilChanged } from "rxjs/operators"; import { debounceTime, distinctUntilChanged } from "rxjs/operators";
@ -38,6 +38,7 @@ export class TvRequestsComponent implements OnInit {
public totalTv: number = 100; public totalTv: number = 100;
private currentlyLoaded: number; private currentlyLoaded: number;
private amountToLoad: number; private amountToLoad: number;
private href: string;
constructor( constructor(
private requestService: RequestService, private requestService: RequestService,
@ -46,8 +47,8 @@ export class TvRequestsComponent implements OnInit {
private imageService: ImageService, private imageService: ImageService,
private sonarrService: SonarrService, private sonarrService: SonarrService,
private notificationService: NotificationService, private notificationService: NotificationService,
private readonly platformLocation: PlatformLocation) { @Inject(APP_BASE_HREF) href:string) {
this.href= href;
this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser"); this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser");
this.currentUser = this.auth.claims().name; this.currentUser = this.auth.claims().name;
if (this.isAdmin) { if (this.isAdmin) {
@ -86,7 +87,7 @@ export class TvRequestsComponent implements OnInit {
}); });
}); });
this.defaultPoster = "../../../images/default_tv_poster.png"; this.defaultPoster = "../../../images/default_tv_poster.png";
const base = this.platformLocation.getBaseHrefFromDOM(); const base = this.href;
if (base) { if (base) {
this.defaultPoster = "../../.." + base + "/images/default_tv_poster.png"; this.defaultPoster = "../../.." + base + "/images/default_tv_poster.png";
} }

@ -1,5 +1,5 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { Component, Input, OnInit } from "@angular/core"; import { Component, Input, OnInit, Inject } from "@angular/core";
import { DomSanitizer } from "@angular/platform-browser"; import { DomSanitizer } from "@angular/platform-browser";
import { TranslateService } from "@ngx-translate/core"; import { TranslateService } from "@ngx-translate/core";
import { Subject } from "rxjs"; import { Subject } from "rxjs";
@ -39,12 +39,14 @@ export class MovieSearchComponent implements OnInit {
public issueProviderId: string; public issueProviderId: string;
public issueCategorySelected: IIssueCategory; public issueCategorySelected: IIssueCategory;
public defaultPoster: string; public defaultPoster: string;
private href: string;
constructor( constructor(
private searchService: SearchService, private requestService: RequestService, private searchService: SearchService, private requestService: RequestService,
private notificationService: NotificationService, private authService: AuthService, private notificationService: NotificationService, private authService: AuthService,
private readonly translate: TranslateService, private sanitizer: DomSanitizer, private readonly translate: TranslateService, private sanitizer: DomSanitizer,
private readonly platformLocation: PlatformLocation, private settingsService: SettingsService) { @Inject(APP_BASE_HREF) href:string, private settingsService: SettingsService) {
this.href= href;
this.langauges = <ILanguageRefine[]><any>languageData; this.langauges = <ILanguageRefine[]><any>languageData;
this.searchChanged.pipe( this.searchChanged.pipe(
debounceTime(600), // Wait Xms after the last event before emitting last event debounceTime(600), // Wait Xms after the last event before emitting last event
@ -54,7 +56,7 @@ export class MovieSearchComponent implements OnInit {
this.runSearch(); this.runSearch();
}); });
this.defaultPoster = "../../../images/default_movie_poster.png"; this.defaultPoster = "../../../images/default_movie_poster.png";
const base = this.platformLocation.getBaseHrefFromDOM(); const base = this.href;
if (base) { if (base) {
this.defaultPoster = "../../.." + base + "/images/default_movie_poster.png"; this.defaultPoster = "../../.." + base + "/images/default_movie_poster.png";
} }

@ -1,5 +1,5 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { Component, Input, OnInit } from "@angular/core"; import { Component, Input, OnInit, Inject } from "@angular/core";
import { DomSanitizer } from "@angular/platform-browser"; import { DomSanitizer } from "@angular/platform-browser";
import { Subject } from "rxjs"; import { Subject } from "rxjs";
import { debounceTime, distinctUntilChanged } from "rxjs/operators"; import { debounceTime, distinctUntilChanged } from "rxjs/operators";
@ -31,10 +31,11 @@ export class MusicSearchComponent implements OnInit {
public issueCategorySelected: IIssueCategory; public issueCategorySelected: IIssueCategory;
public defaultPoster: string; public defaultPoster: string;
private href: string;
constructor( constructor(
private searchService: SearchService, private sanitizer: DomSanitizer, private searchService: SearchService, private sanitizer: DomSanitizer,
private platformLocation: PlatformLocation) { @Inject(APP_BASE_HREF) href:string) {
this.href = href;
this.searchChanged.pipe( this.searchChanged.pipe(
debounceTime(600), // Wait Xms after the last event before emitting last event debounceTime(600), // Wait Xms after the last event before emitting last event
distinctUntilChanged(), // only emit if value is different from previous value distinctUntilChanged(), // only emit if value is different from previous value
@ -69,7 +70,7 @@ export class MusicSearchComponent implements OnInit {
} }
}); });
this.defaultPoster = "../../../images/default-music-placeholder.png"; this.defaultPoster = "../../../images/default-music-placeholder.png";
const base = this.platformLocation.getBaseHrefFromDOM(); const base = this.href;
if (base) { if (base) {
this.defaultPoster = "../../.." + base + "/images/default-music-placeholder.png"; this.defaultPoster = "../../.." + base + "/images/default-music-placeholder.png";
} }

@ -1,5 +1,5 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { Component, Input, OnInit } from "@angular/core"; import { Component, Input, OnInit, Inject } from "@angular/core";
import { DomSanitizer } from "@angular/platform-browser"; import { DomSanitizer } from "@angular/platform-browser";
import { Subject } from "rxjs"; import { Subject } from "rxjs";
import { debounceTime, distinctUntilChanged } from "rxjs/operators"; import { debounceTime, distinctUntilChanged } from "rxjs/operators";
@ -30,13 +30,14 @@ export class TvSearchComponent implements OnInit {
public issueRequestId: number; public issueRequestId: number;
public issueProviderId: string; public issueProviderId: string;
public issueCategorySelected: IIssueCategory; public issueCategorySelected: IIssueCategory;
private href: string;
constructor( constructor(
private searchService: SearchService, private requestService: RequestService, private searchService: SearchService, private requestService: RequestService,
private notificationService: NotificationService, private authService: AuthService, private notificationService: NotificationService, private authService: AuthService,
private imageService: ImageService, private sanitizer: DomSanitizer, private imageService: ImageService, private sanitizer: DomSanitizer,
private readonly platformLocation: PlatformLocation) { @Inject(APP_BASE_HREF) href:string) {
this.href = href;
this.searchChanged.pipe( this.searchChanged.pipe(
debounceTime(600), // Wait Xms after the last event before emitting last event debounceTime(600), // Wait Xms after the last event before emitting last event
distinctUntilChanged(), // only emit if value is different from previous value distinctUntilChanged(), // only emit if value is different from previous value
@ -54,7 +55,7 @@ export class TvSearchComponent implements OnInit {
}); });
}); });
this.defaultPoster = "../../../images/default_tv_poster.png"; this.defaultPoster = "../../../images/default_tv_poster.png";
const base = this.platformLocation.getBaseHrefFromDOM(); const base = this.href;
if (base) { if (base) {
this.defaultPoster = "../../.." + base + "/images/default_tv_poster.png"; this.defaultPoster = "../../.." + base + "/images/default_tv_poster.png";
} }

@ -1,6 +1,6 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
import { ServiceHelpers } from "../service.helpers"; import { ServiceHelpers } from "../service.helpers";
@ -9,8 +9,8 @@ import { ICouchPotatoApiKey, ICouchPotatoProfiles, ICouchPotatoSettings } from "
@Injectable() @Injectable()
export class CouchPotatoService extends ServiceHelpers { export class CouchPotatoService extends ServiceHelpers {
constructor(http: HttpClient, public platformLocation: PlatformLocation) { constructor(http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
super(http, "/api/v1/CouchPotato/", platformLocation); super(http, "/api/v1/CouchPotato/", href);
} }
public getProfiles(settings: ICouchPotatoSettings): Observable<ICouchPotatoProfiles> { public getProfiles(settings: ICouchPotatoSettings): Observable<ICouchPotatoProfiles> {

@ -1,6 +1,6 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
import { ServiceHelpers } from "../service.helpers"; import { ServiceHelpers } from "../service.helpers";
@ -9,8 +9,8 @@ import { IEmbySettings, IUsersModel } from "../../interfaces";
@Injectable() @Injectable()
export class EmbyService extends ServiceHelpers { export class EmbyService extends ServiceHelpers {
constructor(http: HttpClient, public platformLocation: PlatformLocation) { constructor(http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
super(http, "/api/v1/Emby/", platformLocation); super(http, "/api/v1/Emby/", href);
} }
public logIn(settings: IEmbySettings): Observable<IEmbySettings> { public logIn(settings: IEmbySettings): Observable<IEmbySettings> {

@ -1,6 +1,6 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
import { ILidarrProfile, ILidarrRootFolder, IProfiles } from "../../interfaces"; import { ILidarrProfile, ILidarrRootFolder, IProfiles } from "../../interfaces";
@ -9,8 +9,8 @@ import { ServiceHelpers } from "../service.helpers";
@Injectable() @Injectable()
export class LidarrService extends ServiceHelpers { export class LidarrService extends ServiceHelpers {
constructor(http: HttpClient, public platformLocation: PlatformLocation) { constructor(http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
super(http, "/api/v1/Lidarr", platformLocation); super(http, "/api/v1/Lidarr", href);
} }
public getRootFolders(settings: ILidarrSettings): Observable<ILidarrRootFolder[]> { public getRootFolders(settings: ILidarrSettings): Observable<ILidarrRootFolder[]> {

@ -1,6 +1,6 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
@ -10,8 +10,8 @@ import { IPlexAuthentication, IPlexLibResponse, IPlexLibSimpleResponse, IPlexOAu
@Injectable() @Injectable()
export class PlexService extends ServiceHelpers { export class PlexService extends ServiceHelpers {
constructor(http: HttpClient, public platformLocation: PlatformLocation) { constructor(http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
super(http, "/api/v1/Plex/", platformLocation); super(http, "/api/v1/Plex/", href);
} }
public logIn(login: string, password: string): Observable<IPlexAuthentication> { public logIn(login: string, password: string): Observable<IPlexAuthentication> {

@ -1,6 +1,6 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
@ -10,8 +10,8 @@ import { IPlexOAuthAccessToken } from "../../interfaces";
@Injectable() @Injectable()
export class PlexOAuthService extends ServiceHelpers { export class PlexOAuthService extends ServiceHelpers {
constructor(http: HttpClient, public platformLocation: PlatformLocation) { constructor(http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
super(http, "/api/v1/PlexOAuth/", platformLocation); super(http, "/api/v1/PlexOAuth/", href);
} }
public oAuth(pin: number): Observable<IPlexOAuthAccessToken> { public oAuth(pin: number): Observable<IPlexOAuthAccessToken> {

@ -1,6 +1,6 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { HttpClient, HttpHeaders } from "@angular/common/http"; import { HttpClient, HttpHeaders } from "@angular/common/http";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
@ -9,7 +9,7 @@ import { IPlexPin } from "../../interfaces";
@Injectable() @Injectable()
export class PlexTvService { export class PlexTvService {
constructor(private http: HttpClient, public platformLocation: PlatformLocation) { constructor(private http: HttpClient) {
} }
public GetPin(clientId: string, applicationName: string): Observable<IPlexPin> { public GetPin(clientId: string, applicationName: string): Observable<IPlexPin> {

@ -1,6 +1,6 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
import { IRadarrProfile, IRadarrRootFolder } from "../../interfaces"; import { IRadarrProfile, IRadarrRootFolder } from "../../interfaces";
@ -9,8 +9,8 @@ import { ServiceHelpers } from "../service.helpers";
@Injectable() @Injectable()
export class RadarrService extends ServiceHelpers { export class RadarrService extends ServiceHelpers {
constructor(http: HttpClient, public platformLocation: PlatformLocation) { constructor(http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
super(http, "/api/v1/Radarr", platformLocation); super(http, "/api/v1/Radarr", href);
} }
public getRootFolders(settings: IRadarrSettings): Observable<IRadarrRootFolder[]> { public getRootFolders(settings: IRadarrSettings): Observable<IRadarrRootFolder[]> {

@ -1,5 +1,5 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
@ -10,8 +10,8 @@ import { ServiceHelpers } from "../service.helpers";
@Injectable() @Injectable()
export class SonarrService extends ServiceHelpers { export class SonarrService extends ServiceHelpers {
constructor(http: HttpClient, public platformLocation: PlatformLocation) { constructor(http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
super(http, "/api/v1/Sonarr", platformLocation); super(http, "/api/v1/Sonarr", href);
} }
public getRootFolders(settings: ISonarrSettings): Observable<ISonarrRootFolder[]> { public getRootFolders(settings: ISonarrSettings): Observable<ISonarrRootFolder[]> {

@ -1,5 +1,5 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
@ -27,8 +27,8 @@ import {
@Injectable() @Injectable()
export class TesterService extends ServiceHelpers { export class TesterService extends ServiceHelpers {
constructor(http: HttpClient, public platformLocation: PlatformLocation) { constructor(http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
super(http, "/api/v1/tester/", platformLocation); super(http, "/api/v1/tester/", href);
} }
public discordTest(settings: IDiscordNotifcationSettings): Observable<boolean> { public discordTest(settings: IDiscordNotifcationSettings): Observable<boolean> {

@ -1,6 +1,6 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
import { import {
@ -11,8 +11,8 @@ import { ServiceHelpers } from "./service.helpers";
@Injectable() @Injectable()
export class CustomPageService extends ServiceHelpers { export class CustomPageService extends ServiceHelpers {
constructor(public http: HttpClient, public platformLocation: PlatformLocation) { constructor(public http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
super(http, "/api/v1/CustomPage", platformLocation); super(http, "/api/v1/CustomPage", href);
} }
public getCustomPage(): Observable<ICustomPage> { public getCustomPage(): Observable<ICustomPage> {

@ -1,5 +1,5 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
@ -9,8 +9,8 @@ import { ServiceHelpers } from "./service.helpers";
@Injectable() @Injectable()
export class IdentityService extends ServiceHelpers { export class IdentityService extends ServiceHelpers {
constructor(http: HttpClient, public platformLocation: PlatformLocation) { constructor(http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
super(http, "/api/v1/Identity/", platformLocation); super(http, "/api/v1/Identity/", href);
} }
public createWizardUser(user: ICreateWizardUser): Observable<IWizardUserResult> { public createWizardUser(user: ICreateWizardUser): Observable<IWizardUserResult> {
return this.http.post<IWizardUserResult>(`${this.url}Wizard/`, JSON.stringify(user), {headers: this.headers}); return this.http.post<IWizardUserResult>(`${this.url}Wizard/`, JSON.stringify(user), {headers: this.headers});

@ -1,5 +1,5 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
@ -9,8 +9,8 @@ import { ServiceHelpers } from "./service.helpers";
@Injectable() @Injectable()
export class ImageService extends ServiceHelpers { export class ImageService extends ServiceHelpers {
constructor(public http: HttpClient, public platformLocation: PlatformLocation) { constructor(public http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
super(http, "/api/v1/Images/", platformLocation); super(http, "/api/v1/Images/", href);
} }
public getRandomBackground(): Observable<IImages> { public getRandomBackground(): Observable<IImages> {

@ -1,5 +1,5 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
@ -9,8 +9,8 @@ import { ServiceHelpers } from "./service.helpers";
@Injectable() @Injectable()
export class IssuesService extends ServiceHelpers { export class IssuesService extends ServiceHelpers {
constructor(http: HttpClient, public platformLocation: PlatformLocation) { constructor(http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
super(http, "/api/v1/Issues/", platformLocation); super(http, "/api/v1/Issues/", href);
} }
public getCategories(): Observable<IIssueCategory[]> { public getCategories(): Observable<IIssueCategory[]> {

@ -1,5 +1,5 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
@ -8,8 +8,8 @@ import { ServiceHelpers } from "./service.helpers";
@Injectable() @Injectable()
export class JobService extends ServiceHelpers { export class JobService extends ServiceHelpers {
constructor(http: HttpClient, public platformLocation: PlatformLocation) { constructor(http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
super(http, "/api/v1/Job/", platformLocation); super(http, "/api/v1/Job/", href);
} }
public forceUpdate(): Observable<boolean> { public forceUpdate(): Observable<boolean> {
return this.http.post<boolean>(`${this.url}update/`, {headers: this.headers}); return this.http.post<boolean>(`${this.url}update/`, {headers: this.headers});

@ -1,5 +1,5 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
@ -9,8 +9,8 @@ import { ServiceHelpers } from "./service.helpers";
@Injectable() @Injectable()
export class LandingPageService extends ServiceHelpers { export class LandingPageService extends ServiceHelpers {
constructor(public http: HttpClient, public platformLocation: PlatformLocation) { constructor(public http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
super(http, "/api/v1/LandingPage/", platformLocation); super(http, "/api/v1/LandingPage/", href);
} }
public getServerStatus(): Observable<IMediaServerStatus> { public getServerStatus(): Observable<IMediaServerStatus> {

@ -1,5 +1,5 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
@ -9,8 +9,8 @@ import { ServiceHelpers } from "./service.helpers";
@Injectable() @Injectable()
export class MobileService extends ServiceHelpers { export class MobileService extends ServiceHelpers {
constructor(http: HttpClient, public platformLocation: PlatformLocation) { constructor(http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
super(http, "/api/v1/mobile/", platformLocation); super(http, "/api/v1/mobile/", href);
} }
public getUserDeviceList(): Observable<IMobileUsersViewModel[]> { public getUserDeviceList(): Observable<IMobileUsersViewModel[]> {
return this.http.get<IMobileUsersViewModel[]>(`${this.url}notification/`, {headers: this.headers}); return this.http.get<IMobileUsersViewModel[]>(`${this.url}notification/`, {headers: this.headers});

@ -1,5 +1,5 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
@ -10,8 +10,8 @@ import { ServiceHelpers } from "./service.helpers";
@Injectable() @Injectable()
export class NotificationMessageService extends ServiceHelpers { export class NotificationMessageService extends ServiceHelpers {
constructor(http: HttpClient, public platformLocation: PlatformLocation) { constructor(http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
super(http, "/api/v1/notifications/", platformLocation); super(http, "/api/v1/notifications/", href);
} }
public sendMassEmail(model: IMassEmailModel): Observable<boolean> { public sendMassEmail(model: IMassEmailModel): Observable<boolean> {
return this.http.post<boolean>(`${this.url}massemail/`, JSON.stringify(model) ,{headers: this.headers}); return this.http.post<boolean>(`${this.url}massemail/`, JSON.stringify(model) ,{headers: this.headers});

@ -1,5 +1,5 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
@ -9,8 +9,8 @@ import { ServiceHelpers } from "./service.helpers";
@Injectable() @Injectable()
export class RecentlyAddedService extends ServiceHelpers { export class RecentlyAddedService extends ServiceHelpers {
constructor(http: HttpClient, public platformLocation: PlatformLocation) { constructor(http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
super(http, "/api/v1/recentlyadded/", platformLocation); super(http, "/api/v1/recentlyadded/", href);
} }
public getRecentlyAddedMovies(): Observable<IRecentlyAddedMovies[]> { public getRecentlyAddedMovies(): Observable<IRecentlyAddedMovies[]> {
return this.http.get<IRecentlyAddedMovies[]>(`${this.url}movies/`, {headers: this.headers}); return this.http.get<IRecentlyAddedMovies[]>(`${this.url}movies/`, {headers: this.headers});

@ -1,5 +1,5 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
@ -14,8 +14,8 @@ import { IRemainingRequests } from "../interfaces/IRemainingRequests";
@Injectable() @Injectable()
export class RequestService extends ServiceHelpers { export class RequestService extends ServiceHelpers {
constructor(http: HttpClient, public platformLocation: PlatformLocation) { constructor(http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
super(http, "/api/v1/Request/", platformLocation); super(http, "/api/v1/Request/", href);
} }
public getRemainingMovieRequests(): Observable<IRemainingRequests> { public getRemainingMovieRequests(): Observable<IRemainingRequests> {

@ -1,5 +1,5 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
@ -9,8 +9,8 @@ import { IRequestsViewModel, IMovieRequests, ITvRequests, IChildRequests } from
@Injectable() @Injectable()
export class RequestServiceV2 extends ServiceHelpers { export class RequestServiceV2 extends ServiceHelpers {
constructor(http: HttpClient, public platformLocation: PlatformLocation) { constructor(http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
super(http, "/api/v2/Requests/", platformLocation); super(http, "/api/v2/Requests/", href);
} }
public getMovieRequests(count: number, position: number, sortProperty: string , order: string): Observable<IRequestsViewModel<IMovieRequests>> { public getMovieRequests(count: number, position: number, sortProperty: string , order: string): Observable<IRequestsViewModel<IMovieRequests>> {

@ -1,5 +1,5 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
@ -9,8 +9,8 @@ import { ServiceHelpers } from "./service.helpers";
@Injectable() @Injectable()
export class RequestRetryService extends ServiceHelpers { export class RequestRetryService extends ServiceHelpers {
constructor(http: HttpClient, public platformLocation: PlatformLocation) { constructor(http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
super(http, "/api/v1/requestretry/", platformLocation); super(http, "/api/v1/requestretry/", href);
} }
public getFailedRequests(): Observable<IFailedRequestsViewModel[]> { public getFailedRequests(): Observable<IFailedRequestsViewModel[]> {
return this.http.get<IFailedRequestsViewModel[]>(this.url, {headers: this.headers}); return this.http.get<IFailedRequestsViewModel[]>(this.url, {headers: this.headers});

@ -1,5 +1,5 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
@ -12,8 +12,8 @@ import { ServiceHelpers } from "./service.helpers";
@Injectable() @Injectable()
export class SearchService extends ServiceHelpers { export class SearchService extends ServiceHelpers {
constructor(http: HttpClient, public platformLocation: PlatformLocation) { constructor(http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
super(http, "/api/v1/search", platformLocation); super(http, "/api/v1/search", href);
} }
// Movies // Movies

@ -1,5 +1,5 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
@ -13,8 +13,8 @@ import { ISearchTvResultV2 } from "../interfaces/ISearchTvResultV2";
@Injectable() @Injectable()
export class SearchV2Service extends ServiceHelpers { export class SearchV2Service extends ServiceHelpers {
constructor(http: HttpClient, public platformLocation: PlatformLocation) { constructor(http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
super(http, "/api/v2/search", platformLocation); super(http, "/api/v2/search", href);
} }
public multiSearch(searchTerm: string): Observable<IMultiSearchResult[]> { public multiSearch(searchTerm: string): Observable<IMultiSearchResult[]> {

@ -4,8 +4,8 @@ import { HttpClient, HttpHeaders } from "@angular/common/http";
export class ServiceHelpers { export class ServiceHelpers {
protected headers = new HttpHeaders(); protected headers = new HttpHeaders();
constructor(protected http: HttpClient, protected url: string, protected platformLocation: PlatformLocation) { constructor(protected http: HttpClient, protected url: string, protected href: string) {
const base = platformLocation.getBaseHrefFromDOM(); const base = href;
this.headers = new HttpHeaders().set("Content-Type","application/json"); this.headers = new HttpHeaders().set("Content-Type","application/json");
if (base.length > 1) { if (base.length > 1) {
this.url = base + this.url; this.url = base + this.url;

@ -1,6 +1,6 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
import { import {
@ -40,8 +40,8 @@ import { ServiceHelpers } from "./service.helpers";
@Injectable() @Injectable()
export class SettingsService extends ServiceHelpers { export class SettingsService extends ServiceHelpers {
constructor(public http: HttpClient, public platformLocation: PlatformLocation) { constructor(public http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
super(http, "/api/v1/Settings", platformLocation); super(http, "/api/v1/Settings", href);
} }
public about(): Observable<IAbout> { public about(): Observable<IAbout> {

@ -1,5 +1,5 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
@ -8,8 +8,8 @@ import { ServiceHelpers } from "./service.helpers";
@Injectable() @Injectable()
export class StatusService extends ServiceHelpers { export class StatusService extends ServiceHelpers {
constructor(http: HttpClient, public platformLocation: PlatformLocation) { constructor(http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
super(http, "/api/v1/status/", platformLocation); super(http, "/api/v1/status/", href);
} }
public getWizardStatus(): Observable<any> { public getWizardStatus(): Observable<any> {
return this.http.get(`${this.url}Wizard/`, {headers: this.headers}); return this.http.get(`${this.url}Wizard/`, {headers: this.headers});

@ -1,14 +1,14 @@
import { PlatformLocation } from "@angular/common"; import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { Injectable } from "@angular/core"; import { Injectable, Inject } from "@angular/core";
import { IVoteEngineResult, IVoteViewModel } from "../interfaces"; import { IVoteEngineResult, IVoteViewModel } from "../interfaces";
import { ServiceHelpers } from "./service.helpers"; import { ServiceHelpers } from "./service.helpers";
@Injectable() @Injectable()
export class VoteService extends ServiceHelpers { export class VoteService extends ServiceHelpers {
constructor(public http: HttpClient, public platformLocation: PlatformLocation) { constructor(public http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
super(http, "/api/v1/Vote/", platformLocation); super(http, "/api/v1/Vote/", href);
} }
public async getModel(): Promise<IVoteViewModel[]> { public async getModel(): Promise<IVoteViewModel[]> {

@ -5,7 +5,7 @@
<button mat-menu-item [routerLink]="['/Settings/Customization']">Customization</button> <button mat-menu-item [routerLink]="['/Settings/Customization']">Customization</button>
<button mat-menu-item [routerLink]="['/Settings/LandingPage']">Landing Page</button> <button mat-menu-item [routerLink]="['/Settings/LandingPage']">Landing Page</button>
<button mat-menu-item [routerLink]="['/Settings/Issues']">Issues</button> <button mat-menu-item [routerLink]="['/Settings/Issues']">Issues</button>
<button mat-menu-item [routerLink]="['/Settings/Usermanagement']">User Management</button> <button mat-menu-item [routerLink]="['/Settings/UserManagement']">User Management</button>
<button mat-menu-item [routerLink]="['/Settings/Authentication']">Authentication</button> <button mat-menu-item [routerLink]="['/Settings/Authentication']">Authentication</button>
<button mat-menu-item [routerLink]="['/Settings/Vote']">Vote</button> <button mat-menu-item [routerLink]="['/Settings/Vote']">Vote</button>
</mat-menu> </mat-menu>

@ -0,0 +1,6 @@
export function getBaseLocation() {
debugger;
let paths: string[] = location.pathname.split('/').splice(1, 1);
let basePath: string = (paths && paths[0]) || 'discover'; // Default: discover
return '/' + basePath;
}

@ -66,7 +66,6 @@ export class UserManagementUserComponent implements OnInit {
password: "", password: "",
userName: "", userName: "",
userType: UserType.LocalUser, userType: UserType.LocalUser,
checked: false,
hasLoggedIn: false, hasLoggedIn: false,
lastLoggedIn: new Date(), lastLoggedIn: new Date(),
episodeRequestLimit: 0, episodeRequestLimit: 0,

@ -2,139 +2,121 @@
<button type="button" class="btn btn-success-outline" data-test="adduserbtn" [routerLink]="['/usermanagement/user']">Add User To Ombi</button> <button type="button" mat-raised-button color="primary" data-test="adduserbtn" [routerLink]="['/usermanagement/user']">Add User To Ombi</button>
<button type="button" style="float:right;" class="btn btn-primary-outline"(click)="showBulkEdit = !showBulkEdit" [disabled]="!hasChecked()">Bulk Edit</button> <button type="button" style="float:right;" mat-raised-button color="primary" (click)="showBulkEdit = !showBulkEdit" [disabled]="this.selection.selected.length <= 0">Bulk Edit</button>
<!-- Table --> <table *ngIf="dataSource" mat-table [dataSource]="dataSource" matSort class="mat-elevation-z8">
<table class="table table-striped table-hover table-responsive table-condensed table-usermanagement">
<thead> <ng-container matColumnDef="select">
<tr> <th mat-header-cell *matHeaderCellDef>
<th style="width:1%"> <mat-checkbox (change)="$event ? masterToggle() : null"
<a> [checked]="selection.hasValue() && isAllSelected()"
<td class="checkbox" data-label="Select:"> [indeterminate]="selection.hasValue() && !isAllSelected()"
<input id="all" type="checkbox" ng-checked="checkAll" (change)="checkAllBoxes()"> [aria-label]="checkboxLabel()">
<label for="all"></label> </mat-checkbox>
</td> </th>
</a> <td mat-cell *matCellDef="let row">
</th> <mat-checkbox (click)="$event.stopPropagation()"
<th class="active" (click)="setOrder('userName', $event)"> (change)="$event ? selection.toggle(row) : null"
<a> [checked]="selection.isSelected(row)"
Username [aria-label]="checkboxLabel(row)">
</a> </mat-checkbox>
<span *ngIf="order === 'userName'"> </td>
<span [hidden]="reverse"><i class="fa fa-arrow-down" aria-hidden="true"></i></span><span [hidden]="!reverse"><i class="fa fa-arrow-up" aria-hidden="true"></i></span> </ng-container>
</span>
</th> <ng-container matColumnDef="username">
<th (click)="setOrder('alias', $event)"> <th mat-header-cell *matHeaderCellDef mat-sort-header> Username </th>
<a> <td mat-cell *matCellDef="let element"> {{element.userName}} </td>
Alias </ng-container>
</a>
<span *ngIf="order === 'alias'"> <ng-container matColumnDef="alias">
<span [hidden]="reverse"><i class="fa fa-arrow-down" aria-hidden="true"></i></span><span [hidden]="!reverse"><i class="fa fa-arrow-up" aria-hidden="true"></i></span> <th mat-header-cell *matHeaderCellDef mat-sort-header> Alias </th>
</span> <td mat-cell *matCellDef="let element"> {{element.alias}} </td>
</th> </ng-container>
<th (click)="setOrder('emailAddress', $event)">
<a> <ng-container matColumnDef="email">
Email <th mat-header-cell *matHeaderCellDef mat-sort-header> Email </th>
</a> <td mat-cell *matCellDef="let element"> {{element.emailAddress}} </td>
<span *ngIf="order === 'emailAddress'"> </ng-container>
<span [hidden]="reverse"><i class="fa fa-arrow-down" aria-hidden="true"></i></span>
<span [hidden]="!reverse"><i class="fa fa-arrow-up" aria-hidden="true"></i></span> <ng-container matColumnDef="remainingRequests">
</span> <th mat-header-cell *matHeaderCellDef> Requests Remaining </th>
</th> <td mat-cell *matCellDef="let u">
<th> <div *ngIf="u.movieRequestQuota != null && u.movieRequestQuota.hasLimit">
Roles {{'UserManagment.MovieRemaining' | translate: {remaining: u.movieRequestQuota.remaining, total: u.movieRequestLimit} }}
</th> </div>
<th> <div *ngIf="u.episodeRequestQuota != null && u.episodeRequestQuota.hasLimit">
Requests Remaining {{'UserManagment.TvRemaining' | translate: {remaining: u.episodeRequestQuota.remaining, total: u.episodeRequestLimit} }}
</th> </div>
<th> <div *ngIf="u.musicRequestQuota != null && u.musicRequestQuota.hasLimit">
Next Request Due {{'UserManagment.MusicRemaining' | translate: {remaining: u.musicRequestQuota.remaining, total: u.musicRequestLimit} }}
</th> </div>
<th (click)="setOrder('lastLoggedIn', $event)"> </td>
<a> Last Logged In</a> </ng-container>
<span *ngIf="order === 'lastLoggedIn'">
<span [hidden]="reverse"><i class="fa fa-arrow-down" aria-hidden="true"></i></span><span [hidden]="!reverse"><i class="fa fa-arrow-up" aria-hidden="true"></i></span> <ng-container matColumnDef="nextRequestDue">
</span> <th mat-header-cell *matHeaderCellDef> Next Request Due </th>
</th> <td mat-cell *matCellDef="let u">
<th (click)="setOrder('userType', $event)"> <div *ngIf="u.movieRequestQuota != null && u.movieRequestQuota.remaining != u.movieRequestLimit">
<a> {{'UserManagment.MovieDue' | translate: {date: (u.movieRequestQuota.nextRequest | amLocal | amDateFormat: 'l LT')} }}
User Type </div>
</a> <div *ngIf="u.episodeRequestQuota != null && u.episodeRequestQuota.remaining != u.episodeRequestLimit">
<span *ngIf="order === 'userType'"> {{'UserManagment.TvDue' | translate: {date: (u.episodeRequestQuota.nextRequest | amLocal | amDateFormat: 'l LT')} }}
<span [hidden]="reverse"><i class="fa fa-arrow-down" aria-hidden="true"></i></span><span [hidden]="!reverse"><i class="fa fa-arrow-up" aria-hidden="true"></i></span> </div>
</span> <div *ngIf="u.musicRequestQuota != null && u.musicRequestQuota.remaining != u.musicRequestLimit">
</th> {{'UserManagment.MusicDue' | translate: {date: (u.musicRequestQuota.nextRequest | amLocal | amDateFormat: 'l LT')} }}
</tr> </div>
</thead> </td>
<tbody> </ng-container>
<tr *ngFor="let u of users | orderBy: order : reverse : 'case-insensitive'"> <ng-container matColumnDef="lastLoggedIn">
<td class="checkbox" data-label="Select:"> <th mat-header-cell *matHeaderCellDef mat-sort-header> Last Logged In </th>
<input id="{{u.id}}" type="checkbox" [(ngModel)]="u.checked"> <td mat-cell *matCellDef="let u">
<label for="{{u.id}}"></label> <span *ngIf="u.lastLoggedIn">
</td> {{u.lastLoggedIn | amLocal | amDateFormat: 'l LT'}}
<td class="td-labelled" data-label="Username:"> </span>
{{u.userName}} <span *ngIf="!u.lastLoggedIn">
</td> Not logged in yet!
<td class="td-labelled" data-label="Alias:"> </span> </td>
{{u.alias}} </ng-container>
</td>
<td class="td-labelled" data-label="Email:"> <ng-container matColumnDef="userType">
{{u.emailAddress}} <th mat-header-cell *matHeaderCellDef mat-sort-header> User Type </th>
</td> <td mat-cell *matCellDef="let u">
<td class="td-labelled" data-label="Roles:"> <span *ngIf="u.userType === 1">Local User</span>
<div *ngFor="let claim of u.claims"> <span *ngIf="u.userType === 2">Plex User</span>
<span *ngIf="u.userType === 3">Emby User</span> </td>
</ng-container>
<ng-container matColumnDef="roles">
<th mat-header-cell *matHeaderCellDef> Roles </th>
<td mat-cell *matCellDef="let element">
<div *ngFor="let claim of element.claims">
<span *ngIf="claim.enabled">{{claim.value}}</span> <span *ngIf="claim.enabled">{{claim.value}}</span>
</div> </div>
</td>
</ng-container>
<ng-container matColumnDef="actions">
<th mat-header-cell *matHeaderCellDef> </th>
<td mat-cell *matCellDef="let u">
<button mat-raised-button color="accent" [routerLink]="['/usermanagement/user/' + u.id]">Details/Edit</button>
</td> </td>
<td class="td-labelled" data-label="Requests Remaining"> </ng-container>
<div *ngIf="u.movieRequestQuota != null && u.movieRequestQuota.hasLimit">
{{'UserManagment.MovieRemaining' | translate: {remaining: u.movieRequestQuota.remaining, total: u.movieRequestLimit} }} <ng-container matColumnDef="welcome">
</div> <th mat-header-cell *matHeaderCellDef> </th>
<div *ngIf="u.episodeRequestQuota != null && u.episodeRequestQuota.hasLimit"> <td mat-cell *matCellDef="let u">
{{'UserManagment.TvRemaining' | translate: {remaining: u.episodeRequestQuota.remaining, total: u.episodeRequestLimit} }} <button *ngIf="!u.hasLoggedIn" mat-raised-button color="accent" (click)="welcomeEmail(u)" [disabled]="!customizationSettings.applicationUrl">Send Welcome Email</button>
</div> </td>
<div *ngIf="u.musicRequestQuota != null && u.musicRequestQuota.hasLimit"> </ng-container>
{{'UserManagment.MusicRemaining' | translate: {remaining: u.musicRequestQuota.remaining, total: u.musicRequestLimit} }}
</div> <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
</td> <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
<td class="td-labelled" data-label="Request Due"> </table>
<div *ngIf="u.movieRequestQuota != null && u.movieRequestQuota.remaining != u.movieRequestLimit">
{{'UserManagment.MovieDue' | translate: {date: (u.movieRequestQuota.nextRequest | amLocal | amDateFormat: 'l LT')} }} <!-- Table -->
</div>
<div *ngIf="u.episodeRequestQuota != null && u.episodeRequestQuota.remaining != u.episodeRequestLimit">
{{'UserManagment.TvDue' | translate: {date: (u.episodeRequestQuota.nextRequest | amLocal | amDateFormat: 'l LT')} }}
</div>
<div *ngIf="u.musicRequestQuota != null && u.musicRequestQuota.remaining != u.musicRequestLimit">
{{'UserManagment.MusicDue' | translate: {date: (u.musicRequestQuota.nextRequest | amLocal | amDateFormat: 'l LT')} }}
</div>
</td>
<td class="td-labelled" data-label="Last Logged In:">
<!-- {{u.lastLoggedIn | date: 'short'}} -->
<span *ngIf="u.lastLoggedIn">
{{u.lastLoggedIn | amLocal | amDateFormat: 'l LT'}}
</span>
<span *ngIf="!u.lastLoggedIn">
Not logged in yet!
</span>
</td>
<td class="td-labelled" data-label="User Type:">
<span *ngIf="u.userType === 1">Local User</span>
<span *ngIf="u.userType === 2">Plex User</span>
<span *ngIf="u.userType === 3">Emby User</span>
</td>
<td>
<a id="edit{{u.userName}}" [routerLink]="['/usermanagement/user/' + u.id]" class="btn btn-sm btn-info-outline">Details/Edit</a>
</td>
<td *ngIf="customizationSettings">
<button *ngIf="!u.hasLoggedIn" (click)="welcomeEmail(u)" [disabled]="!customizationSettings.applicationUrl" class="btn btn-sm btn-info-outline">Send Welcome Email</button>
</td>
</tr>
</tbody>
</table>
<p-sidebar [(visible)]="showBulkEdit" position="right" styleClass="ui-sidebar-md side-back"> <p-sidebar [(visible)]="showBulkEdit" position="right" styleClass="ui-sidebar-md side-back">

@ -1,21 +1,25 @@
import { Component, OnInit } from "@angular/core"; import { Component, OnInit, ViewChild } from "@angular/core";
import { ICheckbox, ICustomizationSettings, IEmailNotificationSettings, IUser } from "../interfaces"; import { ICheckbox, ICustomizationSettings, IEmailNotificationSettings, IUser } from "../interfaces";
import { IdentityService, NotificationService, SettingsService } from "../services"; import { IdentityService, NotificationService, SettingsService } from "../services";
import { MatSort, MatTableDataSource } from "@angular/material";
import { SelectionModel } from "@angular/cdk/collections";
@Component({ @Component({
templateUrl: "./usermanagement.component.html", templateUrl: "./usermanagement.component.html",
}) })
export class UserManagementComponent implements OnInit { export class UserManagementComponent implements OnInit {
public displayedColumns: string[] = ['select', 'username', 'alias', 'email', 'roles', 'remainingRequests',
'nextRequestDue', 'lastLoggedIn', 'userType', 'actions', 'welcome'];
public dataSource: MatTableDataSource<IUser>;
public selection = new SelectionModel<IUser>(true, []);
@ViewChild(MatSort) public sort: MatSort;
public users: IUser[]; public users: IUser[];
public checkAll = false; public checkAll = false;
public emailSettings: IEmailNotificationSettings; public emailSettings: IEmailNotificationSettings;
public customizationSettings: ICustomizationSettings; public customizationSettings: ICustomizationSettings;
public order: string = "userName";
public reverse = false;
public showBulkEdit = false; public showBulkEdit = false;
public availableClaims: ICheckbox[]; public availableClaims: ICheckbox[];
public bulkMovieLimit?: number; public bulkMovieLimit?: number;
@ -23,15 +27,15 @@ export class UserManagementComponent implements OnInit {
public plexEnabled: boolean; public plexEnabled: boolean;
constructor(private identityService: IdentityService, constructor(private identityService: IdentityService,
private settingsService: SettingsService, private settingsService: SettingsService,
private notificationService: NotificationService, private notificationService: NotificationService,
private plexSettings: SettingsService) { } private plexSettings: SettingsService) { }
public ngOnInit() { public async ngOnInit() {
this.users = []; this.users = await this.identityService.getUsers().toPromise();
this.identityService.getUsers().subscribe(x => {
this.users = x; this.dataSource = new MatTableDataSource(this.users);
}); this.dataSource.sort = this.sort;
this.plexSettings.getPlex().subscribe(x => this.plexEnabled = x.enable); this.plexSettings.getPlex().subscribe(x => this.plexEnabled = x.enable);
@ -59,28 +63,12 @@ export class UserManagementComponent implements OnInit {
this.notificationService.success(`Sent a welcome email to ${user.emailAddress}`); this.notificationService.success(`Sent a welcome email to ${user.emailAddress}`);
} }
public checkAllBoxes() {
this.checkAll = !this.checkAll;
this.users.forEach(user => {
user.checked = this.checkAll;
});
}
public hasChecked(): boolean {
return this.users.some(x => {
return x.checked;
});
}
public bulkUpdate() { public bulkUpdate() {
const anyRoles = this.availableClaims.some(x => { const anyRoles = this.availableClaims.some(x => {
return x.enabled; return x.enabled;
}); });
this.users.forEach(x => { this.selection.selected.forEach(x => {
if (!x.checked) {
return;
}
if (anyRoles) { if (anyRoles) {
x.claims = this.availableClaims; x.claims = this.availableClaims;
} }
@ -103,23 +91,24 @@ export class UserManagementComponent implements OnInit {
this.bulkEpisodeLimit = undefined; this.bulkEpisodeLimit = undefined;
} }
public setOrder(value: string, el: any) { public isAllSelected() {
el = el.toElement || el.relatedTarget || el.target || el.srcElement; const numSelected = this.selection.selected.length;
const numRows = this.dataSource.data.length;
return numSelected === numRows;
}
if (el.nodeName === "A") {
el = el.parentElement;
}
const parent = el.parentElement; public masterToggle() {
const previousFilter = parent.querySelector(".active"); this.isAllSelected() ?
this.selection.clear() :
this.dataSource.data.forEach(row => this.selection.select(row));
}
if (this.order === value) { /** The label for the checkbox on the passed row */
this.reverse = !this.reverse; public checkboxLabel(row?: IUser): string {
} else { if (!row) {
previousFilter.className = ""; return `${this.isAllSelected() ? 'select' : 'deselect'} all`;
el.className = "active";
} }
return `${this.selection.isSelected(row) ? 'deselect' : 'select'} row ${row.id + 1}`;
this.order = value;
} }
} }

@ -3,7 +3,7 @@
<head> <head>
<script> <!-- <script>
const existingBaseUrl = window.localStorage.getItem("baseUrl"); const existingBaseUrl = window.localStorage.getItem("baseUrl");
if (existingBaseUrl && existingBaseUrl.length === 0) { if (existingBaseUrl && existingBaseUrl.length === 0) {
@ -48,7 +48,7 @@
return str.indexOf(suffix, str.length - suffix.length) !== -1; return str.indexOf(suffix, str.length - suffix.length) !== -1;
} }
} }
</script> </script> -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
<meta charset="utf-8" /> <meta charset="utf-8" />

Loading…
Cancel
Save