コード例 #1
0
ファイル: ApprovalModule.cs プロジェクト: Zirus1701/Ombi
        public ApprovalModule(IRequestService service, ISettingsService <CouchPotatoSettings> cpService, ICouchPotatoApi cpApi, ISonarrApi sonarrApi,
                              ISettingsService <SonarrSettings> sonarrSettings, ISickRageApi srApi, ISettingsService <SickRageSettings> srSettings,
                              ISettingsService <HeadphonesSettings> hpSettings, IHeadphonesApi hpApi, ISettingsService <PlexRequestSettings> pr, ITransientFaultQueue faultQueue
                              , ISecurityExtensions security) : base("approval", pr, security)
        {
            Before += (ctx) => Security.AdminLoginRedirect(ctx, Permissions.Administrator, Permissions.ManageRequests);

            Service            = service;
            CpService          = cpService;
            CpApi              = cpApi;
            SonarrApi          = sonarrApi;
            SonarrSettings     = sonarrSettings;
            SickRageApi        = srApi;
            SickRageSettings   = srSettings;
            HeadphonesSettings = hpSettings;
            HeadphoneApi       = hpApi;
            FaultQueue         = faultQueue;

            Post["/approve", true] = async(x, ct) => await Approve((int)Request.Form.requestid, (string)Request.Form.qualityId);

            Post["/deny", true] = async(x, ct) => await DenyRequest((int)Request.Form.requestid, (string)Request.Form.reason);

            Post["/approveall", true] = async(x, ct) => await ApproveAll();

            Post["/approveallmovies", true] = async(x, ct) => await ApproveAllMovies();

            Post["/approvealltvshows", true] = async(x, ct) => await ApproveAllTVShows();

            Post["/deleteallmovies", true] = async(x, ct) => await DeleteAllMovies();

            Post["/deletealltvshows", true] = async(x, ct) => await DeleteAllTVShows();

            Post["/deleteallalbums", true] = async(x, ct) => await DeleteAllAlbums();
        }
コード例 #2
0
        protected BaseModule(string modulePath, ISettingsService <PlexRequestSettings> settingsService, ISecurityExtensions security)
        {
            var settings = settingsService.GetSettings();
            var baseUrl  = settings.BaseUrl;

            BaseUrl = baseUrl;

            var settingModulePath = string.IsNullOrEmpty(baseUrl) ? modulePath : $"{baseUrl}/{modulePath}";

            ModulePath = settingModulePath;
            Security   = security;

            Before += (ctx) =>
            {
                SetCookie();

                if (!string.IsNullOrEmpty(ctx.Request.Session["TempMessage"] as string))
                {
                    ctx.ViewBag.TempMessage = ctx.Request.Session["TempMessage"];
                    ctx.ViewBag.TempType    = ctx.Request.Session["TempType"];
                    ctx.Request.Session.DeleteAll();
                }
                return(null);
            };
        }
コード例 #3
0
        public UserManagementModule(ISettingsService <PlexRequestSettings> pr, ICustomUserMapper m, IPlexApi plexApi, ISettingsService <PlexSettings> plex, IRepository <UserLogins> userLogins, IPlexUserRepository plexRepo
                                    , ISecurityExtensions security, IRequestService req, IAnalytics ana) : base("usermanagement", pr, security)
        {
#if !DEBUG
            Before += (ctx) => Security.AdminLoginRedirect(Permissions.Administrator, ctx);
#endif
            UserMapper          = m;
            PlexApi             = plexApi;
            PlexSettings        = plex;
            UserLoginsRepo      = userLogins;
            PlexUsersRepository = plexRepo;
            PlexRequestSettings = pr;
            RequestService      = req;
            Analytics           = ana;

            Get["/"] = x => Load();

            Get["/users", true] = async(x, ct) => await LoadUsers();

            Post["/createuser", true] = async(x, ct) => await CreateUser();

            Get["/local/{id}"]      = x => LocalDetails((Guid)x.id);
            Get["/plex/{id}", true] = async(x, ct) => await PlexDetails(x.id);

            Get["/permissions"]       = x => GetEnum <Permissions>();
            Get["/features"]          = x => GetEnum <Features>();
            Post["/updateuser", true] = async(x, ct) => await UpdateUser();

            Post["/deleteuser"] = x => DeleteUser();
        }
