mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-07 05:31:13 -07:00
moved everything up a directory
This commit is contained in:
parent
448cd8d92e
commit
9a78f790a6
76 changed files with 0 additions and 0 deletions
50
RequestPlex.UI/Modules/AdminModule.cs
Normal file
50
RequestPlex.UI/Modules/AdminModule.cs
Normal file
|
@ -0,0 +1,50 @@
|
|||
using System.Dynamic;
|
||||
|
||||
using Nancy;
|
||||
using Nancy.Extensions;
|
||||
using Nancy.Security;
|
||||
|
||||
using RequestPlex.Core;
|
||||
|
||||
namespace RequestPlex.UI.Modules
|
||||
{
|
||||
public class AdminModule : NancyModule
|
||||
{
|
||||
public AdminModule()
|
||||
{
|
||||
this.RequiresAuthentication();
|
||||
Get["admin/"] = _ =>
|
||||
{
|
||||
dynamic model = new ExpandoObject();
|
||||
model.Errored = Request.Query.error.HasValue;
|
||||
|
||||
var s = new SettingsService();
|
||||
var settings = s.GetSettings();
|
||||
if (settings != null)
|
||||
{
|
||||
model.Port = settings.Port;
|
||||
}
|
||||
|
||||
return View["/Admin/Settings", model];
|
||||
};
|
||||
|
||||
Post["admin/"] = _ =>
|
||||
{
|
||||
var portString = (string)Request.Form.portNumber;
|
||||
int port;
|
||||
|
||||
if (!int.TryParse(portString, out port))
|
||||
{
|
||||
return Context.GetRedirect("~/admin?error=true");
|
||||
}
|
||||
|
||||
var s = new SettingsService();
|
||||
s.SaveSettings(port);
|
||||
|
||||
|
||||
return Context.GetRedirect("~/admin");
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue