Merge branch 'develop' of https://github.com/tidusjar/Ombi into develop

This commit is contained in:
Jamie 2018-04-28 20:48:05 +01:00
commit 1ffa159ddb
5 changed files with 20 additions and 50 deletions

View file

@ -1,13 +1,13 @@
![](http://i.imgur.com/qQsN78U.png) ![](http://i.imgur.com/qQsN78U.png)
____ ____
[![Discord](https://img.shields.io/discord/102860784329052160.svg)](https://discord.gg/KxYZ64w) [![Discord](https://img.shields.io/discord/270828201473736705.svg)](https://discord.gg/Sa7wNWb)
[![Docker Pulls](https://img.shields.io/docker/pulls/linuxserver/ombi.svg)](https://hub.docker.com/r/linuxserver/ombi/) [![Docker Pulls](https://img.shields.io/docker/pulls/linuxserver/ombi.svg)](https://hub.docker.com/r/linuxserver/ombi/)
[![Github All Releases](https://img.shields.io/github/downloads/tidusjar/Ombi/total.svg)](https://github.com/tidusjar/Ombi) [![Github All Releases](https://img.shields.io/github/downloads/tidusjar/Ombi/total.svg)](https://github.com/tidusjar/Ombi)
[![firsttimersonly](http://img.shields.io/badge/first--timers--only-friendly-blue.svg?style=flat-square)](http://www.firsttimersonly.com/) [![firsttimersonly](http://img.shields.io/badge/first--timers--only-friendly-blue.svg)](http://www.firsttimersonly.com/)
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/ombi/localized.svg)](https://crowdin.com/project/ombi) [![Crowdin](https://d322cqt584bo4o.cloudfront.net/ombi/localized.svg)](https://crowdin.com/project/ombi)
[![Patreon](https://www.ombi.io/img/patreondonate.svg)](https://patreon.com/tidusjar/Ombi) [![Patreon](https://img.shields.io/badge/patreon-donate-yellow.svg)](https://patreon.com/tidusjar/Ombi)
[![Paypal](https://www.ombi.io/img/paypaldonate.svg)](https://paypal.me/PlexRequestsNet) [![Paypal](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://paypal.me/PlexRequestsNet)
___ ___

View file

@ -2,7 +2,7 @@ version: 3.0.{build}
configuration: Release configuration: Release
os: Visual Studio 2017 os: Visual Studio 2017
environment: environment:
nodejs_version: "Current" nodejs_version: "9.8.0"
install: install:
# Get the latest stable version of Node.js or io.js # Get the latest stable version of Node.js or io.js

View file

@ -1,10 +1,8 @@
import { Component } from "@angular/core"; import { Component } from "@angular/core";
import { Router } from "@angular/router"; import { Router } from "@angular/router";
import { AuthService } from "../../auth/auth.service";
import { IdentityService } from "../../services"; import { IdentityService } from "../../services";
import { NotificationService } from "../../services"; import { NotificationService } from "../../services";
import { SettingsService } from "../../services";
@Component({ @Component({
templateUrl: "./createadmin.component.html", templateUrl: "./createadmin.component.html",
@ -15,28 +13,12 @@ export class CreateAdminComponent {
public password: string; public password: string;
constructor(private identityService: IdentityService, private notificationService: NotificationService, constructor(private identityService: IdentityService, private notificationService: NotificationService,
private router: Router, private auth: AuthService, private settings: SettingsService) { } private router: Router) { }
public createUser() { public createUser() {
this.identityService.createWizardUser({username: this.username, password: this.password, usePlexAdminAccount: false}).subscribe(x => { this.identityService.createWizardUser({username: this.username, password: this.password, usePlexAdminAccount: false}).subscribe(x => {
if (x) { if (x) {
// Log me in. this.router.navigate(["login"]);
this.auth.login({ username: this.username, password: this.password, rememberMe: false, usePlexOAuth:false }).subscribe(c => {
localStorage.setItem("id_token", c.access_token);
// Mark that we have done the settings now
this.settings.getOmbi().subscribe(ombi => {
ombi.wizard = true;
this.settings.saveOmbi(ombi).subscribe(x => {
this.router.navigate(["search"]);
});
});
});
} else { } else {
this.notificationService.error("There was an error... You might want to put this on Github..."); this.notificationService.error("There was an error... You might want to put this on Github...");
} }

View file

@ -2,8 +2,7 @@
import { Router } from "@angular/router"; import { Router } from "@angular/router";
import { PlexService } from "../../services"; import { PlexService } from "../../services";
import { IdentityService, NotificationService, SettingsService } from "../../services"; import { IdentityService, NotificationService } from "../../services";
import { AuthService } from "./../../auth/auth.service";
@Component({ @Component({
templateUrl: "./plex.component.html", templateUrl: "./plex.component.html",
@ -15,9 +14,7 @@ export class PlexComponent {
constructor(private plexService: PlexService, private router: Router, constructor(private plexService: PlexService, private router: Router,
private notificationService: NotificationService, private notificationService: NotificationService,
private identityService: IdentityService, private identityService: IdentityService) { }
private settings: SettingsService,
private auth: AuthService) { }
public requestAuthToken() { public requestAuthToken() {
this.plexService.logIn(this.login, this.password).subscribe(x => { this.plexService.logIn(this.login, this.password).subscribe(x => {
@ -32,25 +29,7 @@ export class PlexComponent {
usePlexAdminAccount: true, usePlexAdminAccount: true,
}).subscribe(y => { }).subscribe(y => {
if (y) { if (y) {
this.auth.login({ username: this.login, password: this.password, rememberMe: false, usePlexOAuth: false }).subscribe(c => { this.router.navigate(["login"]);
localStorage.setItem("id_token", c.access_token);
// Mark that we have done the settings now
this.settings.getOmbi().subscribe(ombi => {
ombi.wizard = true;
this.settings.saveOmbi(ombi).subscribe(s => {
this.settings.getUserManagementSettings().subscribe(usr => {
usr.importPlexAdmin = true;
this.settings.saveUserManagementSettings(usr).subscribe(saved => {
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;

View file

@ -48,6 +48,7 @@ namespace Ombi.Controllers
public IdentityController(OmbiUserManager user, IMapper mapper, RoleManager<IdentityRole> rm, IEmailProvider prov, public IdentityController(OmbiUserManager user, IMapper mapper, RoleManager<IdentityRole> rm, IEmailProvider prov,
ISettingsService<EmailNotificationSettings> s, ISettingsService<EmailNotificationSettings> s,
ISettingsService<CustomizationSettings> c, ISettingsService<CustomizationSettings> c,
ISettingsService<OmbiSettings> ombiSettings,
IWelcomeEmail welcome, IWelcomeEmail welcome,
IMovieRequestRepository m, IMovieRequestRepository m,
ITvRequestRepository t, ITvRequestRepository t,
@ -73,6 +74,7 @@ namespace Ombi.Controllers
_issuesRepository = issues; _issuesRepository = issues;
_requestLogRepository = requestLog; _requestLogRepository = requestLog;
_issueCommentsRepository = issueComments; _issueCommentsRepository = issueComments;
OmbiSettings = ombiSettings;
} }
private OmbiUserManager UserManager { get; } private OmbiUserManager UserManager { get; }
@ -81,6 +83,7 @@ namespace Ombi.Controllers
private IEmailProvider EmailProvider { get; } private IEmailProvider EmailProvider { get; }
private ISettingsService<EmailNotificationSettings> EmailSettings { get; } private ISettingsService<EmailNotificationSettings> EmailSettings { get; }
private ISettingsService<CustomizationSettings> CustomizationSettings { get; } private ISettingsService<CustomizationSettings> CustomizationSettings { get; }
private ISettingsService<OmbiSettings> OmbiSettings { get; }
private IWelcomeEmail WelcomeEmail { get; } private IWelcomeEmail WelcomeEmail { get; }
private IMovieRequestRepository MovieRepo { get; } private IMovieRequestRepository MovieRepo { get; }
private ITvRequestRepository TvRepo { get; } private ITvRequestRepository TvRepo { get; }
@ -107,7 +110,7 @@ namespace Ombi.Controllers
public async Task<bool> CreateWizardUser([FromBody] CreateUserWizardModel user) public async Task<bool> CreateWizardUser([FromBody] CreateUserWizardModel user)
{ {
var users = UserManager.Users; var users = UserManager.Users;
if (users.Any()) if (users.Any(x => !x.UserName.Equals("api", StringComparison.CurrentCultureIgnoreCase)))
{ {
// No one should be calling this. Only the wizard // No one should be calling this. Only the wizard
return false; return false;
@ -174,6 +177,12 @@ namespace Ombi.Controllers
{ {
LogErrors(result); LogErrors(result);
} }
// Update the wizard flag
var settings = await OmbiSettings.GetSettingsAsync();
settings.Wizard = true;
await OmbiSettings.SaveSettingsAsync(settings);
return result.Succeeded; return result.Succeeded;
} }