#1456 Started on the User Importer

Also added the remember me button
pull/1510/head
Jamie.Rees 7 years ago
parent e34db987d7
commit 36d93d5a9d

@ -1,5 +1,6 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Ombi.Api.Plex.Models; using Ombi.Api.Plex.Models;
using Ombi.Api.Plex.Models.Friends;
using Ombi.Api.Plex.Models.Server; using Ombi.Api.Plex.Models.Server;
using Ombi.Api.Plex.Models.Status; using Ombi.Api.Plex.Models.Status;
@ -16,5 +17,6 @@ namespace Ombi.Api.Plex
Task<PlexMetadata> GetMetadata(string authToken, string plexFullHost, int itemId); Task<PlexMetadata> GetMetadata(string authToken, string plexFullHost, int itemId);
Task<PlexMetadata> GetSeasons(string authToken, string plexFullHost, int ratingKey); Task<PlexMetadata> GetSeasons(string authToken, string plexFullHost, int ratingKey);
Task<PlexContainer> GetAllEpisodes(string authToken, string host, string section, int start, int retCount); Task<PlexContainer> GetAllEpisodes(string authToken, string host, string section, int start, int retCount);
Task<PlexFriends> GetUsers(string authToken);
} }
} }

@ -0,0 +1,59 @@
using System.Xml.Serialization;
namespace Ombi.Api.Plex.Models.Friends
{
[XmlRoot(ElementName = "Server")]
public class Server
{
[XmlAttribute(AttributeName = "id")]
public string Id { get; set; }
[XmlAttribute(AttributeName = "serverId")]
public string ServerId { get; set; }
[XmlAttribute(AttributeName = "machineIdentifier")]
public string MachineIdentifier { get; set; }
[XmlAttribute(AttributeName = "name")]
public string Name { get; set; }
[XmlAttribute(AttributeName = "lastSeenAt")]
public string LastSeenAt { get; set; }
[XmlAttribute(AttributeName = "numLibraries")]
public string NumLibraries { get; set; }
[XmlAttribute(AttributeName = "owned")]
public string Owned { get; set; }
}
[XmlRoot(ElementName = "User")]
public class UserFriends
{
[XmlElement(ElementName = "Server")]
public Server Server { get; set; }
[XmlAttribute(AttributeName = "id")]
public string Id { get; set; }
[XmlAttribute(AttributeName = "title")]
public string Title { get; set; }
[XmlAttribute(AttributeName = "username")]
public string Username { get; set; }
[XmlAttribute(AttributeName = "email")]
public string Email { get; set; }
[XmlAttribute(AttributeName = "recommendationsPlaylistId")]
public string RecommendationsPlaylistId { get; set; }
[XmlAttribute(AttributeName = "thumb")]
public string Thumb { get; set; }
}
[XmlRoot(ElementName = "MediaContainer")]
public class PlexFriends
{
[XmlElement(ElementName = "User")]
public UserFriends[] User { get; set; }
[XmlAttribute(AttributeName = "friendlyName")]
public string FriendlyName { get; set; }
[XmlAttribute(AttributeName = "identifier")]
public string Identifier { get; set; }
[XmlAttribute(AttributeName = "machineIdentifier")]
public string MachineIdentifier { get; set; }
[XmlAttribute(AttributeName = "totalSize")]
public string TotalSize { get; set; }
[XmlAttribute(AttributeName = "size")]
public string Size { get; set; }
}
}

@ -1,6 +1,7 @@
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Ombi.Api.Plex.Models; using Ombi.Api.Plex.Models;
using Ombi.Api.Plex.Models.Friends;
using Ombi.Api.Plex.Models.Server; using Ombi.Api.Plex.Models.Server;
using Ombi.Api.Plex.Models.Status; using Ombi.Api.Plex.Models.Status;
@ -126,6 +127,20 @@ namespace Ombi.Api.Plex
return await Api.Request<PlexContainer>(request); return await Api.Request<PlexContainer>(request);
} }
/// <summary>
/// Retuns all the Plex users for this account
/// NOTE: For HOME USERS. There is no username or email, the user's home name is under the title property
/// </summary>
/// <param name="authToken"></param>
/// <returns></returns>
public async Task<PlexFriends> GetUsers(string authToken)
{
var request = new Request(string.Empty,FriendsUri, HttpMethod.Get, ContentType.Xml);
AddHeaders(request, authToken);
return await Api.Request<PlexFriends>(request);
}
/// <summary> /// <summary>
/// Adds the required headers and also the authorization header /// Adds the required headers and also the authorization header
/// </summary> /// </summary>

@ -13,6 +13,7 @@ namespace Ombi.Helpers
public static EventId RadarrCacher => new EventId(2001); public static EventId RadarrCacher => new EventId(2001);
public static EventId PlexEpisodeCacher => new EventId(2001); public static EventId PlexEpisodeCacher => new EventId(2001);
public static EventId EmbyContentCacher => new EventId(2002); public static EventId EmbyContentCacher => new EventId(2002);
public static EventId PlexUserImporter => new EventId(2003);
public static EventId MovieSender => new EventId(3000); public static EventId MovieSender => new EventId(3000);

@ -0,0 +1,85 @@
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Ombi.Api.Plex;
using Ombi.Core.Settings;
using Ombi.Core.Settings.Models.External;
using Ombi.Helpers;
using Ombi.Store.Entities;
namespace Ombi.Schedule.Jobs.Plex
{
public class PlexUserImporter
{
public PlexUserImporter(IPlexApi api, UserManager<OmbiUser> um, ILogger<PlexUserImporter> log,
ISettingsService<PlexSettings> plexSettings)
{
_api = api;
_userManager = um;
_log = log;
_plexSettings = plexSettings;
}
private readonly IPlexApi _api;
private readonly UserManager<OmbiUser> _userManager;
private readonly ILogger<PlexUserImporter> _log;
private readonly ISettingsService<PlexSettings> _plexSettings;
public async Task Start()
{
var settings = await _plexSettings.GetSettingsAsync();
if (!settings.Enable)
{
return;
}
var allUsers = await _userManager.Users.Where(x => x.UserType == UserType.PlexUser).ToListAsync();
foreach (var server in settings.Servers)
{
if (string.IsNullOrEmpty(server.PlexAuthToken))
{
continue;
}
var users = await _api.GetUsers(server.PlexAuthToken);
foreach (var plexUsers in users.User)
{
// Check if this Plex User already exists
// We are using the Plex USERNAME and Not the TITLE, the Title is for HOME USERS
var existingPlexUser = allUsers.FirstOrDefault(x => x.ProviderUserId == plexUsers.Id);
if (existingPlexUser == null)
{
// Create this users
// We do not store a password against the user since they will authenticate via Plex
var newUser = new OmbiUser
{
UserType = UserType.PlexUser,
UserName = plexUsers.Username,
ProviderUserId = plexUsers.Id,
Email = plexUsers.Email,
Alias = string.Empty
};
var result = await _userManager.CreateAsync(newUser);
if (!result.Succeeded)
{
foreach (var identityError in result.Errors)
{
_log.LogError(LoggingEvents.PlexUserImporter, identityError.Description);
}
continue;
}
// TODO Set default permissions/roles
}
else
{
// Do we need to update this user?
}
}
}
}
}
}