コード例 #4
0
ファイル: AboutModule.cs プロジェクト: Zirus1701/Ombi
        public AboutModule(ISettingsService <PlexRequestSettings> settingsService,
                           ISettingsService <SystemSettings> systemService, ISecurityExtensions security,
                           IStatusChecker statusChecker) : base("admin", settingsService, security)
        {
            Before += (ctx) => Security.AdminLoginRedirect(Permissions.Administrator, ctx);

            SettingsService = systemService;
            StatusChecker   = statusChecker;

            Get["/about", true] = async(x, ct) => await Index();

            Post["/about", true] = async(x, ct) => await ReportIssue();
        }
コード例 #5
0
        protected BaseModule(ISettingsService <PlexRequestSettings> settingsService, ISecurityExtensions security)
        {
            var settings = settingsService.GetSettings();
            var baseUrl  = settings.BaseUrl;

            BaseUrl = baseUrl;

            var modulePath = string.IsNullOrEmpty(baseUrl) ? string.Empty : baseUrl;

            ModulePath = modulePath;
            Security   = security;

            Before += (ctx) => SetCookie();
        }
コード例 #6
0
        public RequestsModule(
            IRequestService service,
            ISettingsService <PlexRequestSettings> prSettings,
            ISettingsService <PlexSettings> plex,
            INotificationService notify,
            ISettingsService <SonarrSettings> sonarrSettings,
            ISettingsService <SickRageSettings> sickRageSettings,
            ISettingsService <CouchPotatoSettings> cpSettings,
            ICouchPotatoApi cpApi,
            ISonarrApi sonarrApi,
            ISickRageApi sickRageApi,
            ICacheProvider cache,
            IAnalytics an,
            INotificationEngine engine,
            ISecurityExtensions security) : base("requests", prSettings, security)
        {
            Service             = service;
            PrSettings          = prSettings;
            PlexSettings        = plex;
            NotificationService = notify;
            SonarrSettings      = sonarrSettings;
            SickRageSettings    = sickRageSettings;
            CpSettings          = cpSettings;
            SonarrApi           = sonarrApi;
            SickRageApi         = sickRageApi;
            CpApi              = cpApi;
            Cache              = cache;
            Analytics          = an;
            NotificationEngine = engine;

            Get["/", true] = async(x, ct) => await LoadRequests();

            Get["/movies", true] = async(x, ct) => await GetMovies();

            Get["/tvshows", true] = async(c, ct) => await GetTvShows();

            Get["/albums", true] = async(x, ct) => await GetAlbumRequests();

            Post["/delete", true] = async(x, ct) => await DeleteRequest((int)Request.Form.id);

            Post["/reportissue", true] = async(x, ct) => await ReportIssue((int)Request.Form.requestId, (IssueState)(int)Request.Form.issue, null);

            Post["/reportissuecomment", true] = async(x, ct) => await ReportIssue((int)Request.Form.requestId, IssueState.Other, (string)Request.Form.commentArea);

            Post["/clearissues", true] = async(x, ct) => await ClearIssue((int)Request.Form.Id);

            Post["/changeavailability", true] = async(x, ct) => await ChangeRequestAvailability((int)Request.Form.Id, (bool)Request.Form.Available);
        }
コード例 #7
0
        public ApiUserModule(ISettingsService <PlexRequestSettings> pr, ICustomUserMapper m, ISecurityExtensions security) : base("api", pr, security)
        {
            Put["PutCredentials", "/credentials/{username}"] = x => ChangePassword(x);

            Get["GetApiKey", "/apikey"] = x => GetApiKey();

            SettingsService = pr;
            UserMapper      = m;
        }
コード例 #8
0
 public DonationLinkModule(ICacheProvider provider, ISettingsService <PlexRequestSettings> pr, ISecurityExtensions security) : base("customDonation", pr, security)
 {
     Cache          = provider;
     Get["/", true] = async(x, ct) => await GetCustomDonationUrl(pr);
 }
