mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
Settings done for #298
This commit is contained in:
parent
0dd30968d5
commit
66bede34f4
4 changed files with 45 additions and 36 deletions
|
@ -191,7 +191,7 @@ namespace PlexRequests.UI.Modules
|
|||
Post["/slacknotification"] = _ => SaveSlackNotifications();
|
||||
|
||||
Get["/landingpage", true] = async (x,ct) => await LandingPage();
|
||||
Post["/landingpage"] = _ => SaveSlackNotifications();
|
||||
Post["/landingpage", true] = async (x, ct) => await SaveLandingPage();
|
||||
}
|
||||
|
||||
private Negotiator Authentication()
|
||||
|
@ -819,5 +819,21 @@ namespace PlexRequests.UI.Modules
|
|||
|
||||
return View["LandingPage", settings];
|
||||
}
|
||||
|
||||
private async Task<Response> SaveLandingPage()
|
||||
{
|
||||
var settings = this.Bind<LandingPageSettings>();
|
||||
|
||||
if (settings.Enabled && settings.EnabledNoticeTime && string.IsNullOrEmpty(settings.NoticeMessage))
|
||||
{
|
||||
return Response.AsJson(new JsonResponseModel { Result = false, Message = "If you are going to enabled the notice, then we need a message!"});
|
||||
}
|
||||
|
||||
var result = await LandingSettings.SaveSettingsAsync(settings);
|
||||
|
||||
return Response.AsJson(result
|
||||
? new JsonResponseModel { Result = true }
|
||||
: new JsonResponseModel { Result = false, Message = "Could not save to Db Please check the logs"});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -24,6 +24,10 @@
|
|||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Nancy.Responses.Negotiation;
|
||||
|
||||
using PlexRequests.Core;
|
||||
using PlexRequests.Core.SettingModels;
|
||||
|
||||
|
@ -34,8 +38,16 @@ namespace PlexRequests.UI.Modules
|
|||
public LandingPageModule(ISettingsService<PlexRequestSettings> settingsService, ISettingsService<LandingPageSettings> landing) : base("landing", settingsService)
|
||||
{
|
||||
LandingSettings = landing;
|
||||
|
||||
Get["/", true] = async (x, ct) => await Index();
|
||||
}
|
||||
|
||||
private ISettingsService<LandingPageSettings> LandingSettings { get; }
|
||||
|
||||
private async Task<Negotiator> Index()
|
||||
{
|
||||
var model = await LandingSettings.GetSettingsAsync();
|
||||
return View["Index", model];
|
||||
}
|
||||
}
|
||||
}
|
|
@ -352,8 +352,6 @@ namespace PlexRequests.UI.Modules
|
|||
viewTv.Add(viewT);
|
||||
}
|
||||
|
||||
Log.Trace("Returning TV Show results: ");
|
||||
Log.Trace(viewTv.DumpJson());
|
||||
return Response.AsJson(viewTv);
|
||||
}
|
||||
|
||||
|
@ -788,12 +786,6 @@ namespace PlexRequests.UI.Modules
|
|||
|
||||
var img = GetMusicBrainzCoverArt(albumInfo.id);
|
||||
|
||||
Log.Trace("Album Details:");
|
||||
Log.Trace(albumInfo.DumpJson());
|
||||
Log.Trace("CoverArt Details:");
|
||||
Log.Trace(img.DumpJson());
|
||||
|
||||
|
||||
var model = new RequestedModel
|
||||
{
|
||||
Title = albumInfo.title,
|
||||
|
@ -816,9 +808,6 @@ namespace PlexRequests.UI.Modules
|
|||
Log.Debug("We don't require approval OR the user is in the whitelist");
|
||||
var hpSettings = HeadphonesService.GetSettings();
|
||||
|
||||
Log.Trace("Headphone Settings:");
|
||||
Log.Trace(hpSettings.DumpJson());
|
||||
|
||||
if (!hpSettings.Enabled)
|
||||
{
|
||||
await RequestService.AddRequestAsync(model);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue