mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 13:23:20 -07:00
parent
046211e017
commit
bd27e4ad70
12 changed files with 73 additions and 40 deletions
|
@ -21,7 +21,7 @@ namespace Ombi.Schedule
|
||||||
{
|
{
|
||||||
RecurringJob.AddOrUpdate(() => Cacher.CacheContent(), Cron.Hourly);
|
RecurringJob.AddOrUpdate(() => Cacher.CacheContent(), Cron.Hourly);
|
||||||
RecurringJob.AddOrUpdate(() => RadarrCacher.CacheContent(), Cron.Hourly);
|
RecurringJob.AddOrUpdate(() => RadarrCacher.CacheContent(), Cron.Hourly);
|
||||||
RecurringJob.AddOrUpdate(() => Updater.Update(), Cron.Minutely);
|
RecurringJob.AddOrUpdate(() => Updater.Update(), Cron.Daily);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Ombi.Core.Settings.Models
|
namespace Ombi.Core.Settings.Models
|
||||||
|
@ -6,17 +7,15 @@ namespace Ombi.Core.Settings.Models
|
||||||
public class LandingPageSettings : Ombi.Settings.Settings.Models.Settings
|
public class LandingPageSettings : Ombi.Settings.Settings.Models.Settings
|
||||||
{
|
{
|
||||||
public bool Enabled { get; set; }
|
public bool Enabled { get; set; }
|
||||||
public bool BeforeLogin { get; set; }
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public bool AfterLogin => !BeforeLogin;
|
|
||||||
|
|
||||||
|
[NotMapped]
|
||||||
public bool NoticeEnabled => !string.IsNullOrEmpty(NoticeText);
|
public bool NoticeEnabled => !string.IsNullOrEmpty(NoticeText);
|
||||||
public string NoticeText { get; set; }
|
public string NoticeText { get; set; }
|
||||||
public string NoticeBackgroundColor { get; set; }
|
|
||||||
|
|
||||||
public bool TimeLimit { get; set; }
|
public bool TimeLimit { get; set; }
|
||||||
public DateTime StartDateTime { get; set; }
|
public DateTime StartDateTime { get; set; }
|
||||||
public DateTime EndDateTime { get; set; }
|
public DateTime EndDateTime { get; set; }
|
||||||
|
[NotMapped]
|
||||||
|
public bool Expired => EndDateTime > DateTime.Now;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -47,6 +47,7 @@ const routes: Routes = [
|
||||||
|
|
||||||
//{ path: 'requests-grid', component: RequestGridComponent },
|
//{ path: 'requests-grid', component: RequestGridComponent },
|
||||||
{ path: 'login', component: LoginComponent },
|
{ path: 'login', component: LoginComponent },
|
||||||
|
{ path: 'login/:landing', component: LoginComponent },
|
||||||
{ path: 'reset', component: ResetPasswordComponent },
|
{ path: 'reset', component: ResetPasswordComponent },
|
||||||
{ path: 'token', component: TokenResetPasswordComponent },
|
{ path: 'token', component: TokenResetPasswordComponent },
|
||||||
{ path: 'landingpage', component: LandingPageComponent }
|
{ path: 'landingpage', component: LandingPageComponent }
|
||||||
|
|
|
@ -68,14 +68,14 @@ export interface IRadarrSettings extends IExternalSettings {
|
||||||
|
|
||||||
export interface ILandingPageSettings extends ISettings {
|
export interface ILandingPageSettings extends ISettings {
|
||||||
enabled: boolean,
|
enabled: boolean,
|
||||||
beforeLogin: boolean,
|
|
||||||
afterLogin: boolean,
|
|
||||||
noticeEnabled: boolean,
|
noticeEnabled: boolean,
|
||||||
noticeText: string,
|
noticeText: string,
|
||||||
noticeBackgroundColor: string,
|
|
||||||
timeLimit: boolean,
|
timeLimit: boolean,
|
||||||
startDateTime: Date,
|
startDateTime: Date,
|
||||||
endDateTime: Date,
|
endDateTime: Date,
|
||||||
|
expired:boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ICustomizationSettings extends ISettings {
|
export interface ICustomizationSettings extends ISettings {
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3 col-md-push-4 vcenter">
|
<div class="col-md-3 col-md-push-4 vcenter">
|
||||||
<button [routerLink]="['/search']" class="btn btn-lg btn-success-outline">Contine</button>
|
<button [routerLink]="['/login', 'true']" class="btn btn-lg btn-success-outline">Contine</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
|
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
|
||||||
|
|
||||||
import { AuthService } from '../auth/auth.service';
|
import { AuthService } from '../auth/auth.service';
|
||||||
|
@ -20,7 +20,8 @@ export class LoginComponent implements OnInit {
|
||||||
|
|
||||||
|
|
||||||
constructor(private authService: AuthService, private router: Router, private notify: NotificationService, private status: StatusService,
|
constructor(private authService: AuthService, private router: Router, private notify: NotificationService, private status: StatusService,
|
||||||
private fb: FormBuilder, private settingsService: SettingsService, private images: ImageService, private sanitizer: DomSanitizer) {
|
private fb: FormBuilder, private settingsService: SettingsService, private images: ImageService, private sanitizer: DomSanitizer,
|
||||||
|
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]]
|
||||||
|
@ -31,13 +32,25 @@ export class LoginComponent implements OnInit {
|
||||||
this.router.navigate(['Wizard']);
|
this.router.navigate(['Wizard']);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.route.params
|
||||||
|
.subscribe(params => {
|
||||||
|
this.landingFlag = params['landing'];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
form: FormGroup;
|
form: FormGroup;
|
||||||
customizationSettings : ICustomizationSettings;
|
customizationSettings : ICustomizationSettings;
|
||||||
background: any;
|
background: any;
|
||||||
|
landingFlag: boolean;
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
this.settingsService.getLandingPage().subscribe(x => {
|
||||||
|
debugger;
|
||||||
|
if (x.enabled && !this.landingFlag) {
|
||||||
|
this.router.navigate(['landingpage']);
|
||||||
|
}
|
||||||
|
});
|
||||||
this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x);
|
this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x);
|
||||||
this.images.getRandomBackground().subscribe(x => {
|
this.images.getRandomBackground().subscribe(x => {
|
||||||
this.background = this.sanitizer.bypassSecurityTrustStyle('linear-gradient(-10deg, transparent 20%, rgba(0,0,0,0.7) 20.0%, rgba(0,0,0,0.7) 80.0%, transparent 80%),url(' + x.url + ')');
|
this.background = this.sanitizer.bypassSecurityTrustStyle('linear-gradient(-10deg, transparent 20%, rgba(0,0,0,0.7) 20.0%, rgba(0,0,0,0.7) 80.0%, transparent 80%),url(' + x.url + ')');
|
||||||
|
|
|
@ -12,19 +12,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="checkbox">
|
|
||||||
<input type="checkbox" id="BeforeLogin" name="BeforeLogin" [(ngModel)]="settings.beforeLogin" ng-checked="settings.beforeLogin" tooltipPosition="top" pTooltip="If enabled then this will show the landing page before the login page, if this is disabled the user will log in first and then see the landing page.">
|
|
||||||
<label for="BeforeLogin">Show before the login</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p class="form-group">Notice Message</p>
|
<p class="form-group">Notice Message</p>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div>
|
<div>
|
||||||
<textarea rows="4" type="text" class="form-control-custom form-control " id="NoticeMessage" name="NoticeMessage" placeholder="e.g. The server will be down for maintaince (HTML is allowed)" [(ngModel)]="settings.noticeText" >{{noticeText}}</textarea>
|
<textarea rows="4" type="text" class="form-control-custom form-control " id="NoticeMessage" name="NoticeMessage" placeholder="e.g. The server will be down for maintaince (HTML is allowed)" [(ngModel)]="settings.noticeText">{{noticeText}}</textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -33,6 +24,28 @@
|
||||||
<div [innerHTML]="settings.noticeText"></div>
|
<div [innerHTML]="settings.noticeText"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="checkbox">
|
||||||
|
<input type="checkbox" id="enable" name="enable" [(ngModel)]="settings.timeLimit" ng-checked="settings.timeLimit">
|
||||||
|
<label for="enable">Only show the notification message between the below times</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!--<p class="form-group">Start Time</p>
|
||||||
|
<div class="form-group">
|
||||||
|
<p-calendar [(ngModel)]="settings.startDateTime" [showTime]="true"></p-calendar>
|
||||||
|
</div>
|
||||||
|
<p class="form-group">End Time</p>
|
||||||
|
<div class="form-group">
|
||||||
|
<p-calendar [(ngModel)]="settings.endDateTime" [showTime]="true"></p-calendar>
|
||||||
|
</div>-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div>
|
<div>
|
||||||
<button (click)="save()" type="submit" id="save" class="btn btn-primary-outline">Submit</button>
|
<button (click)="save()" type="submit" id="save" class="btn btn-primary-outline">Submit</button>
|
||||||
|
|
|
@ -15,7 +15,9 @@ export class LandingPageComponent implements OnInit {
|
||||||
settings: ILandingPageSettings;
|
settings: ILandingPageSettings;
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.settingsService.getLandingPage().subscribe(x => this.settings = x);
|
this.settingsService.getLandingPage().subscribe(x => {
|
||||||
|
this.settings = x
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
save() {
|
save() {
|
||||||
|
|
|
@ -26,7 +26,7 @@ import { NotificationTemplate } from './notifications/notificationtemplate.compo
|
||||||
import { SettingsMenuComponent } from './settingsmenu.component';
|
import { SettingsMenuComponent } from './settingsmenu.component';
|
||||||
import { HumanizePipe } from '../pipes/HumanizePipe';
|
import { HumanizePipe } from '../pipes/HumanizePipe';
|
||||||
|
|
||||||
import { MenuModule, InputSwitchModule, InputTextModule, TooltipModule, AutoCompleteModule } from 'primeng/primeng';
|
import { MenuModule, InputSwitchModule, InputTextModule, TooltipModule, AutoCompleteModule, CalendarModule } from 'primeng/primeng';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{ path: 'Settings/Ombi', component: OmbiComponent, canActivate: [AuthGuard] },
|
{ path: 'Settings/Ombi', component: OmbiComponent, canActivate: [AuthGuard] },
|
||||||
|
@ -53,7 +53,8 @@ const routes: Routes = [
|
||||||
NgbModule,
|
NgbModule,
|
||||||
TooltipModule,
|
TooltipModule,
|
||||||
NgbAccordionModule,
|
NgbAccordionModule,
|
||||||
AutoCompleteModule
|
AutoCompleteModule,
|
||||||
|
CalendarModule,
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
SettingsMenuComponent,
|
SettingsMenuComponent,
|
||||||
|
|
|
@ -20,15 +20,17 @@ namespace Ombi.Controllers
|
||||||
public class TokenController
|
public class TokenController
|
||||||
{
|
{
|
||||||
public TokenController(UserManager<OmbiUser> um, IOptions<TokenAuthentication> ta,
|
public TokenController(UserManager<OmbiUser> um, IOptions<TokenAuthentication> ta,
|
||||||
IApplicationConfigRepository config)
|
IApplicationConfigRepository config, IAuditRepository audit)
|
||||||
{
|
{
|
||||||
UserManager = um;
|
UserManager = um;
|
||||||
TokenAuthenticationOptions = ta.Value;
|
TokenAuthenticationOptions = ta.Value;
|
||||||
Config = config;
|
Config = config;
|
||||||
|
Audit = audit;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TokenAuthentication TokenAuthenticationOptions { get; }
|
private TokenAuthentication TokenAuthenticationOptions { get; }
|
||||||
private IApplicationConfigRepository Config { get; }
|
private IApplicationConfigRepository Config { get; }
|
||||||
|
private IAuditRepository Audit { get; }
|
||||||
private UserManager<OmbiUser> UserManager { get; }
|
private UserManager<OmbiUser> UserManager { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -39,6 +41,8 @@ namespace Ombi.Controllers
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<IActionResult> GetToken([FromBody] UserAuthModel model)
|
public async Task<IActionResult> GetToken([FromBody] UserAuthModel model)
|
||||||
{
|
{
|
||||||
|
await Audit.Record(AuditType.None, AuditArea.Authentication,
|
||||||
|
$"Username {model.Username} attempting to authenticate");
|
||||||
|
|
||||||
var user = await UserManager.FindByNameAsync(model.Username);
|
var user = await UserManager.FindByNameAsync(model.Username);
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ namespace Ombi
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
// Note .AddMiniProfiler() returns a IMiniProfilerBuilder for easy intellisense
|
// Note .AddMiniProfiler() returns a IMiniProfilerBuilder for easy intellisense
|
||||||
services.AddMiniProfiler();
|
//services.AddMiniProfiler();
|
||||||
#endif
|
#endif
|
||||||
// Make sure you have memory cache available unless you're using another storage provider
|
// Make sure you have memory cache available unless you're using another storage provider
|
||||||
services.AddMemoryCache();
|
services.AddMemoryCache();
|
||||||
|
@ -245,19 +245,19 @@ namespace Ombi
|
||||||
HotModuleReplacement = true
|
HotModuleReplacement = true
|
||||||
});
|
});
|
||||||
|
|
||||||
app.UseMiniProfiler(new MiniProfilerOptions
|
//app.UseMiniProfiler(new MiniProfilerOptions
|
||||||
{
|
//{
|
||||||
// Path to use for profiler URLs
|
// // Path to use for profiler URLs
|
||||||
RouteBasePath = "~/profiler",
|
// RouteBasePath = "~/profiler",
|
||||||
|
|
||||||
// (Optional) Control which SQL formatter to use
|
// // (Optional) Control which SQL formatter to use
|
||||||
// (default is no formatter)
|
// // (default is no formatter)
|
||||||
SqlFormatter = new StackExchange.Profiling.SqlFormatters.InlineFormatter(),
|
// SqlFormatter = new StackExchange.Profiling.SqlFormatters.InlineFormatter(),
|
||||||
|
|
||||||
// (Optional) Control storage
|
// // (Optional) Control storage
|
||||||
// (default is 30 minutes in MemoryCacheStorage)
|
// // (default is 30 minutes in MemoryCacheStorage)
|
||||||
Storage = new MemoryCacheStorage(cache, TimeSpan.FromMinutes(60)),
|
// Storage = new MemoryCacheStorage(cache, TimeSpan.FromMinutes(60)),
|
||||||
});
|
//});
|
||||||
}
|
}
|
||||||
|
|
||||||
app.UseHangfireServer();
|
app.UseHangfireServer();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
@using Ombi
|
@using Ombi
|
||||||
@addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers"
|
@addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers"
|
||||||
@addTagHelper "*, Microsoft.AspNetCore.SpaServices"
|
@addTagHelper "*, Microsoft.AspNetCore.SpaServices"
|
||||||
@addTagHelper *, MiniProfiler.AspNetCore.Mvc
|
@*@addTagHelper *, MiniProfiler.AspNetCore.Mvc*@
|
Loading…
Add table
Add a link
Reference in a new issue