コード例 #9
0
ファイル: AdminModule.cs プロジェクト: Zirus1701/Ombi
        public AdminModule(ISettingsService <PlexRequestSettings> prService,
                           ISettingsService <CouchPotatoSettings> cpService,
                           ISettingsService <AuthenticationSettings> auth,
                           ISettingsService <PlexSettings> plex,
                           ISettingsService <SonarrSettings> sonarr,
                           ISettingsService <SickRageSettings> sickrage,
                           ISonarrApi sonarrApi,
                           ISettingsService <EmailNotificationSettings> email,
                           IPlexApi plexApi,
                           ISettingsService <PushbulletNotificationSettings> pbSettings,
                           PushbulletApi pbApi,
                           ICouchPotatoApi cpApi,
                           ISettingsService <PushoverNotificationSettings> pushoverSettings,
                           ISettingsService <NewletterSettings> newsletter,
                           IPushoverApi pushoverApi,
                           IRepository <LogEntity> logsRepo,
                           INotificationService notify,
                           ISettingsService <HeadphonesSettings> headphones,
                           ISettingsService <LogSettings> logs,
                           ICacheProvider cache, ISettingsService <SlackNotificationSettings> slackSettings,
                           ISlackApi slackApi, ISettingsService <LandingPageSettings> lp,
                           ISettingsService <ScheduledJobsSettings> scheduler, IJobRecord rec, IAnalytics analytics,
                           ISettingsService <NotificationSettingsV2> notifyService, IRecentlyAdded recentlyAdded
                           , ISecurityExtensions security) : base("admin", prService, security)
        {
            PrService            = prService;
            CpService            = cpService;
            AuthService          = auth;
            PlexService          = plex;
            SonarrService        = sonarr;
            SonarrApi            = sonarrApi;
            EmailService         = email;
            PlexApi              = plexApi;
            PushbulletService    = pbSettings;
            PushbulletApi        = pbApi;
            CpApi                = cpApi;
            SickRageService      = sickrage;
            LogsRepo             = logsRepo;
            PushoverService      = pushoverSettings;
            PushoverApi          = pushoverApi;
            NotificationService  = notify;
            HeadphonesService    = headphones;
            NewsLetterService    = newsletter;
            LogService           = logs;
            Cache                = cache;
            SlackSettings        = slackSettings;
            SlackApi             = slackApi;
            LandingSettings      = lp;
            ScheduledJobSettings = scheduler;
            JobRecorder          = rec;
            Analytics            = analytics;
            NotifySettings       = notifyService;
            RecentlyAdded        = recentlyAdded;

            Before += (ctx) => Security.AdminLoginRedirect(Permissions.Administrator, ctx);

            Get["/"] = _ => Admin();

            Get["/authentication", true] = async(x, ct) => await Authentication();

            Post["/authentication", true] = async(x, ct) => await SaveAuthentication();

            Post["/", true] = async(x, ct) => await SaveAdmin();

            Post["/requestauth"] = _ => RequestAuthToken();

            Get["/getusers"] = _ => GetUsers();

            Get["/couchpotato"]  = _ => CouchPotato();
            Post["/couchpotato"] = _ => SaveCouchPotato();

            Get["/plex"]        = _ => Plex();
            Post["/plex", true] = async(x, ct) => await SavePlex();

            Get["/sonarr"]  = _ => Sonarr();
            Post["/sonarr"] = _ => SaveSonarr();

            Get["/sickrage"]  = _ => Sickrage();
            Post["/sickrage"] = _ => SaveSickrage();

            Post["/sonarrprofiles"]   = _ => GetSonarrQualityProfiles();
            Post["/cpprofiles", true] = async(x, ct) => await GetCpProfiles();

            Post["/cpapikey"] = x => GetCpApiKey();

            Get["/emailnotification"]            = _ => EmailNotifications();
            Post["/emailnotification"]           = _ => SaveEmailNotifications();
            Post["/testemailnotification", true] = async(x, ct) => await TestEmailNotifications();

            Get["/pushbulletnotification"]            = _ => PushbulletNotifications();
            Post["/pushbulletnotification"]           = _ => SavePushbulletNotifications();
            Post["/testpushbulletnotification", true] = async(x, ct) => await TestPushbulletNotifications();

            Get["/pushovernotification"]            = _ => PushoverNotifications();
            Post["/pushovernotification"]           = _ => SavePushoverNotifications();
            Post["/testpushovernotification", true] = async(x, ct) => await TestPushoverNotifications();

            Get["/logs"]      = _ => Logs();
            Get["/loglevel"]  = _ => GetLogLevels();
            Post["/loglevel"] = _ => UpdateLogLevels(Request.Form.level);
            Get["/loadlogs"]  = _ => LoadLogs();

            Get["/headphones"]  = _ => Headphones();
            Post["/headphones"] = _ => SaveHeadphones();

            Get["/newsletter"]  = _ => Newsletter();
            Post["/newsletter"] = _ => SaveNewsletter();

            Post["/createapikey"] = x => CreateApiKey();



            Post["/testslacknotification", true] = async(x, ct) => await TestSlackNotification();

            Get["/slacknotification"]  = _ => SlackNotifications();
            Post["/slacknotification"] = _ => SaveSlackNotifications();

            Get["/landingpage", true] = async(x, ct) => await LandingPage();

            Post["/landingpage", true] = async(x, ct) => await SaveLandingPage();

            Get["/scheduledjobs", true] = async(x, ct) => await GetScheduledJobs();

            Post["/scheduledjobs", true] = async(x, ct) => await SaveScheduledJobs();

            Post["/clearlogs", true] = async(x, ct) => await ClearLogs();

            Get["/notificationsettings", true] = async(x, ct) => await NotificationSettings();

            Post["/notificationsettings"] = x => SaveNotificationSettings();

            Post["/recentlyAddedTest"] = x => RecentlyAddedTest();
        }