@ -7,6 +7,10 @@ namespace Ombi.Store.Entities
{ {
public string Alias { get; set; } public string Alias { get; set; }
public UserType UserType { get; set; } public UserType UserType { get; set; }
/// <summary>
/// This will be the unique Plex/Emby user id reference
/// </summary>
public string ProviderUserId { get; set; }
[NotMapped] [NotMapped]
public string UserAlias => string.IsNullOrEmpty(Alias) ? UserName : Alias; public string UserAlias => string.IsNullOrEmpty(Alias) ? UserName : Alias;

@ -1,24 +1,28 @@
using System; // <auto-generated />
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using Ombi.Helpers;
using Ombi.Store.Context; using Ombi.Store.Context;
using Ombi.Store.Entities; using Ombi.Store.Entities;
using Ombi.Helpers; using System;
namespace Ombi.Store.Migrations namespace Ombi.Store.Migrations
{ {
[DbContext(typeof(OmbiContext))] [DbContext(typeof(OmbiContext))]
[Migration("20170901230032_Inital")] [Migration("20170914122422_Inital")]
partial class Inital partial class Inital
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "1.1.2"); .HasAnnotation("ProductVersion", "2.0.0-rtm-26452");
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{ {
b.Property<string>("Id") b.Property<string>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
@ -41,7 +45,7 @@ namespace Ombi.Store.Migrations
b.ToTable("AspNetRoles"); b.ToTable("AspNetRoles");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
@ -60,7 +64,7 @@ namespace Ombi.Store.Migrations
b.ToTable("AspNetRoleClaims"); b.ToTable("AspNetRoleClaims");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
@ -79,7 +83,7 @@ namespace Ombi.Store.Migrations
b.ToTable("AspNetUserClaims"); b.ToTable("AspNetUserClaims");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{ {
b.Property<string>("LoginProvider"); b.Property<string>("LoginProvider");
@ -97,7 +101,7 @@ namespace Ombi.Store.Migrations
b.ToTable("AspNetUserLogins"); b.ToTable("AspNetUserLogins");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{ {
b.Property<string>("UserId"); b.Property<string>("UserId");
@ -110,7 +114,7 @@ namespace Ombi.Store.Migrations
b.ToTable("AspNetUserRoles"); b.ToTable("AspNetUserRoles");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserToken<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{ {
b.Property<string>("UserId"); b.Property<string>("UserId");
@ -166,7 +170,8 @@ namespace Ombi.Store.Migrations
b.Property<DateTime>("AddedAt"); b.Property<DateTime>("AddedAt");
b.Property<string>("EmbyId"); b.Property<string>("EmbyId")
.IsRequired();
b.Property<string>("ProviderId"); b.Property<string>("ProviderId");
@ -179,6 +184,32 @@ namespace Ombi.Store.Migrations
b.ToTable("EmbyContent"); b.ToTable("EmbyContent");
}); });
modelBuilder.Entity("Ombi.Store.Entities.EmbyEpisode", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("AddedAt");
b.Property<string>("EmbyId");
b.Property<int>("EpisodeNumber");
b.Property<string>("ParentId");
b.Property<string>("ProviderId");
b.Property<int>("SeasonNumber");
b.Property<string>("Title");
b.HasKey("Id");
b.HasIndex("ParentId");
b.ToTable("EmbyEpisode");
});
modelBuilder.Entity("Ombi.Store.Entities.GlobalSettings", b => modelBuilder.Entity("Ombi.Store.Entities.GlobalSettings", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
@ -246,6 +277,8 @@ namespace Ombi.Store.Migrations
b.Property<bool>("PhoneNumberConfirmed"); b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("ProviderUserId");
b.Property<string>("SecurityStamp"); b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled"); b.Property<bool>("TwoFactorEnabled");
@ -555,43 +588,59 @@ namespace Ombi.Store.Migrations
b.ToTable("SeasonRequests"); b.ToTable("SeasonRequests");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{ {
b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole") b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany("Claims") .WithMany()
.HasForeignKey("RoleId") .HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{ {
b.HasOne("Ombi.Store.Entities.OmbiUser") b.HasOne("Ombi.Store.Entities.OmbiUser")
.WithMany("Claims") .WithMany()
.HasForeignKey("UserId") .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{ {
b.HasOne("Ombi.Store.Entities.OmbiUser") b.HasOne("Ombi.Store.Entities.OmbiUser")
.WithMany("Logins") .WithMany()
.HasForeignKey("UserId") .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{ {
b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole") b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany("Users") .WithMany()
.HasForeignKey("RoleId") .HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
b.HasOne("Ombi.Store.Entities.OmbiUser") b.HasOne("Ombi.Store.Entities.OmbiUser")
.WithMany("Roles") .WithMany()
.HasForeignKey("UserId") .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Ombi.Store.Entities.OmbiUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Ombi.Store.Entities.EmbyEpisode", b =>
{
b.HasOne("Ombi.Store.Entities.EmbyContent", "Series")
.WithMany("Episodes")
.HasForeignKey("ParentId")
.HasPrincipalKey("EmbyId");
});
modelBuilder.Entity("Ombi.Store.Entities.PlexEpisode", b => modelBuilder.Entity("Ombi.Store.Entities.PlexEpisode", b =>
{ {
b.HasOne("Ombi.Store.Entities.PlexContent", "Series") b.HasOne("Ombi.Store.Entities.PlexContent", "Series")
@ -674,6 +723,7 @@ namespace Ombi.Store.Migrations
.HasForeignKey("ChildRequestId") .HasForeignKey("ChildRequestId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
#pragma warning restore 612, 618
} }
} }
} }

@ -1,6 +1,6 @@
using System; using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Ombi.Store.Migrations namespace Ombi.Store.Migrations
{ {
@ -9,58 +9,72 @@ namespace Ombi.Store.Migrations
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "AspNetRoles", name: "ApplicationConfiguration",
columns: table => new columns: table => new
{ {
Id = table.Column<string>(nullable: false), Id = table.Column<int>(type: "INTEGER", nullable: false)
ConcurrencyStamp = table.Column<string>(nullable: true), .Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(maxLength: 256, nullable: true), Type = table.Column<int>(type: "INTEGER", nullable: false),
NormalizedName = table.Column<string>(maxLength: 256, nullable: true) Value = table.Column<string>(type: "TEXT", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_AspNetRoles", x => x.Id); table.PrimaryKey("PK_ApplicationConfiguration", x => x.Id);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "AspNetUserTokens", name: "AspNetRoles",
columns: table => new columns: table => new
{ {
UserId = table.Column<string>(nullable: false), Id = table.Column<string>(type: "TEXT", nullable: false),
LoginProvider = table.Column<string>(nullable: false), ConcurrencyStamp = table.Column<string>(type: "TEXT", nullable: true),
Name = table.Column<string>(nullable: false), Name = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
Value = table.Column<string>(nullable: true) NormalizedName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); table.PrimaryKey("PK_AspNetRoles", x => x.Id);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "ApplicationConfiguration", name: "AspNetUsers",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<string>(type: "TEXT", nullable: false),
.Annotation("Sqlite:Autoincrement", true), AccessFailedCount = table.Column<int>(type: "INTEGER", nullable: false),
Type = table.Column<int>(nullable: false), Alias = table.Column<string>(type: "TEXT", nullable: true),
Value = table.Column<string>(nullable: true) ConcurrencyStamp = table.Column<string>(type: "TEXT", nullable: true),
Email = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(type: "INTEGER", nullable: false),
LockoutEnabled = table.Column<bool>(type: "INTEGER", nullable: false),
LockoutEnd = table.Column<DateTimeOffset>(type: "TEXT", nullable: true),
NormalizedEmail = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
NormalizedUserName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
PasswordHash = table.Column<string>(type: "TEXT", nullable: true),
PhoneNumber = table.Column<string>(type: "TEXT", nullable: true),
PhoneNumberConfirmed = table.Column<bool>(type: "INTEGER", nullable: false),
ProviderUserId = table.Column<string>(type: "TEXT", nullable: true),
SecurityStamp = table.Column<string>(type: "TEXT", nullable: true),
TwoFactorEnabled = table.Column<bool>(type: "INTEGER", nullable: false),
UserName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
UserType = table.Column<int>(type: "INTEGER", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_ApplicationConfiguration", x => x.Id); table.PrimaryKey("PK_AspNetUsers", x => x.Id);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "Audit", name: "Audit",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
AuditArea = table.Column<int>(nullable: false), AuditArea = table.Column<int>(type: "INTEGER", nullable: false),
AuditType = table.Column<int>(nullable: false), AuditType = table.Column<int>(type: "INTEGER", nullable: false),
DateTime = table.Column<DateTime>(nullable: false), DateTime = table.Column<DateTime>(type: "TEXT", nullable: false),
Description = table.Column<string>(nullable: true), Description = table.Column<string>(type: "TEXT", nullable: true),
User = table.Column<string>(nullable: true) User = table.Column<string>(type: "TEXT", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -71,27 +85,28 @@ namespace Ombi.Store.Migrations
name: "EmbyContent", name: "EmbyContent",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
AddedAt = table.Column<DateTime>(nullable: false), AddedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
EmbyId = table.Column<string>(nullable: true), EmbyId = table.Column<string>(type: "TEXT", nullable: false),
ProviderId = table.Column<string>(nullable: true), ProviderId = table.Column<string>(type: "TEXT", nullable: true),
Title = table.Column<string>(nullable: true), Title = table.Column<string>(type: "TEXT", nullable: true),
Type = table.Column<int>(nullable: false) Type = table.Column<int>(type: "INTEGER", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_EmbyContent", x => x.Id); table.PrimaryKey("PK_EmbyContent", x => x.Id);
table.UniqueConstraint("AK_EmbyContent_EmbyId", x => x.EmbyId);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "GlobalSettings", name: "GlobalSettings",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
Content = table.Column<string>(nullable: true), Content = table.Column<string>(type: "TEXT", nullable: true),
SettingsName = table.Column<string>(nullable: true) SettingsName = table.Column<string>(type: "TEXT", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -102,60 +117,33 @@ namespace Ombi.Store.Migrations
name: "NotificationTemplates", name: "NotificationTemplates",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
Agent = table.Column<int>(nullable: false), Agent = table.Column<int>(type: "INTEGER", nullable: false),
Enabled = table.Column<bool>(nullable: false), Enabled = table.Column<bool>(type: "INTEGER", nullable: false),
Message = table.Column<string>(nullable: true), Message = table.Column<string>(type: "TEXT", nullable: true),
NotificationType = table.Column<int>(nullable: false), NotificationType = table.Column<int>(type: "INTEGER", nullable: false),
Subject = table.Column<string>(nullable: true) Subject = table.Column<string>(type: "TEXT", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_NotificationTemplates", x => x.Id); table.PrimaryKey("PK_NotificationTemplates", x => x.Id);
}); });
migrationBuilder.CreateTable(
name: "AspNetUsers",
columns: table => new
{
Id = table.Column<string>(nullable: false),
AccessFailedCount = table.Column<int>(nullable: false),
Alias = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true),
Email = table.Column<string>(maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(nullable: false),
LockoutEnabled = table.Column<bool>(nullable: false),
LockoutEnd = table.Column<DateTimeOffset>(nullable: true),
NormalizedEmail = table.Column<string>(maxLength: 256, nullable: true),
NormalizedUserName = table.Column<string>(maxLength: 256, nullable: true),
PasswordHash = table.Column<string>(nullable: true),
PhoneNumber = table.Column<string>(nullable: true),
PhoneNumberConfirmed = table.Column<bool>(nullable: false),
SecurityStamp = table.Column<string>(nullable: true),
TwoFactorEnabled = table.Column<bool>(nullable: false),
UserName = table.Column<string>(maxLength: 256, nullable: true),
UserType = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUsers", x => x.Id);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "PlexContent", name: "PlexContent",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
AddedAt = table.Column<DateTime>(nullable: false), AddedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
Key = table.Column<int>(nullable: false), Key = table.Column<int>(type: "INTEGER", nullable: false),
ProviderId = table.Column<string>(nullable: true), ProviderId = table.Column<string>(type: "TEXT", nullable: true),
Quality = table.Column<string>(nullable: true), Quality = table.Column<string>(type: "TEXT", nullable: true),
ReleaseYear = table.Column<string>(nullable: true), ReleaseYear = table.Column<string>(type: "TEXT", nullable: true),
Title = table.Column<string>(nullable: true), Title = table.Column<string>(type: "TEXT", nullable: true),
Type = table.Column<int>(nullable: false), Type = table.Column<int>(type: "INTEGER", nullable: false),
Url = table.Column<string>(nullable: true) Url = table.Column<string>(type: "TEXT", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -167,9 +155,9 @@ namespace Ombi.Store.Migrations
name: "RadarrCache", name: "RadarrCache",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
TheMovieDbId = table.Column<int>(nullable: false) TheMovieDbId = table.Column<int>(type: "INTEGER", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -180,16 +168,16 @@ namespace Ombi.Store.Migrations
name: "TvRequests", name: "TvRequests",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
ImdbId = table.Column<string>(nullable: true), ImdbId = table.Column<string>(type: "TEXT", nullable: true),
Overview = table.Column<string>(nullable: true), Overview = table.Column<string>(type: "TEXT", nullable: true),
PosterPath = table.Column<string>(nullable: true), PosterPath = table.Column<string>(type: "TEXT", nullable: true),
ReleaseDate = table.Column<DateTime>(nullable: false), ReleaseDate = table.Column<DateTime>(type: "TEXT", nullable: false),
RootFolder = table.Column<int>(nullable: true), RootFolder = table.Column<int>(type: "INTEGER", nullable: true),
Status = table.Column<string>(nullable: true), Status = table.Column<string>(type: "TEXT", nullable: true),
Title = table.Column<string>(nullable: true), Title = table.Column<string>(type: "TEXT", nullable: true),
TvDbId = table.Column<int>(nullable: false) TvDbId = table.Column<int>(type: "INTEGER", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -200,11 +188,11 @@ namespace Ombi.Store.Migrations
name: "AspNetRoleClaims", name: "AspNetRoleClaims",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
ClaimType = table.Column<string>(nullable: true), ClaimType = table.Column<string>(type: "TEXT", nullable: true),
ClaimValue = table.Column<string>(nullable: true), ClaimValue = table.Column<string>(type: "TEXT", nullable: true),
RoleId = table.Column<string>(nullable: false) RoleId = table.Column<string>(type: "TEXT", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -221,11 +209,11 @@ namespace Ombi.Store.Migrations
name: "AspNetUserClaims", name: "AspNetUserClaims",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
ClaimType = table.Column<string>(nullable: true), ClaimType = table.Column<string>(type: "TEXT", nullable: true),
ClaimValue = table.Column<string>(nullable: true), ClaimValue = table.Column<string>(type: "TEXT", nullable: true),
UserId = table.Column<string>(nullable: false) UserId = table.Column<string>(type: "TEXT", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -242,10 +230,10 @@ namespace Ombi.Store.Migrations
name: "AspNetUserLogins", name: "AspNetUserLogins",
columns: table => new columns: table => new
{ {
LoginProvider = table.Column<string>(nullable: false), LoginProvider = table.Column<string>(type: "TEXT", nullable: false),
ProviderKey = table.Column<string>(nullable: false), ProviderKey = table.Column<string>(type: "TEXT", nullable: false),
ProviderDisplayName = table.Column<string>(nullable: true), ProviderDisplayName = table.Column<string>(type: "TEXT", nullable: true),
UserId = table.Column<string>(nullable: false) UserId = table.Column<string>(type: "TEXT", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -262,8 +250,8 @@ namespace Ombi.Store.Migrations
name: "AspNetUserRoles", name: "AspNetUserRoles",
columns: table => new columns: table => new
{ {
UserId = table.Column<string>(nullable: false), UserId = table.Column<string>(type: "TEXT", nullable: false),
RoleId = table.Column<string>(nullable: false) RoleId = table.Column<string>(type: "TEXT", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -282,27 +270,47 @@ namespace Ombi.Store.Migrations
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable(
name: "AspNetUserTokens",
columns: table => new
{
UserId = table.Column<string>(type: "TEXT", nullable: false),
LoginProvider = table.Column<string>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", nullable: false),
Value = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
table.ForeignKey(
name: "FK_AspNetUserTokens_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "MovieRequests", name: "MovieRequests",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
Approved = table.Column<bool>(nullable: false), Approved = table.Column<bool>(type: "INTEGER", nullable: false),
Available = table.Column<bool>(nullable: false), Available = table.Column<bool>(type: "INTEGER", nullable: false),
Denied = table.Column<bool>(nullable: true), Denied = table.Column<bool>(type: "INTEGER", nullable: true),
DeniedReason = table.Column<string>(nullable: true), DeniedReason = table.Column<string>(type: "TEXT", nullable: true),
ImdbId = table.Column<string>(nullable: true), ImdbId = table.Column<string>(type: "TEXT", nullable: true),
IssueId = table.Column<int>(nullable: true), IssueId = table.Column<int>(type: "INTEGER", nullable: true),
Overview = table.Column<string>(nullable: true), Overview = table.Column<string>(type: "TEXT", nullable: true),
PosterPath = table.Column<string>(nullable: true), PosterPath = table.Column<string>(type: "TEXT", nullable: true),
ReleaseDate = table.Column<DateTime>(nullable: false), ReleaseDate = table.Column<DateTime>(type: "TEXT", nullable: false),
RequestType = table.Column<int>(nullable: false), RequestType = table.Column<int>(type: "INTEGER", nullable: false),
RequestedDate = table.Column<DateTime>(nullable: false), RequestedDate = table.Column<DateTime>(type: "TEXT", nullable: false),
RequestedUserId = table.Column<string>(nullable: true), RequestedUserId = table.Column<string>(type: "TEXT", nullable: true),
Status = table.Column<string>(nullable: true), Status = table.Column<string>(type: "TEXT", nullable: true),
TheMovieDbId = table.Column<int>(nullable: false), TheMovieDbId = table.Column<int>(type: "INTEGER", nullable: false),
Title = table.Column<string>(nullable: true) Title = table.Column<string>(type: "TEXT", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -319,10 +327,10 @@ namespace Ombi.Store.Migrations
name: "Tokens", name: "Tokens",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
Token = table.Column<string>(nullable: true), Token = table.Column<string>(type: "TEXT", nullable: true),
UserId = table.Column<string>(nullable: true) UserId = table.Column<string>(type: "TEXT", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -335,18 +343,43 @@ namespace Ombi.Store.Migrations
onDelete: ReferentialAction.Restrict); onDelete: ReferentialAction.Restrict);
}); });
migrationBuilder.CreateTable(
name: "EmbyEpisode",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
AddedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
EmbyId = table.Column<string>(type: "TEXT", nullable: true),
EpisodeNumber = table.Column<int>(type: "INTEGER", nullable: false),
ParentId = table.Column<string>(type: "TEXT", nullable: true),
ProviderId = table.Column<string>(type: "TEXT", nullable: true),
SeasonNumber = table.Column<int>(type: "INTEGER", nullable: false),
Title = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_EmbyEpisode", x => x.Id);
table.ForeignKey(
name: "FK_EmbyEpisode_EmbyContent_ParentId",
column: x => x.ParentId,
principalTable: "EmbyContent",
principalColumn: "EmbyId",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "PlexEpisode", name: "PlexEpisode",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
EpisodeNumber = table.Column<int>(nullable: false), EpisodeNumber = table.Column<int>(type: "INTEGER", nullable: false),
GrandparentKey = table.Column<int>(nullable: false), GrandparentKey = table.Column<int>(type: "INTEGER", nullable: false),
Key = table.Column<int>(nullable: false), Key = table.Column<int>(type: "INTEGER", nullable: false),
ParentKey = table.Column<int>(nullable: false), ParentKey = table.Column<int>(type: "INTEGER", nullable: false),
SeasonNumber = table.Column<int>(nullable: false), SeasonNumber = table.Column<int>(type: "INTEGER", nullable: false),
Title = table.Column<string>(nullable: true) Title = table.Column<string>(type: "TEXT", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -363,12 +396,12 @@ namespace Ombi.Store.Migrations
name: "PlexSeasonsContent", name: "PlexSeasonsContent",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
ParentKey = table.Column<int>(nullable: false), ParentKey = table.Column<int>(type: "INTEGER", nullable: false),
PlexContentId = table.Column<int>(nullable: false), PlexContentId = table.Column<int>(type: "INTEGER", nullable: false),
SeasonKey = table.Column<int>(nullable: false), SeasonKey = table.Column<int>(type: "INTEGER", nullable: false),
SeasonNumber = table.Column<int>(nullable: false) SeasonNumber = table.Column<int>(type: "INTEGER", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -385,18 +418,18 @@ namespace Ombi.Store.Migrations
name: "ChildRequests", name: "ChildRequests",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
Approved = table.Column<bool>(nullable: false), Approved = table.Column<bool>(type: "INTEGER", nullable: false),
Available = table.Column<bool>(nullable: false), Available = table.Column<bool>(type: "INTEGER", nullable: false),
Denied = table.Column<bool>(nullable: true), Denied = table.Column<bool>(type: "INTEGER", nullable: true),
DeniedReason = table.Column<string>(nullable: true), DeniedReason = table.Column<string>(type: "TEXT", nullable: true),
IssueId = table.Column<int>(nullable: true), IssueId = table.Column<int>(type: "INTEGER", nullable: true),
ParentRequestId = table.Column<int>(nullable: false), ParentRequestId = table.Column<int>(type: "INTEGER", nullable: false),
RequestType = table.Column<int>(nullable: false), RequestType = table.Column<int>(type: "INTEGER", nullable: false),
RequestedDate = table.Column<DateTime>(nullable: false), RequestedDate = table.Column<DateTime>(type: "TEXT", nullable: false),
RequestedUserId = table.Column<string>(nullable: true), RequestedUserId = table.Column<string>(type: "TEXT", nullable: true),
Title = table.Column<string>(nullable: true) Title = table.Column<string>(type: "TEXT", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -419,12 +452,12 @@ namespace Ombi.Store.Migrations
name: "MovieIssues", name: "MovieIssues",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
Description = table.Column<string>(nullable: true), Description = table.Column<string>(type: "TEXT", nullable: true),
IssueId = table.Column<int>(nullable: true), IssueId = table.Column<int>(type: "INTEGER", nullable: true),
MovieId = table.Column<int>(nullable: false), MovieId = table.Column<int>(type: "INTEGER", nullable: false),
Subect = table.Column<string>(nullable: true) Subect = table.Column<string>(type: "TEXT", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -444,48 +477,48 @@ namespace Ombi.Store.Migrations
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "TvIssues", name: "SeasonRequests",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
Description = table.Column<string>(nullable: true), ChildRequestId = table.Column<int>(type: "INTEGER", nullable: false),
IssueId = table.Column<int>(nullable: true), SeasonNumber = table.Column<int>(type: "INTEGER", nullable: false)
Subect = table.Column<string>(nullable: true),
TvId = table.Column<int>(nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_TvIssues", x => x.Id); table.PrimaryKey("PK_SeasonRequests", x => x.Id);
table.ForeignKey(
name: "FK_TvIssues_ChildRequests_IssueId",
column: x => x.IssueId,
principalTable: "ChildRequests",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey( table.ForeignKey(
name: "FK_TvIssues_ChildRequests_TvId", name: "FK_SeasonRequests_ChildRequests_ChildRequestId",
column: x => x.TvId, column: x => x.ChildRequestId,
principalTable: "ChildRequests", principalTable: "ChildRequests",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "SeasonRequests", name: "TvIssues",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
ChildRequestId = table.Column<int>(nullable: false), Description = table.Column<string>(type: "TEXT", nullable: true),
SeasonNumber = table.Column<int>(nullable: false) IssueId = table.Column<int>(type: "INTEGER", nullable: true),
Subect = table.Column<string>(type: "TEXT", nullable: true),
TvId = table.Column<int>(type: "INTEGER", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_SeasonRequests", x => x.Id); table.PrimaryKey("PK_TvIssues", x => x.Id);
table.ForeignKey( table.ForeignKey(
name: "FK_SeasonRequests_ChildRequests_ChildRequestId", name: "FK_TvIssues_ChildRequests_IssueId",
column: x => x.ChildRequestId, column: x => x.IssueId,
principalTable: "ChildRequests",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_TvIssues_ChildRequests_TvId",
column: x => x.TvId,
principalTable: "ChildRequests", principalTable: "ChildRequests",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
@ -495,16 +528,16 @@ namespace Ombi.Store.Migrations
name: "EpisodeRequests", name: "EpisodeRequests",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
AirDate = table.Column<DateTime>(nullable: false), AirDate = table.Column<DateTime>(type: "TEXT", nullable: false),
Approved = table.Column<bool>(nullable: false), Approved = table.Column<bool>(type: "INTEGER", nullable: false),
Available = table.Column<bool>(nullable: false), Available = table.Column<bool>(type: "INTEGER", nullable: false),
EpisodeNumber = table.Column<int>(nullable: false), EpisodeNumber = table.Column<int>(type: "INTEGER", nullable: false),
Requested = table.Column<bool>(nullable: false), Requested = table.Column<bool>(type: "INTEGER", nullable: false),
SeasonId = table.Column<int>(nullable: false), SeasonId = table.Column<int>(type: "INTEGER", nullable: false),
Title = table.Column<string>(nullable: true), Title = table.Column<string>(type: "TEXT", nullable: true),
Url = table.Column<string>(nullable: true) Url = table.Column<string>(type: "TEXT", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -517,17 +550,17 @@ namespace Ombi.Store.Migrations
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateIndex(
name: "IX_AspNetRoleClaims_RoleId",
table: "AspNetRoleClaims",
column: "RoleId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "RoleNameIndex", name: "RoleNameIndex",
table: "AspNetRoles", table: "AspNetRoles",
column: "NormalizedName", column: "NormalizedName",
unique: true); unique: true);
migrationBuilder.CreateIndex(
name: "IX_AspNetRoleClaims_RoleId",
table: "AspNetRoleClaims",
column: "RoleId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_AspNetUserClaims_UserId", name: "IX_AspNetUserClaims_UserId",
table: "AspNetUserClaims", table: "AspNetUserClaims",
@ -554,16 +587,6 @@ namespace Ombi.Store.Migrations
column: "NormalizedUserName", column: "NormalizedUserName",
unique: true); unique: true);
migrationBuilder.CreateIndex(
name: "IX_PlexEpisode_GrandparentKey",
table: "PlexEpisode",
column: "GrandparentKey");
migrationBuilder.CreateIndex(
name: "IX_PlexSeasonsContent_PlexContentId",
table: "PlexSeasonsContent",
column: "PlexContentId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_ChildRequests_ParentRequestId", name: "IX_ChildRequests_ParentRequestId",
table: "ChildRequests", table: "ChildRequests",
@ -574,6 +597,16 @@ namespace Ombi.Store.Migrations
table: "ChildRequests", table: "ChildRequests",
column: "RequestedUserId"); column: "RequestedUserId");
migrationBuilder.CreateIndex(
name: "IX_EmbyEpisode_ParentId",
table: "EmbyEpisode",
column: "ParentId");
migrationBuilder.CreateIndex(
name: "IX_EpisodeRequests_SeasonId",
table: "EpisodeRequests",
column: "SeasonId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_MovieIssues_IssueId", name: "IX_MovieIssues_IssueId",
table: "MovieIssues", table: "MovieIssues",
@ -590,14 +623,19 @@ namespace Ombi.Store.Migrations
column: "RequestedUserId"); column: "RequestedUserId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_TvIssues_IssueId", name: "IX_PlexEpisode_GrandparentKey",
table: "TvIssues", table: "PlexEpisode",
column: "IssueId"); column: "GrandparentKey");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_TvIssues_TvId", name: "IX_PlexSeasonsContent_PlexContentId",
table: "TvIssues", table: "PlexSeasonsContent",
column: "TvId"); column: "PlexContentId");
migrationBuilder.CreateIndex(
name: "IX_SeasonRequests_ChildRequestId",
table: "SeasonRequests",
column: "ChildRequestId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Tokens_UserId", name: "IX_Tokens_UserId",
@ -605,18 +643,21 @@ namespace Ombi.Store.Migrations
column: "UserId"); column: "UserId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_EpisodeRequests_SeasonId", name: "IX_TvIssues_IssueId",
table: "EpisodeRequests", table: "TvIssues",
column: "SeasonId"); column: "IssueId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_SeasonRequests_ChildRequestId", name: "IX_TvIssues_TvId",
table: "SeasonRequests", table: "TvIssues",
column: "ChildRequestId"); column: "TvId");
} }
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropTable(
name: "ApplicationConfiguration");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "AspNetRoleClaims"); name: "AspNetRoleClaims");
@ -633,17 +674,20 @@ namespace Ombi.Store.Migrations
name: "AspNetUserTokens"); name: "AspNetUserTokens");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "ApplicationConfiguration"); name: "Audit");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Audit"); name: "EmbyEpisode");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "EmbyContent"); name: "EpisodeRequests");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "GlobalSettings"); name: "GlobalSettings");
migrationBuilder.DropTable(
name: "MovieIssues");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "NotificationTemplates"); name: "NotificationTemplates");
@ -657,28 +701,25 @@ namespace Ombi.Store.Migrations
name: "RadarrCache"); name: "RadarrCache");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "MovieIssues"); name: "Tokens");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "TvIssues"); name: "TvIssues");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Tokens"); name: "AspNetRoles");
migrationBuilder.DropTable(
name: "EpisodeRequests");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "AspNetRoles"); name: "EmbyContent");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "PlexContent"); name: "SeasonRequests");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "MovieRequests"); name: "MovieRequests");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "SeasonRequests"); name: "PlexContent");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "ChildRequests"); name: "ChildRequests");

@ -1,11 +1,14 @@
using System; // <auto-generated />
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using Ombi.Helpers;
using Ombi.Store.Context; using Ombi.Store.Context;
using Ombi.Store.Entities; using Ombi.Store.Entities;
using Ombi.Helpers; using System;
namespace Ombi.Store.Migrations namespace Ombi.Store.Migrations
{ {
@ -14,10 +17,11 @@ namespace Ombi.Store.Migrations
{ {
protected override void BuildModel(ModelBuilder modelBuilder) protected override void BuildModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "1.1.2"); .HasAnnotation("ProductVersion", "2.0.0-rtm-26452");
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{ {
b.Property<string>("Id") b.Property<string>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
@ -40,7 +44,7 @@ namespace Ombi.Store.Migrations
b.ToTable("AspNetRoles"); b.ToTable("AspNetRoles");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
@ -59,7 +63,7 @@ namespace Ombi.Store.Migrations
b.ToTable("AspNetRoleClaims"); b.ToTable("AspNetRoleClaims");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
@ -78,7 +82,7 @@ namespace Ombi.Store.Migrations
b.ToTable("AspNetUserClaims"); b.ToTable("AspNetUserClaims");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{ {
b.Property<string>("LoginProvider"); b.Property<string>("LoginProvider");
@ -96,7 +100,7 @@ namespace Ombi.Store.Migrations
b.ToTable("AspNetUserLogins"); b.ToTable("AspNetUserLogins");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{ {
b.Property<string>("UserId"); b.Property<string>("UserId");
@ -109,7 +113,7 @@ namespace Ombi.Store.Migrations
b.ToTable("AspNetUserRoles"); b.ToTable("AspNetUserRoles");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserToken<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{ {
b.Property<string>("UserId"); b.Property<string>("UserId");
@ -165,7 +169,8 @@ namespace Ombi.Store.Migrations
b.Property<DateTime>("AddedAt"); b.Property<DateTime>("AddedAt");
b.Property<string>("EmbyId"); b.Property<string>("EmbyId")
.IsRequired();
b.Property<string>("ProviderId"); b.Property<string>("ProviderId");
@ -178,6 +183,32 @@ namespace Ombi.Store.Migrations
b.ToTable("EmbyContent"); b.ToTable("EmbyContent");
}); });
modelBuilder.Entity("Ombi.Store.Entities.EmbyEpisode", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("AddedAt");
b.Property<string>("EmbyId");
b.Property<int>("EpisodeNumber");
b.Property<string>("ParentId");
b.Property<string>("ProviderId");
b.Property<int>("SeasonNumber");
b.Property<string>("Title");
b.HasKey("Id");
b.HasIndex("ParentId");
b.ToTable("EmbyEpisode");
});
modelBuilder.Entity("Ombi.Store.Entities.GlobalSettings", b => modelBuilder.Entity("Ombi.Store.Entities.GlobalSettings", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
@ -245,6 +276,8 @@ namespace Ombi.Store.Migrations
b.Property<bool>("PhoneNumberConfirmed"); b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("ProviderUserId");
b.Property<string>("SecurityStamp"); b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled"); b.Property<bool>("TwoFactorEnabled");
@ -554,43 +587,59 @@ namespace Ombi.Store.Migrations
b.ToTable("SeasonRequests"); b.ToTable("SeasonRequests");
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{ {
b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole") b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany("Claims") .WithMany()
.HasForeignKey("RoleId") .HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{ {
b.HasOne("Ombi.Store.Entities.OmbiUser") b.HasOne("Ombi.Store.Entities.OmbiUser")
.WithMany("Claims") .WithMany()
.HasForeignKey("UserId") .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{ {
b.HasOne("Ombi.Store.Entities.OmbiUser") b.HasOne("Ombi.Store.Entities.OmbiUser")
.WithMany("Logins") .WithMany()
.HasForeignKey("UserId") .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{ {
b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole") b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany("Users") .WithMany()
.HasForeignKey("RoleId") .HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
b.HasOne("Ombi.Store.Entities.OmbiUser") b.HasOne("Ombi.Store.Entities.OmbiUser")
.WithMany("Roles") .WithMany()
.HasForeignKey("UserId") .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Ombi.Store.Entities.OmbiUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Ombi.Store.Entities.EmbyEpisode", b =>
{
b.HasOne("Ombi.Store.Entities.EmbyContent", "Series")
.WithMany("Episodes")
.HasForeignKey("ParentId")
.HasPrincipalKey("EmbyId");
});
modelBuilder.Entity("Ombi.Store.Entities.PlexEpisode", b => modelBuilder.Entity("Ombi.Store.Entities.PlexEpisode", b =>
{ {
b.HasOne("Ombi.Store.Entities.PlexContent", "Series") b.HasOne("Ombi.Store.Entities.PlexContent", "Series")
@ -673,6 +722,7 @@ namespace Ombi.Store.Migrations
.HasForeignKey("ChildRequestId") .HasForeignKey("ChildRequestId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
#pragma warning restore 612, 618
} }
} }
} }

@ -1 +0,0 @@
dotnet ef migrations add Inital --context OmbiContext --startup-project ../Ombi/Ombi.csproj

@ -0,0 +1,2 @@
cd ..
dotnet ef migrations add Inital --context OmbiContext --startup-project ../Ombi/Ombi.csproj

@ -17,6 +17,11 @@ include the remember me checkbox
<input type="email" id="inputEmail" class="form-control" formControlName="username" placeholder="Username" autofocus> <input type="email" id="inputEmail" class="form-control" formControlName="username" placeholder="Username" autofocus>
<input type="password" id="inputPassword" class="form-control" formControlName="password" placeholder="Password"> <input type="password" id="inputPassword" class="form-control" formControlName="password" placeholder="Password">
<div class="form-group">
<div class="checkbox">
<input type="checkbox" id="RememberMe" formControlName="rememberMe"> Remember Me
</div>
</div>
<button class="btn btn-success" type="submit">Sign in</button> <button class="btn btn-success" type="submit">Sign in</button>
</form><!-- /form --> </form><!-- /form -->
<a [routerLink]="['/reset']" class="forgot-password col-md-12"> <a [routerLink]="['/reset']" class="forgot-password col-md-12">

@ -24,7 +24,8 @@ export class LoginComponent implements OnInit {
private route: ActivatedRoute) { private route: ActivatedRoute) {
this.form = this.fb.group({ this.form = this.fb.group({
username: ["", [Validators.required]], username: ["", [Validators.required]],
password: ["", [Validators.required]] password: ["", [Validators.required]],
rememberMe: [false]
}); });
this.status.getWizardStatus().subscribe(x => { this.status.getWizardStatus().subscribe(x => {

@ -19,6 +19,7 @@ import { SonarrComponent } from './sonarr/sonarr.component';
import { RadarrComponent } from './radarr/radarr.component'; import { RadarrComponent } from './radarr/radarr.component';
import { LandingPageComponent } from './landingpage/landingpage.component'; import { LandingPageComponent } from './landingpage/landingpage.component';
import { CustomizationComponent } from './customization/customization.component'; import { CustomizationComponent } from './customization/customization.component';
import { UserManagementComponent } from './usermanagement/usermanagement.component';
import { EmailNotificationComponent } from './notifications/emailnotification.component'; import { EmailNotificationComponent } from './notifications/emailnotification.component';
import { DiscordComponent } from './notifications/discord.component'; import { DiscordComponent } from './notifications/discord.component';
import { SlackComponent } from './notifications/slack.component'; import { SlackComponent } from './notifications/slack.component';
@ -46,6 +47,7 @@ const routes: Routes = [
{ path: 'Settings/Pushover', component: PushoverComponent, canActivate: [AuthGuard] }, { path: 'Settings/Pushover', component: PushoverComponent, canActivate: [AuthGuard] },
{ path: 'Settings/Pushbullet', component: PushbulletComponent, canActivate: [AuthGuard] }, { path: 'Settings/Pushbullet', component: PushbulletComponent, canActivate: [AuthGuard] },
{ path: 'Settings/Mattermost', component: MattermostComponent, canActivate: [AuthGuard] }, { path: 'Settings/Mattermost', component: MattermostComponent, canActivate: [AuthGuard] },
{ path: 'Settings/UserManagement', component: UserManagementComponent, canActivate: [AuthGuard] },
]; ];
@NgModule({ @NgModule({
@ -80,7 +82,8 @@ const routes: Routes = [
NotificationTemplate, NotificationTemplate,
PushoverComponent, PushoverComponent,
MattermostComponent, MattermostComponent,
PushbulletComponent PushbulletComponent,
UserManagementComponent,
], ],
exports: [ exports: [
RouterModule RouterModule

@ -1,11 +1,20 @@
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Ombi']">Ombi</a></li> <li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Ombi']">Ombi</a></li>
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Customization']">Customization</a></li>
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/LandingPage']">Landing Page</a></li>
<li class="dropdown" [routerLinkActive]="['active']"> <li class="dropdown" [routerLinkActive]="['active']">
<a class="dropdown-toggle" data-toggle="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown">
Media Server <span class="caret"></span> <i class="fa fa-cogs" aria-hidden="true"></i> Configuration <span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Customization']">Customization</a></li>
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/LandingPage']">Landing Page</a></li>
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/UserManagement']">User Management</a></li>
</ul>
</li>
<li class="dropdown" [routerLinkActive]="['active']">
<a class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-server" aria-hidden="true"></i> Media Server <span class="caret"></span>
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Plex']">Plex</a></li> <li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Plex']">Plex</a></li>
@ -15,7 +24,7 @@
<li class="dropdown" [routerLinkActive]="['active']"> <li class="dropdown" [routerLinkActive]="['active']">
<a class="dropdown-toggle" data-toggle="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown">
TV <span class="caret"></span> <i class="fa fa-television" aria-hidden="true"></i> TV <span class="caret"></span>
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Sonarr']" >Sonarr</a></li> <li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Sonarr']" >Sonarr</a></li>
@ -26,7 +35,7 @@
<li class="dropdown" [routerLinkActive]="['active']"> <li class="dropdown" [routerLinkActive]="['active']">
<a class="dropdown-toggle" data-toggle="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown">
Movies <span class="caret"></span> <i class="fa fa-film" aria-hidden="true"></i> Movies <span class="caret"></span>
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<!--<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/CouchPotato']">CouchPotato</a></li>--> <!--<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/CouchPotato']">CouchPotato</a></li>-->
@ -39,7 +48,7 @@
<li class="dropdown" [routerLinkActive]="['active']"> <li class="dropdown" [routerLinkActive]="['active']">
<a class="dropdown-toggle" data-toggle="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown">
Notifications <span class="caret"></span> <i class="fa fa-bell-o" aria-hidden="true"></i> Notifications <span class="caret"></span>
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Email']">Email</a></li> <li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Email']">Email</a></li>
@ -55,7 +64,7 @@
<li class="dropdown" [routerLinkActive]="['active']"> <li class="dropdown" [routerLinkActive]="['active']">
<a class="dropdown-toggle" data-toggle="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown">
System <span class="caret"></span> <i class="fa fa-tachometer" aria-hidden="true"></i> System <span class="caret"></span>
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Update']">Update (Not available)</a></li> <li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Update']">Update (Not available)</a></li>

@ -0,0 +1,9 @@
import { Component } from '@angular/core';
@Component({
templateUrl: './usermanagement.component.html',
})
export class UserManagementComponent {
}

@ -80,7 +80,7 @@ namespace Ombi.Controllers
var token = new JwtSecurityToken( var token = new JwtSecurityToken(
claims: claims, claims: claims,
expires: DateTime.UtcNow.AddHours(5), expires: model.RememberMe ? DateTime.UtcNow.AddDays(7) : DateTime.UtcNow.AddHours(5),
signingCredentials: creds, signingCredentials: creds,
audience: "Ombi", issuer:"Ombi" audience: "Ombi", issuer:"Ombi"
); );
@ -104,11 +104,11 @@ namespace Ombi.Controllers
/// <summary> /// <summary>
/// Refreshes the token. /// Refreshes the token.
/// </summary> /// </summary>
/// <param name="model">The model.</param> /// <param name="token">The model.</param>
/// <returns></returns> /// <returns></returns>
/// <exception cref="NotImplementedException"></exception> /// <exception cref="NotImplementedException"></exception>
[HttpPost("refresh")] [HttpPost("refresh")]
public async Task<IActionResult> RefreshToken([FromBody] TokenRefresh token) public IActionResult RefreshToken([FromBody] TokenRefresh token)
{ {
// Check if token exists // Check if token exists

@ -12,6 +12,7 @@ namespace Ombi
{ {
public class Program public class Program
{ {
private static string UrlArgs { get; set; }
public static void Main(string[] args) public static void Main(string[] args)
{ {
Console.Title = "Ombi"; Console.Title = "Ombi";
@ -25,7 +26,7 @@ namespace Ombi
host = o.Host; host = o.Host;
}); });
var urlArgs = $"{host}:{port}"; UrlArgs = $"{host}:{port}";
var urlValue = string.Empty; var urlValue = string.Empty;
using (var ctx = new OmbiContext()) using (var ctx = new OmbiContext())
@ -54,7 +55,7 @@ namespace Ombi
} }
if (url != null && !url.Value.Equals(host)) if (url != null && !url.Value.Equals(host))
{ {
url.Value = urlArgs; url.Value = UrlArgs;
ctx.SaveChanges(); ctx.SaveChanges();
urlValue = url.Value; urlValue = url.Value;
} }
@ -69,13 +70,13 @@ namespace Ombi
Console.WriteLine($"We are running on {urlValue}"); Console.WriteLine($"We are running on {urlValue}");
BuildWebHost(args, urlArgs).Run(); BuildWebHost(args).Run();
} }
public static IWebHost BuildWebHost(string[] args, string urlArgs) => public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args) WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>() .UseStartup<Startup>()
.UseUrls(urlArgs) .UseUrls(UrlArgs)
.Build(); .Build();
} }

File diff suppressed because it is too large Load Diff

@ -46,6 +46,7 @@
"ng2-dragula": "1.5.0", "ng2-dragula": "1.5.0",
"ngx-infinite-scroll": "^0.5.1", "ngx-infinite-scroll": "^0.5.1",
"node-sass": "^4.5.3", "node-sass": "^4.5.3",
"npm": "^5.4.1",
"pace-progress": "^1.0.2", "pace-progress": "^1.0.2",
"primeng": "^4.0.3", "primeng": "^4.0.3",
"reflect-metadata": "0.1.10", "reflect-metadata": "0.1.10",

Loading…
Cancel
Save