-
-
-
+
+
diff --git a/src/Ombi/ClientApp/app/landingpage/landingpage.component.ts b/src/Ombi/ClientApp/app/landingpage/landingpage.component.ts
index d17a9384e..d12de8cdd 100644
--- a/src/Ombi/ClientApp/app/landingpage/landingpage.component.ts
+++ b/src/Ombi/ClientApp/app/landingpage/landingpage.component.ts
@@ -4,6 +4,9 @@ import { RequestService } from '../services/request.service';
import { ILandingPageSettings, ICustomizationSettings } from '../interfaces/ISettings';
import { IRequestCountModel } from '../interfaces/IRequestModel';
+import { DomSanitizer } from '@angular/platform-browser';
+import { ImageService } from '../services/image.service';
+
@Component({
templateUrl: './landingpage.component.html',
@@ -11,11 +14,13 @@ import { IRequestCountModel } from '../interfaces/IRequestModel';
})
export class LandingPageComponent implements OnInit {
- constructor(private settingsService: SettingsService, private requestService : RequestService) { }
+ constructor(private settingsService: SettingsService, private requestService: RequestService,
+ private images: ImageService, private sanitizer: DomSanitizer) { }
customizationSettings : ICustomizationSettings;
landingPageSettings: ILandingPageSettings;
requestCount: IRequestCountModel;
+ background: any;
mediaServerStatus: boolean;
@@ -23,7 +28,10 @@ export class LandingPageComponent implements OnInit {
this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x);
this.settingsService.getLandingPage().subscribe(x => this.landingPageSettings = x);
this.requestService.getRequestsCount().subscribe(x => this.requestCount = x);
-
+ this.images.getRandomBackground().subscribe(x => {
+ this.background = this.sanitizer.bypassSecurityTrustStyle('url(' + x.url + ')');
+
+ });
this.mediaServerStatus = true;
}
}
\ No newline at end of file
diff --git a/src/Ombi/ClientApp/app/services/image.service.ts b/src/Ombi/ClientApp/app/services/image.service.ts
new file mode 100644
index 000000000..50c987aee
--- /dev/null
+++ b/src/Ombi/ClientApp/app/services/image.service.ts
@@ -0,0 +1,17 @@
+import { Injectable } from '@angular/core';
+import { Http } from '@angular/http';
+import { Observable } from 'rxjs/Rx';
+
+import { ServiceHelpers } from './service.helpers';
+import { IImages } from '../interfaces/IImages';
+
+@Injectable()
+export class ImageService extends ServiceHelpers {
+ constructor(public http : Http) {
+ super(http, '/api/v1/Images/');
+ }
+
+ getRandomBackground(): Observable
{
+ return this.http.get(`${this.url}background/`, { headers: this.headers }).map(this.extractData);
+ }
+}
\ No newline at end of file
diff --git a/src/Ombi/Controllers/BaseV1ApiController.cs b/src/Ombi/Controllers/BaseV1ApiController.cs
index f6ea39b27..61c01fb2e 100644
--- a/src/Ombi/Controllers/BaseV1ApiController.cs
+++ b/src/Ombi/Controllers/BaseV1ApiController.cs
@@ -3,8 +3,12 @@
namespace Ombi.Controllers
{
[Route(ApiBase)]
- public class BaseV1ApiController : Controller
+ public class ApiV1Attribute : RouteAttribute
{
protected const string ApiBase = "api/v1/[controller]";
+
+ public ApiV1Attribute() : base(ApiBase)
+ {
+ }
}
}
\ No newline at end of file
diff --git a/src/Ombi/Controllers/External/EmbyController.cs b/src/Ombi/Controllers/External/EmbyController.cs
index 6dc919737..48ab27152 100644
--- a/src/Ombi/Controllers/External/EmbyController.cs
+++ b/src/Ombi/Controllers/External/EmbyController.cs
@@ -13,7 +13,8 @@ namespace Ombi.Controllers.External
///
///
[Admin]
- public class EmbyController : BaseV1ApiController
+ [ApiV1]
+ public class EmbyController : Controller
{
///
///
diff --git a/src/Ombi/Controllers/External/PlexController.cs b/src/Ombi/Controllers/External/PlexController.cs
index 744a85550..170df0451 100644
--- a/src/Ombi/Controllers/External/PlexController.cs
+++ b/src/Ombi/Controllers/External/PlexController.cs
@@ -14,7 +14,8 @@ using Ombi.Models.External;
namespace Ombi.Controllers.External
{
[Admin]
- public class PlexController : BaseV1ApiController
+ [ApiV1]
+ public class PlexController : Controller
{
public PlexController(IPlexApi plexApi, ISettingsService plexSettings)
{
diff --git a/src/Ombi/Controllers/External/RadarrController.cs b/src/Ombi/Controllers/External/RadarrController.cs
index ea86cca66..849e6bdb3 100644
--- a/src/Ombi/Controllers/External/RadarrController.cs
+++ b/src/Ombi/Controllers/External/RadarrController.cs
@@ -10,7 +10,8 @@ using Ombi.Settings.Settings.Models.External;
namespace Ombi.Controllers.External
{
[Admin]
- public class RadarrController : BaseV1ApiController
+ [ApiV1]
+ public class RadarrController : Controller
{
public RadarrController(IRadarrApi radarr, ISettingsService settings)
{
diff --git a/src/Ombi/Controllers/External/SonarrController.cs b/src/Ombi/Controllers/External/SonarrController.cs
index ac4bdfab0..6d2043a14 100644
--- a/src/Ombi/Controllers/External/SonarrController.cs
+++ b/src/Ombi/Controllers/External/SonarrController.cs
@@ -11,7 +11,8 @@ using Ombi.Core.Settings.Models.External;
namespace Ombi.Controllers.External
{
[Admin]
- public class SonarrController : BaseV1ApiController
+ [ApiV1]
+ public class SonarrController : Controller
{
public SonarrController(ISonarrApi sonarr, ISettingsService settings)
{
diff --git a/src/Ombi/Controllers/External/TesterController.cs b/src/Ombi/Controllers/External/TesterController.cs
index 17ed01581..39ee39c13 100644
--- a/src/Ombi/Controllers/External/TesterController.cs
+++ b/src/Ombi/Controllers/External/TesterController.cs
@@ -15,7 +15,8 @@ namespace Ombi.Controllers.External
///
///
[Admin]
- public class TesterController : BaseV1ApiController
+ [ApiV1]
+ public class TesterController : Controller
{
///
/// Initializes a new instance of the class.
diff --git a/src/Ombi/Controllers/IdentityController.cs b/src/Ombi/Controllers/IdentityController.cs
index f4a342cf1..8a82d2d19 100644
--- a/src/Ombi/Controllers/IdentityController.cs
+++ b/src/Ombi/Controllers/IdentityController.cs
@@ -34,7 +34,8 @@ namespace Ombi.Controllers
///
///
[PowerUser]
- public class IdentityController : BaseV1ApiController
+ [ApiV1]
+ public class IdentityController : Controller
{
public IdentityController(UserManager user, IMapper mapper, RoleManager rm, IEmailProvider prov,
ISettingsService s,
diff --git a/src/Ombi/Controllers/ImagesController.cs b/src/Ombi/Controllers/ImagesController.cs
new file mode 100644
index 000000000..d0ec27de9
--- /dev/null
+++ b/src/Ombi/Controllers/ImagesController.cs
@@ -0,0 +1,47 @@
+using Microsoft.AspNetCore.Mvc;
+using Ombi.Api.FanartTv;
+using Ombi.Store.Repository;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Ombi.Controllers
+{
+ [ApiV1]
+ public class ImagesController : Controller
+ {
+ public ImagesController(IFanartTvApi api, IApplicationConfigRepository config)
+ {
+ Api = api;
+ Config = config;
+ }
+
+ private IFanartTvApi Api { get; }
+ private IApplicationConfigRepository Config { get; }
+
+ [HttpGet("background")]
+ public async Task