コード例 #10
0
ファイル: UserLoginModule.cs プロジェクト: Zirus1701/Ombi
        public UserLoginModule(ISettingsService <AuthenticationSettings> auth, IPlexApi api, ISettingsService <PlexSettings> plexSettings, ISettingsService <PlexRequestSettings> pr,
                               ISettingsService <LandingPageSettings> lp, IAnalytics a, IResourceLinker linker, IRepository <UserLogins> userLogins, IPlexUserRepository plexUsers, ICustomUserMapper custom,
                               ISecurityExtensions security, ISettingsService <UserManagementSettings> userManagementSettings)
            : base("userlogin", pr, security)
        {
            AuthService         = auth;
            LandingPageSettings = lp;
            Analytics           = a;
            Api                    = api;
            PlexSettings           = plexSettings;
            Linker                 = linker;
            UserLogins             = userLogins;
            PlexUserRepository     = plexUsers;
            CustomUserMapper       = custom;
            UserManagementSettings = userManagementSettings;

            Get["UserLoginIndex", "/", true] = async(x, ct) =>
            {
                if (Request.Query["landing"] == null)
                {
                    var s = await LandingPageSettings.GetSettingsAsync();

                    if (s.Enabled)
                    {
                        if (s.BeforeLogin) // Before login
                        {
                            if (string.IsNullOrEmpty(Username))
                            {
                                // They are not logged in
                                return
                                    (Context.GetRedirect(Linker.BuildRelativeUri(Context, "LandingPageIndex").ToString()));
                            }
                            return(Context.GetRedirect(Linker.BuildRelativeUri(Context, "SearchIndex").ToString()));
                        }

                        // After login
                        if (string.IsNullOrEmpty(Username))
                        {
                            // Not logged in yet
                            return(Context.GetRedirect(Linker.BuildRelativeUri(Context, "UserLoginIndex").ToString() + "?landing"));
                        }
                        // Send them to landing
                        var landingUrl = Linker.BuildRelativeUri(Context, "LandingPageIndex").ToString();
                        return(Context.GetRedirect(landingUrl));
                    }
                }

                if (!string.IsNullOrEmpty(Username) || IsAdmin)
                {
                    var url = Linker.BuildRelativeUri(Context, "SearchIndex").ToString();
                    return(Response.AsRedirect(url));
                }
                var settings = await AuthService.GetSettingsAsync();

                return(View["Index", settings]);
            };

            Post["/", true] = async(x, ct) => await LoginUser();

            Get["/logout"] = x => Logout();
        }
