mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 21:03:17 -07:00
parent
1eb18b3187
commit
08b5527891
22 changed files with 166 additions and 93 deletions
|
@ -44,7 +44,11 @@
|
|||
</nav>
|
||||
|
||||
|
||||
<div class="container top-spacing">
|
||||
<div *ngIf="showNav" class="container top-spacing">
|
||||
<router-outlet></router-outlet>
|
||||
</div>
|
||||
<div *ngIf="!showNav">
|
||||
|
||||
<router-outlet></router-outlet>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import { AuthGuard } from './auth/auth.guard';
|
|||
import { AuthModule } from './auth/auth.module';
|
||||
import { IdentityService } from './services/identity.service';
|
||||
import { StatusService } from './services/status.service';
|
||||
import { ImageService } from './services/image.service';
|
||||
|
||||
|
||||
// Modules
|
||||
|
@ -94,6 +95,7 @@ const routes: Routes = [
|
|||
SettingsService,
|
||||
IdentityService,
|
||||
StatusService,
|
||||
ImageService,
|
||||
//DragulaService
|
||||
],
|
||||
bootstrap: [AppComponent]
|
||||
|
|
3
src/Ombi/ClientApp/app/interfaces/IImages.ts
Normal file
3
src/Ombi/ClientApp/app/interfaces/IImages.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
export interface IImages {
|
||||
url: string
|
||||
}
|
|
@ -1,51 +1,35 @@
|
|||
<div *ngIf="landingPageSettings && customizationSettings">
|
||||
<div *ngIf="landingPageSettings && customizationSettings && background">
|
||||
|
||||
<div *ngIf="customizationSettings.logo" class="landing-logo">
|
||||
<img [src]="customizationSettings.logo" />
|
||||
</div>
|
||||
<style>
|
||||
landingDiv {
|
||||
-webkit-background-size: cover;
|
||||
-moz-background-size: cover;
|
||||
-o-background-size: cover;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
<h1>
|
||||
Hey! Welcome back to
|
||||
<span *ngIf="customizationSettings.applicationName">
|
||||
{{customizationSettings.applicationName}}
|
||||
</span>
|
||||
<span *ngIf="!customizationSettings.applicationName">
|
||||
Ombi
|
||||
</span>
|
||||
</h1>
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<h3 *ngIf="landingPageSettings.noticeEnabled" [innerHtml]="landingPageSettings.noticeText" style="background-color: {{landingPageSettings.noticeBackgroundColor}}"></h3>
|
||||
<div class="col-md-3 landing-box" [routerLink]="['/search']">
|
||||
<div>
|
||||
Search
|
||||
</div>
|
||||
</div>
|
||||
img.bg {
|
||||
/* Set rules to fill background */
|
||||
min-height: 100%;
|
||||
min-width: 1024px;
|
||||
/* Set up proportionate scaling */
|
||||
width: 100%;
|
||||
height: auto;
|
||||
/* Set up positioning */
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
<div class="col-md-3 col-md-offset-1 landing-box" [routerLink]="['/requests']">
|
||||
<div>
|
||||
View all your requests
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<div *ngIf="requestCount">
|
||||
Pending Requests: <span>{{requestCount.pending}}</span>
|
||||
<br />
|
||||
Approved Requests: <span>{{requestCount.approved}}</span>
|
||||
<br />
|
||||
Available Requests: <span>{{requestCount.available}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@media screen and (max-width: 1024px) { /* Specific to this particular image */
|
||||
img.bg {
|
||||
left: 50%;
|
||||
margin-left: -512px; /* 50% */
|
||||
}
|
||||
}
|
||||
|
||||
<div class="col-md-3 col-md-offset-1 landing-box">
|
||||
<div>
|
||||
Media Server Status:
|
||||
<span *ngIf="mediaServerStatus"><i class="fa fa-check-circle" style="color: #00c853"></i></span>
|
||||
<span *ngIf="!mediaServerStatus"><i class="fa fa-times-circle" style="color: #d50000"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</style>
|
||||
<img class="landingDiv bg" [style.background-image]="background" />
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
17
src/Ombi/ClientApp/app/services/image.service.ts
Normal file
17
src/Ombi/ClientApp/app/services/image.service.ts
Normal file
|
@ -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<IImages> {
|
||||
return this.http.get(`${this.url}background/`, { headers: this.headers }).map(this.extractData);
|
||||
}
|
||||
}
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,7 +13,8 @@ namespace Ombi.Controllers.External
|
|||
///
|
||||
/// </summary>
|
||||
[Admin]
|
||||
public class EmbyController : BaseV1ApiController
|
||||
[ApiV1]
|
||||
public class EmbyController : Controller
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
|
|
|
@ -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> plexSettings)
|
||||
{
|
||||
|
|
|
@ -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<RadarrSettings> settings)
|
||||
{
|
||||
|
|
|
@ -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<SonarrSettings> settings)
|
||||
{
|
||||
|
|
|
@ -15,7 +15,8 @@ namespace Ombi.Controllers.External
|
|||
/// </summary>
|
||||
/// <seealso cref="Ombi.Controllers.BaseV1ApiController" />
|
||||
[Admin]
|
||||
public class TesterController : BaseV1ApiController
|
||||
[ApiV1]
|
||||
public class TesterController : Controller
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TesterController" /> class.
|
||||
|
|
|
@ -34,7 +34,8 @@ namespace Ombi.Controllers
|
|||
/// </summary>
|
||||
/// <seealso cref="Ombi.Controllers.BaseV1ApiController" />
|
||||
[PowerUser]
|
||||
public class IdentityController : BaseV1ApiController
|
||||
[ApiV1]
|
||||
public class IdentityController : Controller
|
||||
{
|
||||
public IdentityController(UserManager<OmbiUser> user, IMapper mapper, RoleManager<IdentityRole> rm, IEmailProvider prov,
|
||||
ISettingsService<EmailNotificationSettings> s,
|
||||
|
|
47
src/Ombi/Controllers/ImagesController.cs
Normal file
47
src/Ombi/Controllers/ImagesController.cs
Normal file
|
@ -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<object> GetBackgroundImage()
|
||||
{
|
||||
var moviesArray = new[]{
|
||||
278,
|
||||
238,
|
||||
431483,
|
||||
372058,
|
||||
244786,
|
||||
680,
|
||||
155,
|
||||
13,
|
||||
1891,
|
||||
399106
|
||||
};
|
||||
|
||||
var key = await Config.Get(Store.Entities.ConfigurationTypes.FanartTv);
|
||||
|
||||
var result = await Api.GetMovieImages(155, key.Value);
|
||||
|
||||
return new { url = result.moviebackground[0].url };
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,7 +7,8 @@ using System;
|
|||
namespace Ombi.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
public class LoggingController : BaseV1ApiController
|
||||
[ApiV1]
|
||||
public class LoggingController : Controller
|
||||
{
|
||||
public LoggingController(ILogger logger)
|
||||
{
|
||||
|
|
|
@ -12,7 +12,8 @@ using System.Diagnostics;
|
|||
namespace Ombi.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
public class RequestController : BaseV1ApiController
|
||||
[ApiV1]
|
||||
public class RequestController : Controller
|
||||
{
|
||||
public RequestController(IMovieRequestEngine engine, ITvRequestEngine tvRequestEngine)
|
||||
{
|
||||
|
|
|
@ -14,7 +14,8 @@ using StackExchange.Profiling;
|
|||
namespace Ombi.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
public class SearchController : BaseV1ApiController
|
||||
[ApiV1]
|
||||
public class SearchController : Controller
|
||||
{
|
||||
public SearchController(IMovieEngine movie, ITvSearchEngine tvEngine, ILogger<SearchController> logger)
|
||||
{
|
||||
|
|
|
@ -24,7 +24,8 @@ namespace Ombi.Controllers
|
|||
/// </summary>
|
||||
/// <seealso cref="Ombi.Controllers.BaseV1ApiController" />
|
||||
[Admin]
|
||||
public class SettingsController : BaseV1ApiController
|
||||
[ApiV1]
|
||||
public class SettingsController : Controller
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SettingsController" /> class.
|
||||
|
|
|
@ -36,8 +36,8 @@ using Ombi.Settings.Settings.Models;
|
|||
|
||||
namespace Ombi.Controllers
|
||||
{
|
||||
|
||||
public class StatusController : BaseV1ApiController
|
||||
[ApiV1]
|
||||
public class StatusController : Controller
|
||||
{
|
||||
public StatusController(ISettingsService<OmbiSettings> ombi)
|
||||
{
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="6.1.0" />
|
||||
<PackageReference Include="CommandLineParser" Version="2.1.1-beta" />
|
||||
<PackageReference Include="Hangfire.AspNetCore" Version="1.6.14" />
|
||||
<PackageReference Include="Hangfire.MemoryStorage.Core" Version="1.4.0" />
|
||||
<PackageReference Include="Hangfire.RecurringJobExtensions" Version="1.1.6" />
|
||||
|
|
|
@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Hosting;
|
|||
using Microsoft.Extensions.Configuration;
|
||||
using Ombi.Store.Context;
|
||||
using Ombi.Store.Entities;
|
||||
using CommandLine;
|
||||
|
||||
namespace Ombi
|
||||
{
|
||||
|
@ -13,35 +14,18 @@ namespace Ombi
|
|||
public static void Main(string[] args)
|
||||
{
|
||||
Console.Title = "Ombi";
|
||||
var port = 5000;
|
||||
var urlArgs = $"http://*:{port}";
|
||||
if (args.Length <= 0)
|
||||
{
|
||||
Console.WriteLine("No URL provided, we will run on \"http://localhost:5000\"");
|
||||
//Console.WriteLine("Please provider the argument -url e.g. \"ombi.exe -url http://ombi.io:80/\"");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (args[0].Contains("-url"))
|
||||
var options = new Options();
|
||||
int port = 0;
|
||||
string host = string.Empty;
|
||||
Parser.Default.ParseArguments<Options>(args)
|
||||
.WithParsed(o =>
|
||||
{
|
||||
try
|
||||
{
|
||||
urlArgs = args[0].Replace("-url ", string.Empty);
|
||||
var index = urlArgs.IndexOf(':', urlArgs.IndexOf(':') + 1);
|
||||
var portString = urlArgs.Substring(index + 1, urlArgs.Length - index - 1);
|
||||
port = int.Parse(portString);
|
||||
|
||||
urlArgs = urlArgs.Substring(0, urlArgs.Length - portString.Length - 1);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("Port is not defined or correctly formatted");
|
||||
Console.WriteLine(e.Message);
|
||||
Console.ReadLine();
|
||||
Environment.Exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
port = o.Port;
|
||||
host = o.Host;
|
||||
});
|
||||
|
||||
var urlArgs = $"{host}:{port}";
|
||||
|
||||
var urlValue = string.Empty;
|
||||
using (var ctx = new OmbiContext())
|
||||
{
|
||||
|
@ -67,7 +51,7 @@ namespace Ombi
|
|||
urlValue = url.Value;
|
||||
port = int.Parse(dbPort.Value);
|
||||
}
|
||||
else if (!url.Value.Equals(urlArgs))
|
||||
if (url != null && !url.Value.Equals(host))
|
||||
{
|
||||
url.Value = urlArgs;
|
||||
ctx.SaveChanges();
|
||||
|
@ -84,16 +68,25 @@ namespace Ombi
|
|||
|
||||
Console.WriteLine($"We are running on {urlValue}");
|
||||
|
||||
var host = new WebHostBuilder()
|
||||
var webHost = new WebHostBuilder()
|
||||
.UseKestrel()
|
||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||
.UseIISIntegration()
|
||||
.UseUrls($"{urlValue}:{port}")
|
||||
.UseUrls(urlArgs)
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
|
||||
|
||||
host.Run();
|
||||
webHost.Run();
|
||||
}
|
||||
}
|
||||
|
||||
public class Options
|
||||
{
|
||||
[Option('h', "host", Required = false, HelpText = "The Hostname default is http://*", Default ="http://*")]
|
||||
public string Host { get; set; }
|
||||
|
||||
[Option('p', "port", Required = false, HelpText = "The port, default is 5000", Default =5000)]
|
||||
public int Port { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -193,7 +193,7 @@ namespace Ombi
|
|||
app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
|
||||
{
|
||||
#if !DEBUG
|
||||
Authority = $"{url.Value}:{port.Value}",
|
||||
Authority = $"http://localhost:{port.Value}",
|
||||
#else
|
||||
Authority = $"http://localhost:52038/",
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue