This commit is contained in:
tidusjar 2016-06-06 14:31:20 +01:00
commit 0dd30968d5
22 changed files with 8276 additions and 252 deletions

View file

@ -55,6 +55,7 @@ using PlexRequests.UI.Helpers;
using PlexRequests.UI.Models;
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Nancy.Json;
using Nancy.Security;
@ -83,6 +84,7 @@ namespace PlexRequests.UI.Modules
private INotificationService NotificationService { get; }
private ICacheProvider Cache { get; }
private ISettingsService<SlackNotificationSettings> SlackSettings { get; }
private ISettingsService<LandingPageSettings> LandingSettings { get; }
private ISlackApi SlackApi { get; }
private static Logger Log = LogManager.GetCurrentClassLogger();
@ -105,7 +107,7 @@ namespace PlexRequests.UI.Modules
ISettingsService<HeadphonesSettings> headphones,
ISettingsService<LogSettings> logs,
ICacheProvider cache, ISettingsService<SlackNotificationSettings> slackSettings,
ISlackApi slackApi) : base("admin", prService)
ISlackApi slackApi, ISettingsService<LandingPageSettings> lp) : base("admin", prService)
{
PrService = prService;
CpService = cpService;
@ -128,6 +130,7 @@ namespace PlexRequests.UI.Modules
Cache = cache;
SlackSettings = slackSettings;
SlackApi = slackApi;
LandingSettings = lp;
this.RequiresClaims(UserClaims.Admin);
@ -186,6 +189,9 @@ namespace PlexRequests.UI.Modules
Get["/slacknotification"] = _ => SlackNotifications();
Post["/slacknotification"] = _ => SaveSlackNotifications();
Get["/landingpage", true] = async (x,ct) => await LandingPage();
Post["/landingpage"] = _ => SaveSlackNotifications();
}
private Negotiator Authentication()
@ -806,5 +812,12 @@ namespace PlexRequests.UI.Modules
? new JsonResponseModel { Result = true, Message = "Successfully Updated the Settings for Slack Notifications!" }
: new JsonResponseModel { Result = false, Message = "Could not update the settings, take a look at the logs." });
}
private async Task<Negotiator> LandingPage()
{
var settings = await LandingSettings.GetSettingsAsync();
return View["LandingPage", settings];
}
}
}

View file

@ -0,0 +1,41 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: LandingPageModule.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using PlexRequests.Core;
using PlexRequests.Core.SettingModels;
namespace PlexRequests.UI.Modules
{
public class LandingPageModule : BaseModule
{
public LandingPageModule(ISettingsService<PlexRequestSettings> settingsService, ISettingsService<LandingPageSettings> landing) : base("landing", settingsService)
{
LandingSettings = landing;
}
private ISettingsService<LandingPageSettings> LandingSettings { get; }
}
}