コード例 #11
0
ファイル: BaseAuthModule.cs プロジェクト: Zirus1701/Ombi
 protected BaseAuthModule(string modulePath, ISettingsService <PlexRequestSettings> pr, ISecurityExtensions security) : base(modulePath, pr, security)
 {
     PlexRequestSettings = pr;
     Before += (ctx) => CheckAuth();
 }
コード例 #12
0
        public ApiRequestModule(IRequestService service, ISettingsService <PlexRequestSettings> pr, ISecurityExtensions security) : base("api", pr, security)
        {
            Get["GetRequests", "/requests"]            = x => GetRequests();
            Get["GetRequest", "/requests/{id}"]        = x => GetSingleRequests(x);
            Post["PostRequests", "/requests"]          = x => CreateRequest();
            Put["PutRequests", "/requests"]            = x => UpdateRequest();
            Delete["DeleteRequests", "/requests/{id}"] = x => DeleteRequest(x);


            RequestService  = service;
            SettingsService = pr;
        }
コード例 #13
0
        public IssuesModule(ISettingsService <PlexRequestSettings> pr, IIssueService issueService, IRequestService request, INotificationService n, ISecurityExtensions security) : base("issues", pr, security)
        {
            IssuesService       = issueService;
            RequestService      = request;
            NotificationService = n;

            Get["/"] = x => Index();

            Get["/{id}", true] = async(x, ct) => await Details(x.id);

            Post["/issue", true] = async(x, ct) => await ReportRequestIssue((int)Request.Form.requestId, (IssueState)(int)Request.Form.issue, null);

            Get["/pending", true] = async(x, ct) => await GetIssues(IssueStatus.PendingIssue);

            Get["/resolved", true] = async(x, ct) => await GetIssues(IssueStatus.ResolvedIssue);

            Post["/remove", true] = async(x, ct) => await RemoveIssue((int)Request.Form.issueId);

            Post["/resolvedUpdate", true] = async(x, ct) => await ChangeStatus((int)Request.Form.issueId, IssueStatus.ResolvedIssue);

            Post["/clear", true] = async(x, ct) => await ClearIssue((int)Request.Form.issueId, (IssueState)(int)Request.Form.issue);

            Get["/issuecount", true] = async(x, ct) => await IssueCount();

            Get["/tabCount", true] = async(x, ct) => await TabCount();

            Post["/issuecomment", true] = async(x, ct) => await ReportRequestIssue((int)Request.Form.providerId, IssueState.Other, (string)Request.Form.commentArea);

            Post["/nonrequestissue", true] = async(x, ct) => await ReportNonRequestIssue((int)Request.Form.providerId, (string)Request.Form.type, (IssueState)(int)Request.Form.issue, null);

            Post["/nonrequestissuecomment", true] = async(x, ct) => await ReportNonRequestIssue((int)Request.Form.providerId, (string)Request.Form.type, IssueState.Other, (string)Request.Form.commentArea);


            Post["/addnote", true] = async(x, ct) => await AddNote((int)Request.Form.requestId, (string)Request.Form.noteArea, (IssueState)(int)Request.Form.issue);
        }
コード例 #14
0
ファイル: IndexModule.cs プロジェクト: Zirus1701/Ombi
        public IndexModule(ISettingsService <PlexRequestSettings> pr, ISettingsService <LandingPageSettings> l, IResourceLinker rl, ISecurityExtensions security) : base(pr, security)
        {
            LandingPage             = l;
            Linker                  = rl;
            Get["Index", "/", true] = async(x, ct) => await Index();

            Get["/Index", true] = async(x, ct) => await Index();
        }
