linting !wip

pull/2411/head
TidusJar 6 years ago
parent 9bc95d9ebb
commit 4c99acef75

@ -40,7 +40,7 @@ export class AppComponent implements OnInit {
__webpack_public_path__ = base + "/dist/"; __webpack_public_path__ = base + "/dist/";
} }
this.translate.addLangs(["en", "de", "fr","da","es","it","nl","sv","no"]); this.translate.addLangs(["en", "de", "fr", "da", "es", "it", "nl", "sv", "no"]);
// this language will be used as a fallback when a translation isn't found in the current language // this language will be used as a fallback when a translation isn't found in the current language
this.translate.setDefaultLang("en"); this.translate.setDefaultLang("en");
@ -88,8 +88,8 @@ export class AppComponent implements OnInit {
public openMobileApp(event: any) { public openMobileApp(event: any) {
event.preventDefault(); event.preventDefault();
if(!this.customizationSettings.applicationUrl) { if (!this.customizationSettings.applicationUrl) {
this.notificationService.warning("Mobile","Please ask your admin to setup the Application URL!"); this.notificationService.warning("Mobile", "Please ask your admin to setup the Application URL!");
return; return;
} }

@ -53,9 +53,9 @@ export class AuthService extends ServiceHelpers {
} else { } else {
u.roles.push(roles); u.roles.push(roles);
} }
return <ILocalUser>u; return <ILocalUser> u;
} }
return <ILocalUser>{}; return <ILocalUser> { };
} }
public hasRole(role: string): boolean { public hasRole(role: string): boolean {

@ -11,7 +11,7 @@ export class CookieComponent implements OnInit {
public ngOnInit() { public ngOnInit() {
const cookie = this.cookieService.getAll(); const cookie = this.cookieService.getAll();
if(cookie.Auth) { if (cookie.Auth) {
const jwtVal = cookie.Auth; const jwtVal = cookie.Auth;
localStorage.setItem("id_token", jwtVal); localStorage.setItem("id_token", jwtVal);
this.router.navigate(["search"]); this.router.navigate(["search"]);

@ -63,8 +63,8 @@ export class IssueDetailsComponent implements OnInit {
issueCategoryId: x.issueCategoryId, issueCategoryId: x.issueCategoryId,
subject: x.subject, subject: x.subject,
description: x.description, description: x.description,
status:x.status, status: x.status,
resolvedDate:x.resolvedDate, resolvedDate: x.resolvedDate,
title: x.title, title: x.title,
requestType: x.requestType, requestType: x.requestType,
requestId: x.requestId, requestId: x.requestId,
@ -117,7 +117,7 @@ export class IssueDetailsComponent implements OnInit {
} else { } else {
this.imageService.getTvBackground(Number(issue.providerId)).subscribe(x => { this.imageService.getTvBackground(Number(issue.providerId)).subscribe(x => {
if(x) { if (x) {
this.backgroundPath = this.sanitizer.bypassSecurityTrustStyle this.backgroundPath = this.sanitizer.bypassSecurityTrustStyle
("url(" + x + ")"); ("url(" + x + ")");
} }

@ -61,5 +61,4 @@ export class IssuesComponent implements OnInit {
this.resolvedIssues = x; this.resolvedIssues = x;
}); });
} }
} }

@ -32,7 +32,7 @@ export class LoginComponent implements OnDestroy, OnInit {
public loginWithOmbi: boolean; public loginWithOmbi: boolean;
public get appName(): string { public get appName(): string {
if(this.customizationSettings.applicationName) { if (this.customizationSettings.applicationName) {
return this.customizationSettings.applicationName; return this.customizationSettings.applicationName;
} else { } else {
return "Ombi"; return "Ombi";
@ -72,7 +72,7 @@ export class LoginComponent implements OnDestroy, OnInit {
} }
}); });
if(authService.loggedIn()) { if (authService.loggedIn()) {
this.router.navigate(["search"]); this.router.navigate(["search"]);
} }
} }
@ -103,9 +103,9 @@ export class LoginComponent implements OnDestroy, OnInit {
return; return;
} }
const value = form.value; const value = form.value;
const user = { password: value.password, username: value.username, rememberMe: value.rememberMe, usePlexOAuth: false, plexTvPin: { id: 0, code: ""} }; const user = { password: value.password, username: value.username, rememberMe: value.rememberMe, usePlexOAuth: false, plexTvPin: { id: 0, code: "" } };
this.authService.requiresPassword(user).subscribe(x => { this.authService.requiresPassword(user).subscribe(x => {
if(x && this.authenticationSettings.allowNoPassword) { if (x && this.authenticationSettings.allowNoPassword) {
// Looks like this user requires a password // Looks like this user requires a password
this.authenticationSettings.allowNoPassword = false; this.authenticationSettings.allowNoPassword = false;
return; return;
@ -125,9 +125,9 @@ export class LoginComponent implements OnDestroy, OnInit {
} }
public oauth() { public oauth() {
this.plexTv.GetPin(this.clientId, this.appName).subscribe(pin => { this.plexTv.GetPin(this.clientId, this.appName).subscribe((pin: any) => {
this.authService.login({usePlexOAuth: true, password:"",rememberMe:true,username:"", plexTvPin: pin}).subscribe(x => { this.authService.login({ usePlexOAuth: true, password: "", rememberMe: true, username: "", plexTvPin: pin }).subscribe(x => {
if (window.frameElement) { if (window.frameElement) {
// in frame // in frame
window.open(x.url, "_blank"); window.open(x.url, "_blank");
@ -144,12 +144,12 @@ export class LoginComponent implements OnDestroy, OnInit {
} }
private cycleBackground() { private cycleBackground() {
this.images.getRandomBackground().subscribe(x => { this.images.getRandomBackground().subscribe(x => {
this.background = ""; this.background = "";
}); });
this.images.getRandomBackground().subscribe(x => { this.images.getRandomBackground().subscribe(x => {
this.background = this.sanitizer 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 + ")"); .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 + ")");
}); });
} }
} }

@ -16,7 +16,6 @@ export class LoginOAuthComponent implements OnInit {
this.route.params this.route.params
.subscribe((params: any) => { .subscribe((params: any) => {
this.pin = params.pin; this.pin = params.pin;
}); });
} }
@ -26,7 +25,7 @@ export class LoginOAuthComponent implements OnInit {
public auth() { public auth() {
this.authService.oAuth(this.pin).subscribe(x => { this.authService.oAuth(this.pin).subscribe(x => {
if(x.access_token) { if (x.access_token) {
localStorage.setItem("id_token", x.access_token); localStorage.setItem("id_token", x.access_token);
if (this.authService.loggedIn()) { if (this.authService.loggedIn()) {
@ -34,13 +33,12 @@ export class LoginOAuthComponent implements OnInit {
return; return;
} }
} }
if(x.errorMessage) { if (x.errorMessage) {
this.error = x.errorMessage; this.error = x.errorMessage;
} }
}, err => { }, err => {
this.notify.error(err.statusText); this.notify.error(err.statusText);
this.router.navigate(["login"]); this.router.navigate(["login"]);
}); });
} }

@ -4,7 +4,7 @@ import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { DomSanitizer } from "@angular/platform-browser"; import { DomSanitizer } from "@angular/platform-browser";
import { ICustomizationSettings } from "../interfaces"; import { ICustomizationSettings } from "../interfaces";
import { IdentityService, ImageService,NotificationService, SettingsService } from "../services"; import { IdentityService, ImageService, NotificationService, SettingsService } from "../services";
@Component({ @Component({
templateUrl: "./resetpassword.component.html", templateUrl: "./resetpassword.component.html",

@ -67,10 +67,10 @@ export class RecentlyAddedComponent implements OnInit {
} }
public close() { public close() {
if(this.range.length < 2) { if (this.range.length < 2) {
return; return;
} }
if(!this.range[1]) { if (!this.range[1]) {
// If we do not have a second date then just set it to now // If we do not have a second date then just set it to now
this.range[1] = new Date(); this.range[1] = new Date();
} }
@ -82,13 +82,13 @@ export class RecentlyAddedComponent implements OnInit {
} }
private getShows() { private getShows() {
if(this.groupTv) { if (this.groupTv) {
this.recentlyAddedService.getRecentlyAddedTvGrouped().subscribe(x => { this.recentlyAddedService.getRecentlyAddedTvGrouped().subscribe(x => {
this.tv = x; this.tv = x;
this.tv.forEach((t) => { this.tv.forEach((t) => {
this.imageService.getTvPoster(t.tvDbId).subscribe(p => { this.imageService.getTvPoster(t.tvDbId).subscribe(p => {
if(p) { if (p) {
t.posterPath = p; t.posterPath = p;
} }
}); });
@ -100,7 +100,7 @@ export class RecentlyAddedComponent implements OnInit {
this.tv.forEach((t) => { this.tv.forEach((t) => {
this.imageService.getTvPoster(t.tvDbId).subscribe(p => { this.imageService.getTvPoster(t.tvDbId).subscribe(p => {
if(p) { if (p) {
t.posterPath = p; t.posterPath = p;
} }
}); });
@ -114,11 +114,11 @@ export class RecentlyAddedComponent implements OnInit {
this.movies = x; this.movies = x;
this.movies.forEach((movie) => { this.movies.forEach((movie) => {
if(movie.theMovieDbId) { if (movie.theMovieDbId) {
this.imageService.getMoviePoster(movie.theMovieDbId).subscribe(p => { this.imageService.getMoviePoster(movie.theMovieDbId).subscribe(p => {
movie.posterPath = p; movie.posterPath = p;
}); });
} else if(movie.imdbId) { } else if (movie.imdbId) {
this.imageService.getMoviePoster(movie.imdbId).subscribe(p => { this.imageService.getMoviePoster(movie.imdbId).subscribe(p => {
movie.posterPath = p; movie.posterPath = p;
}); });

@ -4,7 +4,7 @@ import { IChildRequests } from "../interfaces";
import { NotificationService, RequestService } from "../services"; import { NotificationService, RequestService } from "../services";
@Component({ @Component({
selector:"tvrequests-children", selector: "tvrequests-children",
templateUrl: "./tvrequest-children.component.html", templateUrl: "./tvrequest-children.component.html",
}) })
export class TvRequestChildrenComponent { export class TvRequestChildrenComponent {
@ -26,12 +26,12 @@ export class TvRequestChildrenComponent {
public changeAvailability(request: IChildRequests, available: boolean) { public changeAvailability(request: IChildRequests, available: boolean) {
request.available = available; request.available = available;
request.seasonRequests.forEach((season)=> { request.seasonRequests.forEach((season) => {
season.episodes.forEach((ep)=> { season.episodes.forEach((ep) => {
ep.available = available; ep.available = available;
}); });
}); });
if(available) { if (available) {
this.requestService.markTvAvailable({ id: request.id }).subscribe(x => { this.requestService.markTvAvailable({ id: request.id }).subscribe(x => {
if (x.result) { if (x.result) {
this.notificationService.success( this.notificationService.success(

@ -155,7 +155,6 @@ export class MovieSearchGridComponent implements OnInit {
this.movieResultGrid.push(container); this.movieResultGrid.push(container);
container = <ISearchMovieResultContainer>{ movies: [] }; container = <ISearchMovieResultContainer>{ movies: [] };
} else { } else {
container.movies.push(movie); container.movies.push(movie);
} }
}); });

@ -2,7 +2,7 @@
import { HttpClient, HttpHeaders } from "@angular/common/http"; import { HttpClient, HttpHeaders } from "@angular/common/http";
import { Injectable } from "@angular/core"; import { Injectable } from "@angular/core";
import { Observable } from "rxjs/Rx"; import { Observable } from "rxjs";
import { IPlexPin } from "../../interfaces"; import { IPlexPin } from "../../interfaces";
@ -10,11 +10,10 @@ import { IPlexPin } from "../../interfaces";
export class PlexTvService { export class PlexTvService {
constructor(private http: HttpClient, public platformLocation: PlatformLocation) { constructor(private http: HttpClient, public platformLocation: PlatformLocation) {
} }
public GetPin(clientId: string, applicationName: string): Observable<IPlexPin> { public GetPin(clientId: string, applicationName: string): Observable<IPlexPin> {
const headers = new HttpHeaders({"Content-Type":"application/json", const headers = new HttpHeaders({"Content-Type": "application/json",
"X-Plex-Client-Identifier": clientId, "X-Plex-Client-Identifier": clientId,
"X-Plex-Product": applicationName, "X-Plex-Product": applicationName,
"X-Plex-Version": "3", "X-Plex-Version": "3",

@ -25,13 +25,13 @@ export class CustomizationComponent implements OnInit {
return item.fullName === this.settings.presetThemeName; return item.fullName === this.settings.presetThemeName;
})[0]; })[0];
if(existingTheme) { if (existingTheme) {
const index = this.themes.indexOf(existingTheme, 0); const index = this.themes.indexOf(existingTheme, 0);
if (index > -1) { if (index > -1) {
this.themes.splice(index, 1); this.themes.splice(index, 1);
} }
} }
if(x.hasPresetTheme) { if (x.hasPresetTheme) {
this.themes.unshift({displayName: x.presetThemeDisplayName, fullName: x.presetThemeName, url: existingTheme.url, version: x.presetThemeVersion}); this.themes.unshift({displayName: x.presetThemeDisplayName, fullName: x.presetThemeName, url: existingTheme.url, version: x.presetThemeVersion});
this.themes.unshift({displayName: "None", fullName: "None", url: "", version: ""}); this.themes.unshift({displayName: "None", fullName: "None", url: "", version: ""});
} else { } else {
@ -45,8 +45,8 @@ export class CustomizationComponent implements OnInit {
public save() { public save() {
this.settingsService.verifyUrl(this.settings.applicationUrl).subscribe(x => { this.settingsService.verifyUrl(this.settings.applicationUrl).subscribe(x => {
if(this.settings.applicationUrl) { if (this.settings.applicationUrl) {
if(!x) { if (!x) {
this.notificationService.error(`The URL "${this.settings.applicationUrl}" is not valid. Please format it correctly e.g. http://www.google.com/`); this.notificationService.error(`The URL "${this.settings.applicationUrl}" is not valid. Please format it correctly e.g. http://www.google.com/`);
return; return;
} }
@ -64,16 +64,16 @@ export class CustomizationComponent implements OnInit {
} }
public dropDownChange(event: any): void { public dropDownChange(event: any): void {
const selectedThemeFullName = <string>event.target.value; const selectedThemeFullName = <string> event.target.value;
const selectedTheme = this.themes.filter((val) => { const selectedTheme = this.themes.filter((val) => {
return val.fullName === selectedThemeFullName; return val.fullName === selectedThemeFullName;
})[0]; })[0];
if(selectedTheme.fullName === this.settings.presetThemeName) { if (selectedTheme.fullName === this.settings.presetThemeName) {
return; return;
} }
if(selectedTheme.fullName === "None" || selectedTheme.fullName === "-1") { if (selectedTheme.fullName === "None" || selectedTheme.fullName === "-1") {
this.settings.presetThemeName = ""; this.settings.presetThemeName = "";
this.settings.presetThemeContent = ""; this.settings.presetThemeContent = "";
return; return;

@ -1,6 +1,6 @@
import { Component, OnInit } from "@angular/core"; import { Component, OnInit } 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";
@Component({ @Component({
@ -21,9 +21,9 @@ export class UserManagementComponent implements OnInit {
public bulkMovieLimit?: number; public bulkMovieLimit?: number;
public bulkEpisodeLimit?: number; public bulkEpisodeLimit?: number;
constructor(private readonly identityService: IdentityService, constructor(private identityService: IdentityService,
private readonly settingsService: SettingsService, private settingsService: SettingsService,
private readonly notificationService: NotificationService) { } private notificationService: NotificationService) { }
public ngOnInit() { public ngOnInit() {
this.users = []; this.users = [];
@ -37,7 +37,7 @@ export class UserManagementComponent implements OnInit {
} }
public welcomeEmail(user: IUser) { public welcomeEmail(user: IUser) {
if(!user.emailAddress) { if (!user.emailAddress) {
this.notificationService.error("The user needs an email address."); this.notificationService.error("The user needs an email address.");
return; return;
} }
@ -45,7 +45,7 @@ export class UserManagementComponent implements OnInit {
this.notificationService.error("Email Notifications are not setup, cannot send welcome email"); this.notificationService.error("Email Notifications are not setup, cannot send welcome email");
return; return;
} }
if(!this.emailSettings.notificationTemplates.some(x => { if (!this.emailSettings.notificationTemplates.some(x => {
return x.enabled && x.notificationType === 8; return x.enabled && x.notificationType === 8;
})) { })) {
this.notificationService.error("The Welcome Email template is not enabled in the Email Setings"); this.notificationService.error("The Welcome Email template is not enabled in the Email Setings");
@ -74,20 +74,20 @@ export class UserManagementComponent implements OnInit {
}); });
this.users.forEach(x => { this.users.forEach(x => {
if(!x.checked) { if (!x.checked) {
return; return;
} }
if(anyRoles) { if (anyRoles) {
x.claims = this.availableClaims; x.claims = this.availableClaims;
} }
if(this.bulkEpisodeLimit) { if (this.bulkEpisodeLimit) {
x.episodeRequestLimit = this.bulkEpisodeLimit; x.episodeRequestLimit = this.bulkEpisodeLimit;
} }
if(this.bulkMovieLimit) { if (this.bulkMovieLimit) {
x.movieRequestLimit = this.bulkMovieLimit; x.movieRequestLimit = this.bulkMovieLimit;
} }
this.identityService.updateUser(x).subscribe(y => { this.identityService.updateUser(x).subscribe(y => {
if(!y.successful) { if (!y.successful) {
this.notificationService.error(`Could not update user ${x.userName}. Reason ${y.errors[0]}`); this.notificationService.error(`Could not update user ${x.userName}. Reason ${y.errors[0]}`);
} }
}); });
@ -117,5 +117,5 @@ export class UserManagementComponent implements OnInit {
} }
this.order = value; this.order = value;
} }
} }

@ -14,14 +14,14 @@ export class EmbyComponent implements OnInit {
public embySettings: IEmbySettings; public embySettings: IEmbySettings;
constructor(private embyService: EmbyService, constructor(private embyService: EmbyService,
private router: Router, private router: Router,
private notificationService: NotificationService) { private notificationService: NotificationService) {
} }
public ngOnInit() { public ngOnInit() {
this.embySettings = { this.embySettings = {
servers: [], servers: [],
id:0, id: 0,
enable: true, enable: true,
}; };
this.embySettings.servers.push({ this.embySettings.servers.push({

@ -15,9 +15,9 @@ export class PlexComponent implements OnInit {
private clientId: string; private clientId: string;
constructor(private plexService: PlexService, private router: Router, constructor(private plexService: PlexService, private router: Router,
private notificationService: NotificationService, private notificationService: NotificationService,
private identityService: IdentityService, private plexTv: PlexTvService, private identityService: IdentityService, private plexTv: PlexTvService,
private settingsService: SettingsService) { } private settingsService: SettingsService) { }
public ngOnInit(): void { public ngOnInit(): void {
this.settingsService.getClientId().subscribe(x => this.clientId = x); this.settingsService.getClientId().subscribe(x => this.clientId = x);
@ -31,25 +31,25 @@ export class PlexComponent implements OnInit {
} }
this.identityService.createWizardUser({ this.identityService.createWizardUser({
username: "", username: "",
password: "", password: "",
usePlexAdminAccount: true, usePlexAdminAccount: true,
}).subscribe(y => { }).subscribe(y => {
if (y) { if (y) {
this.router.navigate(["login"]); this.router.navigate(["login"]);
} else { } else {
this.notificationService.error("Could not get the Plex Admin Information"); this.notificationService.error("Could not get the Plex Admin Information");
return; return;
} }
}); });
}, }
); );
} }
public oauth() { public oauth() {
this.plexTv.GetPin(this.clientId, "Ombi").subscribe(pin => { this.plexTv.GetPin(this.clientId, "Ombi").subscribe((pin: any) => {
this.plexService.oAuth({wizard: true, pin}).subscribe(x => { this.plexService.oAuth({ wizard: true, pin }).subscribe(x => {
if(x.url) { if (x.url) {
window.location.href = x.url; window.location.href = x.url;
} }
}); });

@ -11,11 +11,11 @@ export class PlexOAuthComponent implements OnInit {
public pinId: number; public pinId: number;
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private plexOauth: PlexOAuthService, private plexOauth: PlexOAuthService,
private identityService: IdentityService, private identityService: IdentityService,
private settings: SettingsService, private settings: SettingsService,
private router: Router, private router: Router,
private auth: AuthService) { private auth: AuthService) {
this.route.params this.route.params
.subscribe((params: any) => { .subscribe((params: any) => {
@ -25,43 +25,40 @@ export class PlexOAuthComponent implements OnInit {
public ngOnInit(): void { public ngOnInit(): void {
this.plexOauth.oAuth(this.pinId).subscribe(x => { this.plexOauth.oAuth(this.pinId).subscribe(x => {
if(!x.accessToken) { if (!x.accessToken) {
return; return;
// RETURN // RETURN
} }
this.identityService.createWizardUser({ this.identityService.createWizardUser({
username: "", username: "",
password: "", password: "",
usePlexAdminAccount: true, usePlexAdminAccount: true,
}).subscribe(u => { }).subscribe(u => {
if (u) { if (u) {
this.auth.oAuth(this.pinId).subscribe(c => { this.auth.oAuth(this.pinId).subscribe(c => {
localStorage.setItem("id_token", c.access_token); localStorage.setItem("id_token", c.access_token);
// Mark that we have done the settings now // Mark that we have done the settings now
this.settings.getOmbi().subscribe(ombi => { this.settings.getOmbi().subscribe(ombi => {
ombi.wizard = true; ombi.wizard = true;
this.settings.saveOmbi(ombi).subscribe(s => { this.settings.saveOmbi(ombi).subscribe(s => {
this.settings.getUserManagementSettings().subscribe(usr => { this.settings.getUserManagementSettings().subscribe(usr => {
usr.importPlexAdmin = true; usr.importPlexAdmin = true;
this.settings.saveUserManagementSettings(usr).subscribe(saved => { this.settings.saveUserManagementSettings(usr).subscribe(saved => {
this.router.navigate(["login"]); this.router.navigate(["login"]);
}); });
}); });
});
}); });
});
});
} else {
//this.notificationService.error("Could not get the Plex Admin Information");
return;
}
}); });
} else {
//this.notificationService.error("Could not get the Plex Admin Information");
return;
}
});
}); });
} }
} }

@ -8,7 +8,7 @@
], ],
"max-line-length": [ "max-line-length": [
true, true,
200 250
], ],
"arrow-parens": false, "arrow-parens": false,
"radix": false, "radix": false,
@ -16,22 +16,22 @@
"indent": [ "indent": [
false false
], ],
"whitespace": [
false
],
"no-unused-expression": [ "no-unused-expression": [
true, true,
"allow-new" "allow-new"
], ],
"no-trailing-whitespace": [
false
],
"max-classes-per-file": [ "max-classes-per-file": [
false false
], ],
"no-shadowed-variable": false, "no-shadowed-variable": false,
"comment-format": [ "comment-format": [
false false
],
"no-namespace": [
false
],
"no-internal-module": [
false
] ]
} }
} }
Loading…
Cancel
Save