diff --git a/Ombi.UI/Content/base.css b/Ombi.UI/Content/base.css index 987834924..2b67cfa3e 100644 --- a/Ombi.UI/Content/base.css +++ b/Ombi.UI/Content/base.css @@ -517,3 +517,11 @@ label { background-color: #3e3e3e; border: 1px solid transparent; } +.wizard-heading { + text-align: center; } + +.wizard-img { + width: 300px; + display: block !important; + margin: 0 auto !important; } + diff --git a/Ombi.UI/Content/base.min.css b/Ombi.UI/Content/base.min.css index 4ac0fc57e..164bdc9a5 100644 --- a/Ombi.UI/Content/base.min.css +++ b/Ombi.UI/Content/base.min.css @@ -1 +1 @@ -@media(min-width:768px){.row{position:relative;}.bottom-align-text{position:absolute;bottom:0;right:0;}.landing-block .media{max-width:450px;}}@media(max-width:48em){.home{padding-top:1rem;}}@media(min-width:48em){.home{padding-top:4rem;}}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{color:#fff;}hr{border:1px dashed #777;}.btn{border-radius:.25rem !important;}.btn-group-separated .btn,.btn-group-separated .btn+.btn{margin-left:3px;}.multiSelect{background-color:#4e5d6c;}.form-control-custom{background-color:#4e5d6c !important;color:#fff !important;border-radius:0;box-shadow:0 0 0 !important;}h1{font-size:3.5rem !important;font-weight:600 !important;}.request-title{margin-top:0 !important;font-size:1.9rem !important;}p{font-size:1.1rem !important;}label{display:inline-block !important;margin-bottom:.5rem !important;font-size:16px !important;}.small-label{display:inline-block !important;margin-bottom:.5rem !important;font-size:11px !important;}.small-checkbox{min-height:0 !important;}.round-checkbox{border-radius:8px;}.nav-tabs>li{font-size:13px;line-height:21px;}.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active>a:focus{background:#4e5d6c;}.nav-tabs>li>a>.fa{padding:3px 5px 3px 3px;}.nav-tabs>li.nav-tab-right{float:right;}.nav-tabs>li.nav-tab-right a{margin-right:0;margin-left:2px;}.nav-tabs>li.nav-tab-icononly .fa{padding:3px;}.navbar .nav a .fa,.dropdown-menu a .fa{font-size:130%;top:1px;position:relative;display:inline-block;margin-right:5px;}.dropdown-menu a .fa{top:2px;}.btn-danger-outline{color:#d9534f !important;background-color:transparent;background-image:none;border-color:#d9534f !important;}.btn-danger-outline:focus,.btn-danger-outline.focus,.btn-danger-outline:active,.btn-danger-outline.active,.btn-danger-outline:hover,.open>.btn-danger-outline.dropdown-toggle{color:#fff !important;background-color:#d9534f !important;border-color:#d9534f !important;}.btn-primary-outline{color:#ff761b !important;background-color:transparent;background-image:none;border-color:#ff761b !important;}.btn-primary-outline:focus,.btn-primary-outline.focus,.btn-primary-outline:active,.btn-primary-outline.active,.btn-primary-outline:hover,.open>.btn-primary-outline.dropdown-toggle{color:#fff !important;background-color:#df691a !important;border-color:#df691a !important;}.btn-info-outline{color:#5bc0de !important;background-color:transparent;background-image:none;border-color:#5bc0de !important;}.btn-info-outline:focus,.btn-info-outline.focus,.btn-info-outline:active,.btn-info-outline.active,.btn-info-outline:hover,.open>.btn-info-outline.dropdown-toggle{color:#fff !important;background-color:#5bc0de !important;border-color:#5bc0de !important;}.btn-warning-outline{color:#f0ad4e !important;background-color:transparent;background-image:none;border-color:#f0ad4e !important;}.btn-warning-outline:focus,.btn-warning-outline.focus,.btn-warning-outline:active,.btn-warning-outline.active,.btn-warning-outline:hover,.open>.btn-warning-outline.dropdown-toggle{color:#fff !important;background-color:#f0ad4e !important;border-color:#f0ad4e !important;}.btn-success-outline{color:#5cb85c !important;background-color:transparent;background-image:none;border-color:#5cb85c !important;}.btn-success-outline:focus,.btn-success-outline.focus,.btn-success-outline:active,.btn-success-outline.active,.btn-success-outline:hover,.open>.btn-success-outline.dropdown-toggle{color:#fff !important;background-color:#5cb85c !important;border-color:#5cb85c !important;}#movieList .mix{display:none;}#tvList .mix{display:none;}.scroll-top-wrapper{position:fixed;opacity:0;visibility:hidden;overflow:hidden;text-align:center;z-index:99999999;background-color:#4e5d6c;color:#eee;width:50px;height:48px;line-height:48px;right:30px;bottom:30px;padding-top:2px;border-top-left-radius:10px;border-top-right-radius:10px;border-bottom-right-radius:10px;border-bottom-left-radius:10px;-webkit-transition:all .5s ease-in-out;-moz-transition:all .5s ease-in-out;-ms-transition:all .5s ease-in-out;-o-transition:all .5s ease-in-out;transition:all .5s ease-in-out;}.scroll-top-wrapper:hover{background-color:#637689;}.scroll-top-wrapper.show{visibility:visible;cursor:pointer;opacity:1;}.scroll-top-wrapper i.fa{line-height:inherit;}.no-search-results{text-align:center;}.no-search-results .no-search-results-icon{font-size:10em;color:#4e5d6c;}.no-search-results .no-search-results-text{margin:20px 0;color:#ccc;}.form-control-search{padding:13px 105px 13px 16px;height:100%;}.form-control-withbuttons{padding-right:105px;}.input-group-addon .btn-group{position:absolute;right:45px;z-index:3;top:10px;box-shadow:0 0 0;}.input-group-addon .btn-group .btn{border:1px solid rgba(255,255,255,.7) !important;padding:3px 12px;color:rgba(255,255,255,.7) !important;}.btn-split .btn{border-radius:0 !important;}.btn-split .btn:not(.dropdown-toggle){border-radius:.25rem 0 0 .25rem !important;}.btn-split .btn.dropdown-toggle{border-radius:0 .25rem .25rem 0 !important;padding:12px 8px;}#updateAvailable{background-color:#df691a;text-align:center;font-size:15px;padding:3px 0;}#cacherRunning{background-color:#4e5d6c;text-align:center;font-size:15px;padding:3px 0;}.checkbox label{display:inline-block;cursor:pointer;position:relative;padding-left:25px;margin-right:15px;font-size:13px;margin-bottom:10px;}.checkbox label:before{content:"";display:inline-block;width:18px;height:18px;margin-right:10px;position:absolute;left:0;bottom:1px;border:2px solid #eee;border-radius:3px;}.checkbox input[type=checkbox]{display:none;}.checkbox input[type=checkbox]:checked+label:before{content:"✓";font-size:13px;color:#fafafa;text-align:center;line-height:13px;}.small-checkbox label{display:inline-block;cursor:pointer;position:relative;padding-left:25px;margin-right:15px;font-size:13px;margin-bottom:10px;}.small-checkbox label:before{content:"";display:inline-block;width:18px;height:18px;margin-right:10px;position:absolute;left:0;bottom:1px;border:2px solid #eee;border-radius:8px;min-height:0 !important;}.small-checkbox input[type=checkbox]{display:none;}.small-checkbox input[type=checkbox]:checked+label:before{content:"✓";font-size:13px;color:#fafafa;text-align:center;line-height:13px;}.small-checkbox label{min-height:0 !important;padding-left:20px;margin-bottom:0;font-weight:normal;cursor:pointer;}.input-group-sm{padding-top:2px;padding-bottom:2px;}.tab-pane .form-horizontal .form-group{margin-right:15px;margin-left:15px;}.bootstrap-datetimepicker-widget.dropdown-menu{background-color:#4e5d6c;}.bootstrap-datetimepicker-widget.dropdown-menu.bottom:after{border-bottom:6px solid #4e5d6c !important;}.bootstrap-datetimepicker-widget table td.active,.bootstrap-datetimepicker-widget table td.active:hover{color:#fff !important;}.landing-header{display:block;margin:60px auto;}.landing-block{background:#2f2f2f !important;padding:5px;}.landing-block .media{margin:30px auto;max-width:450px;}.landing-block .media .media-left{display:inline-block;float:left;width:70px;}.landing-block .media .media-left i.fa{font-size:3em;}.landing-title{font-weight:bold;}.checkbox-custom{margin-top:0 !important;margin-bottom:0 !important;}.tooltip_templates{display:none;}.shadow{-moz-box-shadow:3px 3px 5px 6px #191919;-webkit-box-shadow:3px 3px 5px 6px #191919;box-shadow:3px 3px 5px 6px #191919;}.img-circle{border-radius:50%;}#wrapper{padding-left:0;-webkit-transition:all .5s ease;-moz-transition:all .5s ease;-o-transition:all .5s ease;transition:all .5s ease;}#wrapper.toggled{padding-right:250px;}#sidebar-wrapper{z-index:1000;position:fixed;right:250px;width:0;height:100%;margin-right:-250px;overflow-y:auto;background:#4e5d6c;padding-left:0;-webkit-transition:all .5s ease;-moz-transition:all .5s ease;-o-transition:all .5s ease;transition:all .5s ease;}#wrapper.toggled #sidebar-wrapper{width:500px;}#page-content-wrapper{width:100%;position:absolute;padding:15px;}#wrapper.toggled #page-content-wrapper{position:absolute;margin-left:-250px;}.sidebar-nav{position:absolute;top:0;width:500px;margin:0;padding-left:0;list-style:none;}.sidebar-nav li{text-indent:20px;line-height:40px;}.sidebar-nav li a{display:block;text-decoration:none;color:#999;}.sidebar-nav li a:hover{text-decoration:none;color:#fff;background:rgba(255,255,255,.2);}.sidebar-nav li a:active,.sidebar-nav li a:focus{text-decoration:none;}.sidebar-nav>.sidebar-brand{height:65px;font-size:18px;line-height:60px;}.sidebar-nav>.sidebar-brand a{color:#999;}.sidebar-nav>.sidebar-brand a:hover{color:#fff;background:none;}@media(min-width:768px){#wrapper{padding-right:250px;}#wrapper.toggled{padding-right:0;}#sidebar-wrapper{width:500px;}#wrapper.toggled #sidebar-wrapper{width:0;}#page-content-wrapper{padding:20px;position:relative;}#wrapper.toggled #page-content-wrapper{position:relative;margin-right:0;}}#lightbox{background-color:#808080;filter:alpha(opacity=50);opacity:.5;-moz-opacity:.5;top:0;left:0;z-index:20;height:100%;width:100%;background-repeat:no-repeat;background-position:center;position:absolute;}.list-group-item-dropdown{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#3e3e3e;border:1px solid transparent;} \ No newline at end of file +@media(min-width:768px){.row{position:relative;}.bottom-align-text{position:absolute;bottom:0;right:0;}.landing-block .media{max-width:450px;}}@media(max-width:48em){.home{padding-top:1rem;}}@media(min-width:48em){.home{padding-top:4rem;}}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{color:#fff;}hr{border:1px dashed #777;}.btn{border-radius:.25rem !important;}.btn-group-separated .btn,.btn-group-separated .btn+.btn{margin-left:3px;}.multiSelect{background-color:#4e5d6c;}.form-control-custom{background-color:#4e5d6c !important;color:#fff !important;border-radius:0;box-shadow:0 0 0 !important;}h1{font-size:3.5rem !important;font-weight:600 !important;}.request-title{margin-top:0 !important;font-size:1.9rem !important;}p{font-size:1.1rem !important;}label{display:inline-block !important;margin-bottom:.5rem !important;font-size:16px !important;}.small-label{display:inline-block !important;margin-bottom:.5rem !important;font-size:11px !important;}.small-checkbox{min-height:0 !important;}.round-checkbox{border-radius:8px;}.nav-tabs>li{font-size:13px;line-height:21px;}.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active>a:focus{background:#4e5d6c;}.nav-tabs>li>a>.fa{padding:3px 5px 3px 3px;}.nav-tabs>li.nav-tab-right{float:right;}.nav-tabs>li.nav-tab-right a{margin-right:0;margin-left:2px;}.nav-tabs>li.nav-tab-icononly .fa{padding:3px;}.navbar .nav a .fa,.dropdown-menu a .fa{font-size:130%;top:1px;position:relative;display:inline-block;margin-right:5px;}.dropdown-menu a .fa{top:2px;}.btn-danger-outline{color:#d9534f !important;background-color:transparent;background-image:none;border-color:#d9534f !important;}.btn-danger-outline:focus,.btn-danger-outline.focus,.btn-danger-outline:active,.btn-danger-outline.active,.btn-danger-outline:hover,.open>.btn-danger-outline.dropdown-toggle{color:#fff !important;background-color:#d9534f !important;border-color:#d9534f !important;}.btn-primary-outline{color:#ff761b !important;background-color:transparent;background-image:none;border-color:#ff761b !important;}.btn-primary-outline:focus,.btn-primary-outline.focus,.btn-primary-outline:active,.btn-primary-outline.active,.btn-primary-outline:hover,.open>.btn-primary-outline.dropdown-toggle{color:#fff !important;background-color:#df691a !important;border-color:#df691a !important;}.btn-info-outline{color:#5bc0de !important;background-color:transparent;background-image:none;border-color:#5bc0de !important;}.btn-info-outline:focus,.btn-info-outline.focus,.btn-info-outline:active,.btn-info-outline.active,.btn-info-outline:hover,.open>.btn-info-outline.dropdown-toggle{color:#fff !important;background-color:#5bc0de !important;border-color:#5bc0de !important;}.btn-warning-outline{color:#f0ad4e !important;background-color:transparent;background-image:none;border-color:#f0ad4e !important;}.btn-warning-outline:focus,.btn-warning-outline.focus,.btn-warning-outline:active,.btn-warning-outline.active,.btn-warning-outline:hover,.open>.btn-warning-outline.dropdown-toggle{color:#fff !important;background-color:#f0ad4e !important;border-color:#f0ad4e !important;}.btn-success-outline{color:#5cb85c !important;background-color:transparent;background-image:none;border-color:#5cb85c !important;}.btn-success-outline:focus,.btn-success-outline.focus,.btn-success-outline:active,.btn-success-outline.active,.btn-success-outline:hover,.open>.btn-success-outline.dropdown-toggle{color:#fff !important;background-color:#5cb85c !important;border-color:#5cb85c !important;}#movieList .mix{display:none;}#tvList .mix{display:none;}.scroll-top-wrapper{position:fixed;opacity:0;visibility:hidden;overflow:hidden;text-align:center;z-index:99999999;background-color:#4e5d6c;color:#eee;width:50px;height:48px;line-height:48px;right:30px;bottom:30px;padding-top:2px;border-top-left-radius:10px;border-top-right-radius:10px;border-bottom-right-radius:10px;border-bottom-left-radius:10px;-webkit-transition:all .5s ease-in-out;-moz-transition:all .5s ease-in-out;-ms-transition:all .5s ease-in-out;-o-transition:all .5s ease-in-out;transition:all .5s ease-in-out;}.scroll-top-wrapper:hover{background-color:#637689;}.scroll-top-wrapper.show{visibility:visible;cursor:pointer;opacity:1;}.scroll-top-wrapper i.fa{line-height:inherit;}.no-search-results{text-align:center;}.no-search-results .no-search-results-icon{font-size:10em;color:#4e5d6c;}.no-search-results .no-search-results-text{margin:20px 0;color:#ccc;}.form-control-search{padding:13px 105px 13px 16px;height:100%;}.form-control-withbuttons{padding-right:105px;}.input-group-addon .btn-group{position:absolute;right:45px;z-index:3;top:10px;box-shadow:0 0 0;}.input-group-addon .btn-group .btn{border:1px solid rgba(255,255,255,.7) !important;padding:3px 12px;color:rgba(255,255,255,.7) !important;}.btn-split .btn{border-radius:0 !important;}.btn-split .btn:not(.dropdown-toggle){border-radius:.25rem 0 0 .25rem !important;}.btn-split .btn.dropdown-toggle{border-radius:0 .25rem .25rem 0 !important;padding:12px 8px;}#updateAvailable{background-color:#df691a;text-align:center;font-size:15px;padding:3px 0;}#cacherRunning{background-color:#4e5d6c;text-align:center;font-size:15px;padding:3px 0;}.checkbox label{display:inline-block;cursor:pointer;position:relative;padding-left:25px;margin-right:15px;font-size:13px;margin-bottom:10px;}.checkbox label:before{content:"";display:inline-block;width:18px;height:18px;margin-right:10px;position:absolute;left:0;bottom:1px;border:2px solid #eee;border-radius:3px;}.checkbox input[type=checkbox]{display:none;}.checkbox input[type=checkbox]:checked+label:before{content:"✓";font-size:13px;color:#fafafa;text-align:center;line-height:13px;}.small-checkbox label{display:inline-block;cursor:pointer;position:relative;padding-left:25px;margin-right:15px;font-size:13px;margin-bottom:10px;}.small-checkbox label:before{content:"";display:inline-block;width:18px;height:18px;margin-right:10px;position:absolute;left:0;bottom:1px;border:2px solid #eee;border-radius:8px;min-height:0 !important;}.small-checkbox input[type=checkbox]{display:none;}.small-checkbox input[type=checkbox]:checked+label:before{content:"✓";font-size:13px;color:#fafafa;text-align:center;line-height:13px;}.small-checkbox label{min-height:0 !important;padding-left:20px;margin-bottom:0;font-weight:normal;cursor:pointer;}.input-group-sm{padding-top:2px;padding-bottom:2px;}.tab-pane .form-horizontal .form-group{margin-right:15px;margin-left:15px;}.bootstrap-datetimepicker-widget.dropdown-menu{background-color:#4e5d6c;}.bootstrap-datetimepicker-widget.dropdown-menu.bottom:after{border-bottom:6px solid #4e5d6c !important;}.bootstrap-datetimepicker-widget table td.active,.bootstrap-datetimepicker-widget table td.active:hover{color:#fff !important;}.landing-header{display:block;margin:60px auto;}.landing-block{background:#2f2f2f !important;padding:5px;}.landing-block .media{margin:30px auto;max-width:450px;}.landing-block .media .media-left{display:inline-block;float:left;width:70px;}.landing-block .media .media-left i.fa{font-size:3em;}.landing-title{font-weight:bold;}.checkbox-custom{margin-top:0 !important;margin-bottom:0 !important;}.tooltip_templates{display:none;}.shadow{-moz-box-shadow:3px 3px 5px 6px #191919;-webkit-box-shadow:3px 3px 5px 6px #191919;box-shadow:3px 3px 5px 6px #191919;}.img-circle{border-radius:50%;}#wrapper{padding-left:0;-webkit-transition:all .5s ease;-moz-transition:all .5s ease;-o-transition:all .5s ease;transition:all .5s ease;}#wrapper.toggled{padding-right:250px;}#sidebar-wrapper{z-index:1000;position:fixed;right:250px;width:0;height:100%;margin-right:-250px;overflow-y:auto;background:#4e5d6c;padding-left:0;-webkit-transition:all .5s ease;-moz-transition:all .5s ease;-o-transition:all .5s ease;transition:all .5s ease;}#wrapper.toggled #sidebar-wrapper{width:500px;}#page-content-wrapper{width:100%;position:absolute;padding:15px;}#wrapper.toggled #page-content-wrapper{position:absolute;margin-left:-250px;}.sidebar-nav{position:absolute;top:0;width:500px;margin:0;padding-left:0;list-style:none;}.sidebar-nav li{text-indent:20px;line-height:40px;}.sidebar-nav li a{display:block;text-decoration:none;color:#999;}.sidebar-nav li a:hover{text-decoration:none;color:#fff;background:rgba(255,255,255,.2);}.sidebar-nav li a:active,.sidebar-nav li a:focus{text-decoration:none;}.sidebar-nav>.sidebar-brand{height:65px;font-size:18px;line-height:60px;}.sidebar-nav>.sidebar-brand a{color:#999;}.sidebar-nav>.sidebar-brand a:hover{color:#fff;background:none;}@media(min-width:768px){#wrapper{padding-right:250px;}#wrapper.toggled{padding-right:0;}#sidebar-wrapper{width:500px;}#wrapper.toggled #sidebar-wrapper{width:0;}#page-content-wrapper{padding:20px;position:relative;}#wrapper.toggled #page-content-wrapper{position:relative;margin-right:0;}}#lightbox{background-color:#808080;filter:alpha(opacity=50);opacity:.5;-moz-opacity:.5;top:0;left:0;z-index:20;height:100%;width:100%;background-repeat:no-repeat;background-position:center;position:absolute;}.list-group-item-dropdown{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#3e3e3e;border:1px solid transparent;}.wizard-heading{text-align:center;}.wizard-img{width:300px;display:block !important;margin:0 auto !important;} \ No newline at end of file diff --git a/Ombi.UI/Content/base.scss b/Ombi.UI/Content/base.scss index aa0417b06..8c0c6e066 100644 --- a/Ombi.UI/Content/base.scss +++ b/Ombi.UI/Content/base.scss @@ -641,4 +641,13 @@ $border-radius: 10px; margin-bottom: -1px; background-color: #3e3e3e; border: 1px solid transparent; +} + +.wizard-heading{ + text-align: center; +} +.wizard-img{ + width: 300px; + display: block $i; + margin: 0 auto $i; } \ No newline at end of file diff --git a/Ombi.UI/Content/images/emby-logo-dark.jpg b/Ombi.UI/Content/images/emby-logo-dark.jpg new file mode 100644 index 000000000..838667b78 Binary files /dev/null and b/Ombi.UI/Content/images/emby-logo-dark.jpg differ diff --git a/Ombi.UI/Content/images/emby-logo.png b/Ombi.UI/Content/images/emby-logo.png new file mode 100644 index 000000000..a6c51ff23 Binary files /dev/null and b/Ombi.UI/Content/images/emby-logo.png differ diff --git a/Ombi.UI/Content/images/logo original.png b/Ombi.UI/Content/images/logo original.png new file mode 100644 index 000000000..c3071e331 Binary files /dev/null and b/Ombi.UI/Content/images/logo original.png differ diff --git a/Ombi.UI/Content/images/logo-cropped.png b/Ombi.UI/Content/images/logo-cropped.png new file mode 100644 index 000000000..560a817e6 Binary files /dev/null and b/Ombi.UI/Content/images/logo-cropped.png differ diff --git a/Ombi.UI/Content/images/logo.png b/Ombi.UI/Content/images/logo.png index 68df0f5cd..fe356bcaf 100644 Binary files a/Ombi.UI/Content/images/logo.png and b/Ombi.UI/Content/images/logo.png differ diff --git a/Ombi.UI/Content/images/plex-logo-reversed.png b/Ombi.UI/Content/images/plex-logo-reversed.png new file mode 100644 index 000000000..1e754b342 Binary files /dev/null and b/Ombi.UI/Content/images/plex-logo-reversed.png differ diff --git a/Ombi.UI/Content/images/plex-logo.png b/Ombi.UI/Content/images/plex-logo.png new file mode 100644 index 000000000..33355e291 Binary files /dev/null and b/Ombi.UI/Content/images/plex-logo.png differ diff --git a/Ombi.UI/Content/wizard.js b/Ombi.UI/Content/wizard.js index 606a44c5e..2151a44e2 100644 --- a/Ombi.UI/Content/wizard.js +++ b/Ombi.UI/Content/wizard.js @@ -3,9 +3,39 @@ // Step 1 $('#firstNext') .click(function () { - loadArea("plexAuthArea"); + loadArea("mediaApplicationChoice"); }); + + // Plex click + $('#contentBody') + .on("click", "#plexImg", function(e) { + e.preventDefault(); + return loadArea("plexAuthArea"); + }); + + + $('#contentBody') + .on("click", "#embyImg", function (e) { + e.preventDefault(); + return loadArea("embyApiKey"); + }); + + + + $('#contentBody').on('click', '#embyApiKeySave', function (e) { + e.preventDefault(); + + var $form = $("#embyAuthForm"); + $.post($form.prop("action"), $form.serialize(), function (response) { + if (response.result === true) { + loadArea("authArea"); + } else { + generateNotify(response.message, "warning"); + } + }); + }); + // Step 2 - Get the auth token $('#contentBody').on('click', '#requestToken', function (e) { e.preventDefault(); diff --git a/Ombi.UI/Modules/UserWizardModule.cs b/Ombi.UI/Modules/UserWizardModule.cs index 922647a41..cfc8878ac 100644 --- a/Ombi.UI/Modules/UserWizardModule.cs +++ b/Ombi.UI/Modules/UserWizardModule.cs @@ -1,4 +1,5 @@ #region Copyright + // /************************************************************************ // Copyright (c) 2016 Jamie Rees // File: UserWizardModule.cs @@ -23,6 +24,7 @@ // 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 System; @@ -50,8 +52,11 @@ namespace Ombi.UI.Modules { public class UserWizardModule : BaseModule { - public UserWizardModule(ISettingsService pr, ISettingsService plex, IPlexApi plexApi, - ISettingsService auth, ICustomUserMapper m, IAnalytics a, ISecurityExtensions security) : base("wizard", pr, security) + public UserWizardModule(ISettingsService pr, ISettingsService plex, + IPlexApi plexApi, + ISettingsService auth, ICustomUserMapper m, IAnalytics a, + ISecurityExtensions security, IEmbyApi embyApi, + ISettingsService embySettings) : base("wizard", pr, security) { PlexSettings = plex; PlexApi = plexApi; @@ -59,10 +64,13 @@ namespace Ombi.UI.Modules Auth = auth; Mapper = m; Analytics = a; + EmbySettings = embySettings; + EmbyApi = embyApi; Get["/", true] = async (x, ct) => { - a.TrackEventAsync(Category.Wizard, Action.Start, "Started the wizard", Username, CookieHelper.GetAnalyticClientId(Cookies)); + a.TrackEventAsync(Category.Wizard, Action.Start, "Started the wizard", Username, + CookieHelper.GetAnalyticClientId(Cookies)); var settings = await PlexRequestSettings.GetSettingsAsync(); @@ -76,7 +84,10 @@ namespace Ombi.UI.Modules 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(); + Post["/createuser", true] = async (x, ct) => await CreateUser(); + + + Post["/embyauth", true] = async (x, ct) => await EmbyAuth(); } private ISettingsService PlexSettings { get; } @@ -85,6 +96,8 @@ namespace Ombi.UI.Modules private ISettingsService Auth { get; } private ICustomUserMapper Mapper { get; } private IAnalytics Analytics { get; } + private IEmbyApi EmbyApi { get; } + private ISettingsService EmbySettings { get; } private static Logger Log = LogManager.GetCurrentClassLogger(); @@ -95,23 +108,31 @@ namespace Ombi.UI.Modules if (string.IsNullOrEmpty(user.username) || string.IsNullOrEmpty(user.password)) { - return Response.AsJson(new JsonResponseModel { Result = false, Message = "Please provide a valid username and password" }); + return + Response.AsJson(new JsonResponseModel + { + Result = false, + Message = "Please provide a valid username and password" + }); } var model = PlexApi.SignIn(user.username, user.password); if (model?.user == null) { - return Response.AsJson(new JsonResponseModel { Result = false, Message = "Incorrect username or password!" }); + return + Response.AsJson(new JsonResponseModel {Result = false, Message = "Incorrect username or password!"}); } // Set the auth token in the session so we can use it in the next form Session[SessionKeys.UserWizardPlexAuth] = model.user.authentication_token; - + var servers = PlexApi.GetServer(model.user.authentication_token); var firstServer = servers.Server.FirstOrDefault(); - - return Response.AsJson(new { Result = true, firstServer?.Port, Ip = firstServer?.LocalAddresses, firstServer?.Scheme }); + + return + Response.AsJson( + new {Result = true, firstServer?.Port, Ip = firstServer?.LocalAddresses, firstServer?.Scheme}); } private async Task Plex() @@ -122,7 +143,8 @@ namespace Ombi.UI.Modules { return Response.AsJson(valid.SendJsonError()); } - form.PlexAuthToken = Session[SessionKeys.UserWizardPlexAuth].ToString(); // Set the auth token from the previous form + form.PlexAuthToken = Session[SessionKeys.UserWizardPlexAuth].ToString(); + // Set the auth token from the previous form // Get the machine ID from the settings (This could have changed) try @@ -141,9 +163,14 @@ namespace Ombi.UI.Modules var result = await PlexSettings.SaveSettingsAsync(form); if (result) { - return Response.AsJson(new JsonResponseModel { Result = true }); + return Response.AsJson(new JsonResponseModel {Result = true}); } - return Response.AsJson(new JsonResponseModel { Result = false, Message = "Could not save the settings to the database, please try again." }); + return + Response.AsJson(new JsonResponseModel + { + Result = false, + Message = "Could not save the settings to the database, please try again." + }); } private async Task PlexRequest() @@ -158,14 +185,19 @@ namespace Ombi.UI.Modules currentSettings.SearchForMovies = form.SearchForMovies; currentSettings.SearchForTvShows = form.SearchForTvShows; currentSettings.SearchForMusic = form.SearchForMusic; - + var result = await PlexRequestSettings.SaveSettingsAsync(currentSettings); if (result) { - return Response.AsJson(new { Result = true }); + return Response.AsJson(new {Result = true}); } - return Response.AsJson(new JsonResponseModel { Result = false, Message = "Could not save the settings to the database, please try again." }); + return + Response.AsJson(new JsonResponseModel + { + Result = false, + Message = "Could not save the settings to the database, please try again." + }); } private async Task Authentication() @@ -175,16 +207,23 @@ namespace Ombi.UI.Modules var result = await Auth.SaveSettingsAsync(form); if (result) { - return Response.AsJson(new JsonResponseModel { Result = true }); + return Response.AsJson(new JsonResponseModel {Result = true}); } - return Response.AsJson(new JsonResponseModel { Result = false, Message = "Could not save the settings to the database, please try again." }); + return + Response.AsJson(new JsonResponseModel + { + Result = false, + Message = "Could not save the settings to the database, please try again." + }); } private async Task CreateUser() { - var username = (string)Request.Form.Username; - var userId = Mapper.CreateUser(username, Request.Form.Password, EnumHelper.All() - (int)Permissions.ReadOnlyUser, 0); - Analytics.TrackEventAsync(Category.Wizard, Action.Finish, "Finished the wizard", username, CookieHelper.GetAnalyticClientId(Cookies)); + var username = (string) Request.Form.Username; + var userId = Mapper.CreateUser(username, Request.Form.Password, + EnumHelper.All() - (int) Permissions.ReadOnlyUser, 0); + Analytics.TrackEventAsync(Category.Wizard, Action.Finish, "Finished the wizard", username, + CookieHelper.GetAnalyticClientId(Cookies)); Session[SessionKeys.UsernameKey] = username; // Destroy the Plex Auth Token @@ -197,7 +236,55 @@ namespace Ombi.UI.Modules var baseUrl = string.IsNullOrEmpty(settings.BaseUrl) ? string.Empty : $"/{settings.BaseUrl}"; - return CustomModuleExtensions.LoginAndRedirect(this,(Guid)userId, fallbackRedirectUrl: $"{baseUrl}/search"); + return CustomModuleExtensions.LoginAndRedirect(this, (Guid) userId, fallbackRedirectUrl: $"{baseUrl}/search"); + } + + private async Task EmbyAuth() + { + var ip = (string) Request.Form.Ip; + var port = (int) Request.Form.Port; + var apiKey = (string) Request.Form.ApiKey; + var ssl = (bool) Request.Form.Ssl; + + var settings = new EmbySettings + { + ApiKey = apiKey, + Enable = true, + Ip = ip, + Port = port, + Ssl = ssl, + }; + + try + { + // Test that we can connect + var result = EmbyApi.GetUsers(settings.FullUri, apiKey); + + if (result != null && result.Any()) + { + + await EmbySettings.SaveSettingsAsync(settings); + + return Response.AsJson(new JsonResponseModel + { + Result = true + }); + } + } + catch (Exception e) + { + return Response.AsJson(new JsonResponseModel + { + Result = false, + Message = $"Could not connect to Emby, please check your settings. Error: {e.Message}" + }); + } + + return Response.AsJson(new JsonResponseModel + { + Result = false, + Message = "Could not connect to Emby, please check your settings." + }); } } } \ No newline at end of file diff --git a/Ombi.UI/Ombi.UI.csproj b/Ombi.UI/Ombi.UI.csproj index 6e7096ba6..832d395af 100644 --- a/Ombi.UI/Ombi.UI.csproj +++ b/Ombi.UI/Ombi.UI.csproj @@ -393,6 +393,24 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + PreserveNewest diff --git a/Ombi.UI/Views/UserWizard/Index.cshtml b/Ombi.UI/Views/UserWizard/Index.cshtml index a55efbe62..634bf4ad4 100644 --- a/Ombi.UI/Views/UserWizard/Index.cshtml +++ b/Ombi.UI/Views/UserWizard/Index.cshtml @@ -10,10 +10,9 @@ } @Html.LoadWizardAssets() - +
-

Welcome to Ombi

@@ -31,6 +30,60 @@ + + + +