コード例 #15
0
        public ApplicationTesterModule(ICouchPotatoApi cpApi, ISonarrApi sonarrApi, IPlexApi plexApi,
                                       ISickRageApi srApi, IHeadphonesApi hpApi, ISettingsService <PlexRequestSettings> pr, ISecurityExtensions security) : base("test", pr, security)
        {
            this.RequiresAuthentication();

            CpApi         = cpApi;
            SonarrApi     = sonarrApi;
            PlexApi       = plexApi;
            SickRageApi   = srApi;
            HeadphonesApi = hpApi;

            Post["/cp"]         = _ => CouchPotatoTest();
            Post["/sonarr"]     = _ => SonarrTest();
            Post["/plex"]       = _ => PlexTest();
            Post["/sickrage"]   = _ => SickRageTest();
            Post["/headphones"] = _ => HeadphonesTest();
            Post["/plexdb"]     = _ => TestPlexDb();
        }
コード例 #16
0
        public LoginModule(ISettingsService <PlexRequestSettings> pr, ICustomUserMapper m, IResourceLinker linker, IRepository <UserLogins> userLoginRepo, ISecurityExtensions security)
            : base(pr, security)
        {
            UserMapper = m;
            Get["LocalLogin", "/login"] = _ =>
            {
                if (LoggedIn)
                {
                    var url = linker.BuildRelativeUri(Context, "SearchIndex");
                    return(Response.AsRedirect(url.ToString()));
                }
                dynamic model = new ExpandoObject();
                model.Redirect = Request.Query.redirect.Value ?? string.Empty;
                model.Errored  = Request.Query.error.HasValue;
                var adminCreated = UserMapper.DoUsersExist();
                model.AdminExists = adminCreated;
                return(View["Index", model]);
            };

            Get["/logout"] = x =>
            {
                if (Session[SessionKeys.UsernameKey] != null)
                {
                    Session.Delete(SessionKeys.UsernameKey);
                }
                return(CustomModuleExtensions.LogoutAndRedirect(this, !string.IsNullOrEmpty(BaseUrl) ? $"~/{BaseUrl}/" : "~/"));
            };

            Post["/login"] = x =>
            {
                var username = (string)Request.Form.Username;
                var password = (string)Request.Form.Password;
                var dtOffset = (int)Request.Form.DateTimeOffset;
                var redirect = (string)Request.Form.Redirect;

                var userId = UserMapper.ValidateUser(username, password);

                if (userId == null)
                {
                    return
                        (Context.GetRedirect(!string.IsNullOrEmpty(BaseUrl)
                            ? $"~/{BaseUrl}/login?error=true&username="******"~/login?error=true&username="******"userlogin"))
                {
                    redirect = !string.IsNullOrEmpty(BaseUrl) ? $"/{BaseUrl}/search" : "/search";
                }

                userLoginRepo.Insert(new UserLogins
                {
                    LastLoggedIn = DateTime.UtcNow,
                    Type         = UserType.LocalUser,
                    UserId       = userId.ToString()
                });

                return(CustomModuleExtensions.LoginAndRedirect(this, userId.Value, expiry, redirect));
            };

            Get["/register"] = x =>
            {
                {
                    dynamic model = new ExpandoObject();
                    model.Errored = Request.Query.error.HasValue;

                    return(View["Register", model]);
                }
            };

            Post["/register"] = x =>
            {
                var username = (string)Request.Form.Username;
                var exists   = UserMapper.DoUsersExist();
                if (exists)
                {
                    return
                        (Context.GetRedirect(!string.IsNullOrEmpty(BaseUrl)
                            ? $"~/{BaseUrl}/register?error=true"
                            : "~/register?error=true"));
                }
                var userId = UserMapper.CreateUser(username, Request.Form.Password, EnumHelper <Permissions> .All(), 0);
                Session[SessionKeys.UsernameKey] = username;
                return(CustomModuleExtensions.LoginAndRedirect(this, (Guid)userId));
            };

            Get["/changepassword"]  = _ => ChangePassword();
            Post["/changepassword"] = _ => ChangePasswordPost();
        }
コード例 #17
0
ファイル: UserWizardModule.cs プロジェクト: Zirus1701/Ombi
        public UserWizardModule(ISettingsService <PlexRequestSettings> pr, ISettingsService <PlexSettings> plex, IPlexApi plexApi,
                                ISettingsService <AuthenticationSettings> auth, ICustomUserMapper m, IAnalytics a, ISecurityExtensions security) : base("wizard", pr, security)
        {
            PlexSettings        = plex;
            PlexApi             = plexApi;
            PlexRequestSettings = pr;
            Auth      = auth;
            Mapper    = m;
            Analytics = a;

            Get["/", true] = async(x, ct) =>
            {
                a.TrackEventAsync(Category.Wizard, Action.Start, "Started the wizard", Username, CookieHelper.GetAnalyticClientId(Cookies));

                var settings = await PlexRequestSettings.GetSettingsAsync();

                if (settings.Wizard)
                {
                    return(Context.GetRedirect("~/search"));
                }
                return(View["Index"]);
            };
            Post["/plexAuth"]   = x => PlexAuth();
            Post["/plex", true] = async(x, ct) => await Plex();

            Post["/plexrequest", true] = async(x, ct) => await PlexRequest();

            Post["/auth", true] = async(x, ct) => await Authentication();

            Post["/createuser", true] = async(x, ct) => await CreateUser();
        }
コード例 #18
0
        public LandingPageModule(ISettingsService <PlexRequestSettings> settingsService, ISettingsService <LandingPageSettings> landing,
                                 ISettingsService <PlexSettings> ps, IPlexApi pApi, IResourceLinker linker, ISecurityExtensions security) : base("landing", settingsService, security)
        {
            LandingSettings = landing;
            PlexSettings    = ps;
            PlexApi         = pApi;
            Linker          = linker;

            Get["LandingPageIndex", "/", true] = async(x, ct) =>
            {
                var s = await LandingSettings.GetSettingsAsync();

                if (!s.BeforeLogin && string.IsNullOrEmpty(Username)) //We are signed in
                {
                    var url = Linker.BuildRelativeUri(Context, "SearchIndex").ToString();
                    return(Response.AsRedirect(url));
                }

                var model = new LandingPageViewModel
                {
                    Enabled           = s.Enabled,
                    Id                = s.Id,
                    EnabledNoticeTime = s.EnabledNoticeTime,
                    NoticeEnable      = s.NoticeEnable,
                    NoticeEnd         = s.NoticeEnd,
                    NoticeMessage     = s.NoticeMessage,
                    NoticeStart       = s.NoticeStart,
                    ContinueUrl       = s.BeforeLogin ? $"userlogin" : $"search"
                };
                return(View["Landing/Index", model]);
            };
            Get["/status", true] = async(x, ct) => await CheckStatus();
        }
コード例 #19
0
ファイル: CustomizationModule.cs プロジェクト: Zirus1701/Ombi
        public CustomizationModule(ISettingsService <PlexRequestSettings> settingsService, ISettingsService <CustomizationSettings> cust, ISecurityExtensions security) : base("admin", settingsService, security)
        {
            Before += (ctx) => Security.AdminLoginRedirect(Permissions.Administrator, ctx);

            Settings = cust;

            Get["/customization", true] = async(x, ct) => await Index();

            Post["/customization", true] = async(x, ct) => await Save();
        }
コード例 #20
0
ファイル: ApiDocsModule.cs プロジェクト: Zirus1701/Ombi
 public ApiDocsModule(ISettingsService <PlexRequestSettings> pr, ISecurityExtensions security) : base("apidocs", pr, security)
 {
     Get["/"] = x => Documentation();
 }
コード例 #21
0
ファイル: CultureModule.cs プロジェクト: Zirus1701/Ombi
        public CultureModule(ISettingsService <PlexRequestSettings> pr, IAnalytics a, ISecurityExtensions security) : base("culture", pr, security)
        {
            Analytics = a;

            Get["/"] = x => SetCulture();
        }
コード例 #22
0
 protected BaseApiModule(string modulePath, ISettingsService <PlexRequestSettings> s, ISecurityExtensions security) : base(modulePath, s, security)
 {
     Settings = s;
     Before  += (ctx) => CheckAuth();
 }
コード例 #23
0
        public SystemStatusModule(ISettingsService <PlexRequestSettings> settingsService, ICacheProvider cache, ISettingsService <SystemSettings> ss, ISecurityExtensions security, IAnalytics a) : base("admin", settingsService, security)
        {
            Cache          = cache;
            SystemSettings = ss;
            Analytics      = a;

            Before += (ctx) => Security.AdminLoginRedirect(Permissions.Administrator, ctx);

            Get["/status", true] = async(x, ct) => await Status();

            Post["/save", true] = async(x, ct) => await Save();

            Post["/autoupdate"] = x => AutoUpdate();
        }
コード例 #24
0
        public LayoutModule(ICacheProvider provider, ISettingsService <PlexRequestSettings> pr, ISettingsService <SystemSettings> settings, IJobRecord rec, ISecurityExtensions security) : base("layout", pr, security)
        {
            Cache          = provider;
            SystemSettings = settings;
            Job            = rec;

            Get["/", true] = async(x, ct) => await CheckLatestVersion();

            Get["/cacher", true] = async(x, ct) => await CacherRunning();
        }
コード例 #25
0
        public UserManagementSettingsModule(ISettingsService <PlexRequestSettings> settingsService, ISettingsService <UserManagementSettings> umSettings, ISecurityExtensions security) : base("admin", settingsService, security)
        {
            UserManagementSettings = umSettings;

            Before += (ctx) => Security.AdminLoginRedirect(Permissions.Administrator, ctx);

            Get["UserManagementSettings", "/usermanagementsettings", true] = async(x, ct) => await Index();

            Post["/usermanagementsettings", true] = async(x, ct) => await Update();
        }
コード例 #26
0
ファイル: FaultQueueModule.cs プロジェクト: Zirus1701/Ombi
        public FaultQueueModule(ISettingsService <PlexRequestSettings> settingsService, IRepository <RequestQueue> requestQueue, ISecurityExtensions security) : base("admin", settingsService, security)
        {
            RequestQueue = requestQueue;

            Before += (ctx) => Security.AdminLoginRedirect(Permissions.Administrator, ctx);

            Get["Index", "/faultqueue"] = x => Index();
        }
コード例 #27
0
        public ApiSettingsModule(ISettingsService <PlexRequestSettings> pr, ISettingsService <AuthenticationSettings> auth,
                                 ISettingsService <PlexSettings> plexSettings, ISettingsService <CouchPotatoSettings> cp,
                                 ISettingsService <SonarrSettings> sonarr, ISettingsService <SickRageSettings> sr, ISettingsService <HeadphonesSettings> hp, ISecurityExtensions security) : base("api", pr, security)
        {
            Get["GetVersion", "/version"] = x => GetVersion();


            Get["GetAuthSettings", "/settings/authentication"]   = x => GetAuthSettings();
            Post["PostAuthSettings", "/settings/authentication"] = x => PostAuthSettings();

            Get["GetPlexRequestSettings", "/settings/plexrequest"]   = x => GetPrSettings();
            Post["PostPlexRequestSettings", "/settings/plexrequest"] = x => PostPrSettings();

            Get["GetPlexSettings", "/settings/plex"]   = x => GetPlexSettings();
            Post["PostPlexSettings", "/settings/plex"] = x => PostPlexSettings();

            Get["GetCouchPotatoSettings", "/settings/couchpotato"]   = x => GetCpSettings();
            Post["PostCouchPotatoSettings", "/settings/couchpotato"] = x => PostCpSettings();

            Get["GetSonarrSettings", "/settings/sonarr"]   = x => GetSonarrSettings();
            Post["PostSonarrSettings", "/settings/sonarr"] = x => PostSonarrSettings();

            Get["GetSickRageSettings", "/settings/sickrage"]   = x => GetSickRageSettings();
            Post["PostSickRageSettings", "/settings/sickrage"] = x => PostSickRageSettings();

            Get["GetHeadphonesSettings", "/settings/headphones"]   = x => GetHeadphonesSettings();
            Post["PostHeadphonesSettings", "/settings/headphones"] = x => PostHeadphonesSettings();

            SettingsService    = pr;
            AuthSettings       = auth;
            PlexSettings       = plexSettings;
            CpSettings         = cp;
            SonarrSettings     = sonarr;
            SickRageSettings   = sr;
            HeadphonesSettings = hp;
        }