From e28f3b876b199d86bd3c71c6cb08908180bfac2f Mon Sep 17 00:00:00 2001 From: tidusjar Date: Sat, 30 Jan 2021 22:42:39 +0000 Subject: [PATCH 1/4] Added the new font awesome icons --- src/Ombi/ClientApp/angular.json | 5 ++- src/Ombi/ClientApp/package.json | 2 +- src/Ombi/ClientApp/src/app/app.component.html | 2 +- .../app/custompage/custompage.component.html | 4 +-- .../card/discover-card-details.component.html | 34 +++++++++---------- .../card/discover-card.component.html | 2 +- .../grid/discover-grid.component.html | 20 +++++------ .../search-results.component.html | 2 +- .../app/issues/issueDetails.component.html | 2 +- .../landingpage/landingpage.component.html | 10 +++--- .../src/app/login/login.component.html | 2 +- .../artist/artist-details.component.html | 24 ++++++------- .../movie/movie-details.component.html | 26 +++++++------- .../social-icons/social-icons.component.html | 18 +++++----- .../components/tv/tv-details.component.html | 10 +++--- .../src/app/my-nav/my-nav.component.html | 2 +- .../src/app/my-nav/my-nav.component.ts | 2 +- .../app/requests/movierequests.component.html | 28 +++++++-------- .../music/musicrequests.component.html | 30 ++++++++-------- .../src/app/requests/request.component.html | 6 ++-- .../tvrequest-children.component.html | 16 ++++----- .../app/requests/tvrequests.component.html | 8 ++--- .../src/app/search/moviesearch.component.html | 32 ++++++++--------- .../app/search/moviesearchgrid.component.html | 20 +++++------ .../search/music/albumsearch.component.html | 16 ++++----- .../search/music/artistsearch.component.html | 8 ++--- .../search/music/musicsearch.component.html | 6 ++-- .../src/app/search/search.component.html | 6 ++-- .../src/app/search/tvsearch.component.html | 18 +++++----- .../couchpotato/couchpotato.component.html | 2 +- .../failedrequests.component.html | 2 +- .../app/settings/lidarr/lidarr.component.html | 6 ++-- .../notifications/webhook.component.html | 2 +- .../src/app/settings/ombi/ombi.component.html | 2 +- .../src/app/settings/plex/plex.component.html | 4 +-- .../app/settings/radarr/radarr.component.html | 4 +-- .../app/settings/settingsmenu.component.html | 14 ++++---- .../app/settings/sonarr/sonarr.component.html | 8 ++--- .../src/app/vote/vote.component.html | 12 +++---- .../src/app/wizard/plex/plex.component.html | 2 +- src/Ombi/ClientApp/yarn.lock | 9 ++--- 41 files changed, 216 insertions(+), 212 deletions(-) diff --git a/src/Ombi/ClientApp/angular.json b/src/Ombi/ClientApp/angular.json index cd17cccc0..2e3ff44e5 100644 --- a/src/Ombi/ClientApp/angular.json +++ b/src/Ombi/ClientApp/angular.json @@ -29,7 +29,10 @@ "src/styles/_imports.scss", "node_modules/bootstrap/scss/bootstrap.scss", "node_modules/primeng/resources/themes/md-dark-deeppurple/theme.css", - "node_modules/font-awesome/scss/font-awesome.scss", + "node_modules/@fortawesome/fontawesome-free/scss/fontawesome.scss", + "node_modules/@fortawesome/fontawesome-free/scss/regular.scss", + "node_modules/@fortawesome/fontawesome-free/scss/solid.scss", + "node_modules/@fortawesome/fontawesome-free/scss/brands.scss", "node_modules/primeng/resources/primeng.min.css", "node_modules/primeicons/primeicons.css", "node_modules/please-wait/src/please-wait.scss", diff --git a/src/Ombi/ClientApp/package.json b/src/Ombi/ClientApp/package.json index 777dcfe8c..6c1713eff 100644 --- a/src/Ombi/ClientApp/package.json +++ b/src/Ombi/ClientApp/package.json @@ -24,6 +24,7 @@ "@angularclass/hmr": "^2.1.3", "@aspnet/signalr": "^1.1.0", "@auth0/angular-jwt": "^2.1.0", + "@fortawesome/fontawesome-free": "^5.15.2", "@fullcalendar/core": "^4.2.0", "@fullcalendar/daygrid": "^4.4.0", "@fullcalendar/interaction": "^4.2.0", @@ -39,7 +40,6 @@ "chart.js": "2.9.4", "core-js": "^2.5.4", "eventemitter2": "^5.0.1", - "font-awesome": "^4.7.0", "fullcalendar": "^4.0.0-alpha.4", "jquery": "3.3.1", "lodash": "^4.17.20", diff --git a/src/Ombi/ClientApp/src/app/app.component.html b/src/Ombi/ClientApp/src/app/app.component.html index f5f2d82eb..a8e527a6b 100644 --- a/src/Ombi/ClientApp/src/app/app.component.html +++ b/src/Ombi/ClientApp/src/app/app.component.html @@ -45,7 +45,7 @@ diff --git a/src/Ombi/ClientApp/src/app/custompage/custompage.component.html b/src/Ombi/ClientApp/src/app/custompage/custompage.component.html index d35c94141..ae2d00eb7 100644 --- a/src/Ombi/ClientApp/src/app/custompage/custompage.component.html +++ b/src/Ombi/ClientApp/src/app/custompage/custompage.component.html @@ -5,7 +5,7 @@
@@ -14,7 +14,7 @@
diff --git a/src/Ombi/ClientApp/src/app/discover/components/card/discover-card-details.component.html b/src/Ombi/ClientApp/src/app/discover/components/card/discover-card-details.component.html index d7bac2d96..3ac12d570 100644 --- a/src/Ombi/ClientApp/src/app/discover/components/card/discover-card-details.component.html +++ b/src/Ombi/ClientApp/src/app/discover/components/card/discover-card-details.component.html @@ -16,35 +16,35 @@ + class="fas fa-play-circle fa-2x grow"> + class="fas fa-play-circle fa-2x grow"> + class="fas fa-play-circle fa-2x grow"> + class="fas fa-play-circle fa-2x grow"> + class="fas fa-play-circle fa-2x grow"> + class="fas fa-play-circle fa-2x grow"> - +
@@ -123,14 +123,14 @@ - @@ -140,27 +140,27 @@ + {{'Common.Available' | translate }} + {{'Common.PartiallyAvailable' | translate }} {{'Search.ViewOnPlex' | + href="{{tv.plexUrl}}" target="_blank"> {{'Search.ViewOnPlex' | translate}} {{'Search.ViewOnEmby' | + target="_blank"> {{'Search.ViewOnEmby' | translate}} {{'Search.ViewOnJellyfin' | + target="_blank"> {{'Search.ViewOnJellyfin' | translate}}
diff --git a/src/Ombi/ClientApp/src/app/discover/components/grid/discover-grid.component.html b/src/Ombi/ClientApp/src/app/discover/components/grid/discover-grid.component.html index e413cc372..959538444 100644 --- a/src/Ombi/ClientApp/src/app/discover/components/grid/discover-grid.component.html +++ b/src/Ombi/ClientApp/src/app/discover/components/grid/discover-grid.component.html @@ -118,14 +118,14 @@ *ngIf="movie.requested || movie.approved; then requestedBtn else notRequestedBtn"> @@ -135,7 +135,7 @@ diff --git a/src/Ombi/ClientApp/src/app/discover/components/search-results/search-results.component.html b/src/Ombi/ClientApp/src/app/discover/components/search-results/search-results.component.html index 965017163..5a8ad4b42 100644 --- a/src/Ombi/ClientApp/src/app/discover/components/search-results/search-results.component.html +++ b/src/Ombi/ClientApp/src/app/discover/components/search-results/search-results.component.html @@ -9,7 +9,7 @@
-

{{'Discovery.NoSearch' | translate}}

+

{{'Discovery.NoSearch' | translate}}

\ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/issues/issueDetails.component.html b/src/Ombi/ClientApp/src/app/issues/issueDetails.component.html index 44be113c6..c2de76c2b 100644 --- a/src/Ombi/ClientApp/src/app/issues/issueDetails.component.html +++ b/src/Ombi/ClientApp/src/app/issues/issueDetails.component.html @@ -61,7 +61,7 @@
-
+

{{comment.comment}}

diff --git a/src/Ombi/ClientApp/src/app/landingpage/landingpage.component.html b/src/Ombi/ClientApp/src/app/landingpage/landingpage.component.html index 298ce4c11..7f5d13c3c 100644 --- a/src/Ombi/ClientApp/src/app/landingpage/landingpage.component.html +++ b/src/Ombi/ClientApp/src/app/landingpage/landingpage.component.html @@ -13,21 +13,21 @@
-

 Notice

+

 Notice


- +
-

{{ 'LandingPage.OnlineHeading' | translate }}

+

{{ 'LandingPage.OnlineHeading' | translate }}

-

{{ 'LandingPage.PartiallyOnlineHeading' | translate }}

+

{{ 'LandingPage.PartiallyOnlineHeading' | translate }}

There is {{mediaServerStatus.serversUnavailable}} server offline out of {{mediaServerStatus.totalServers}}.

@@ -35,7 +35,7 @@
-

{{ 'LandingPage.OfflineHeading' | translate }}

+

{{ 'LandingPage.OfflineHeading' | translate }}

diff --git a/src/Ombi/ClientApp/src/app/login/login.component.html b/src/Ombi/ClientApp/src/app/login/login.component.html index d48b58e31..ced032260 100644 --- a/src/Ombi/ClientApp/src/app/login/login.component.html +++ b/src/Ombi/ClientApp/src/app/login/login.component.html @@ -40,7 +40,7 @@
diff --git a/src/Ombi/ClientApp/src/app/media-details/components/artist/artist-details.component.html b/src/Ombi/ClientApp/src/app/media-details/components/artist/artist-details.component.html index 46c5b97c9..1a7db7f91 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/artist/artist-details.component.html +++ b/src/Ombi/ClientApp/src/app/media-details/components/artist/artist-details.component.html @@ -23,12 +23,12 @@
+ {{ 'MediaDetails.RequestAllAlbums' | translate }} + {{ 'MediaDetails.RequestSelectedAlbums' | translate }} + {{ 'MediaDetails.ClearSelection' | translate }} @@ -39,39 +39,39 @@ --> diff --git a/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.html b/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.html index 6e809c90d..0aff4e4f6 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.html +++ b/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.html @@ -41,15 +41,15 @@ {{'Search.ViewOnPlex' | translate}} - + {{'Search.ViewOnEmby' | translate}} - + {{'Search.ViewOnJellyfin' | translate}} - +
diff --git a/src/Ombi/ClientApp/src/app/media-details/components/shared/social-icons/social-icons.component.html b/src/Ombi/ClientApp/src/app/media-details/components/shared/social-icons/social-icons.component.html index 0cde69b8b..565af2127 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/shared/social-icons/social-icons.component.html +++ b/src/Ombi/ClientApp/src/app/media-details/components/shared/social-icons/social-icons.component.html @@ -1,32 +1,32 @@ diff --git a/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.html b/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.html index 368341b3d..cb23212d2 100644 --- a/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.html +++ b/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.html @@ -29,7 +29,7 @@ {{nav.icon}} -  {{nav.name | translate}} diff --git a/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.ts b/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.ts index 9a5ec794c..d7216d114 100644 --- a/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.ts +++ b/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.ts @@ -87,7 +87,7 @@ export class MyNavComponent implements OnInit { // { name: "NavigationBar.Calendar", icon: "calendar_today", link: "/calendar", requiresAdmin: false, enabled: true }, { name: "NavigationBar.Donate", icon: "attach_money", link: "https://www.paypal.me/PlexRequestsNet", externalLink: true, requiresAdmin: true, enabled: true, toolTip: true, style: "color:red;", toolTipMessage: 'NavigationBar.DonateTooltip', faIcon: null }, { name: "NavigationBar.Donate", icon: "attach_money", link: customizationSettings.customDonationUrl, externalLink: true, requiresAdmin: false, enabled: customizationSettings.enableCustomDonations, toolTip: true, toolTipMessage: customizationSettings.customDonationMessage, faIcon: null }, - { name: "NavigationBar.FeatureSuggestion", icon: null, link: "https://features.ombi.io/", externalLink: true, requiresAdmin: true, enabled: true, toolTip: true, toolTipMessage: 'NavigationBar.FeatureSuggestionTooltip', faIcon: "fa-lightbulb-o" }, + { name: "NavigationBar.FeatureSuggestion", icon: null, link: "https://features.ombi.io/", externalLink: true, requiresAdmin: true, enabled: true, toolTip: true, toolTipMessage: 'NavigationBar.FeatureSuggestionTooltip', faIcon: "fa-lightbulb" }, { name: "NavigationBar.Settings", icon: "settings", link: "/Settings/About", requiresAdmin: true, enabled: true, faIcon: null }, { name: "NavigationBar.UserPreferences", icon: "person", link: "/user-preferences", requiresAdmin: false, enabled: true, faIcon: null }, ]; diff --git a/src/Ombi/ClientApp/src/app/requests/movierequests.component.html b/src/Ombi/ClientApp/src/app/requests/movierequests.component.html index 3f8485fce..ad82ffbb9 100644 --- a/src/Ombi/ClientApp/src/app/requests/movierequests.component.html +++ b/src/Ombi/ClientApp/src/app/requests/movierequests.component.html @@ -4,13 +4,13 @@ (keyup)="search($event)">
{{ 'Requests.Denied' | translate }} - +
@@ -124,11 +124,11 @@ - + - +
@@ -137,14 +137,14 @@
@@ -186,11 +186,11 @@
@@ -200,14 +200,14 @@
+ {{ 'Filter.ClearFilter' | translate }} diff --git a/src/Ombi/ClientApp/src/app/requests/music/musicrequests.component.html b/src/Ombi/ClientApp/src/app/requests/music/musicrequests.component.html index 3565898ed..9f5e08fdd 100644 --- a/src/Ombi/ClientApp/src/app/requests/music/musicrequests.component.html +++ b/src/Ombi/ClientApp/src/app/requests/music/musicrequests.component.html @@ -4,13 +4,13 @@ (keyup)="search($event)"> @@ -32,9 +32,9 @@ - -
- +

OR

diff --git a/src/Ombi/ClientApp/yarn.lock b/src/Ombi/ClientApp/yarn.lock index a834d8bdf..d976c8be5 100644 --- a/src/Ombi/ClientApp/yarn.lock +++ b/src/Ombi/ClientApp/yarn.lock @@ -1126,6 +1126,11 @@ lodash "^4.17.13" to-fast-properties "^2.0.0" +"@fortawesome/fontawesome-free@^5.15.2": + version "5.15.2" + resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-5.15.2.tgz#218cd7276ab4f9ab57cc3d2efa2697e6a579f25d" + integrity sha512-7l/AX41m609L/EXI9EKH3Vs3v0iA8tKlIOGtw+kgcoanI7p+e4I4GYLqW3UXWiTnjSFymKSmTTPKYrivzbxxqA== + "@fullcalendar/core@^4.2.0": version "4.4.0" resolved "https://registry.yarnpkg.com/@fullcalendar/core/-/core-4.4.0.tgz#79dbc0cca836ce628a07e739a456da11ff141373" @@ -3841,10 +3846,6 @@ follow-redirects@^1.0.0: dependencies: debug "=3.1.0" -font-awesome@^4.7.0: - version "4.7.0" - resolved "https://registry.yarnpkg.com/font-awesome/-/font-awesome-4.7.0.tgz#8fa8cf0411a1a31afd07b06d2902bb9fc815a133" - for-in@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" From cd99a876c979d7772b38eca3beddf1c1cb2efc59 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Sat, 30 Jan 2021 23:22:40 +0000 Subject: [PATCH 2/4] Moved the videos into a carousel and outside of the accordion on the movies page --- src/Ombi/Attributes/WizardActionFilter.cs | 26 ++++++++++++++ .../movie/movie-details.component.html | 31 ++++++++-------- .../media-details.component.scss | 4 +++ .../src/styles/primeng-overrides.scss | 6 ++-- src/Ombi/Controllers/V2/WizardController.cs | 35 +++++++++++++++++++ src/Ombi/Startup.cs | 2 ++ 6 files changed, 87 insertions(+), 17 deletions(-) create mode 100644 src/Ombi/Attributes/WizardActionFilter.cs create mode 100644 src/Ombi/Controllers/V2/WizardController.cs diff --git a/src/Ombi/Attributes/WizardActionFilter.cs b/src/Ombi/Attributes/WizardActionFilter.cs new file mode 100644 index 000000000..644256d08 --- /dev/null +++ b/src/Ombi/Attributes/WizardActionFilter.cs @@ -0,0 +1,26 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.Extensions.DependencyInjection; +using Ombi.Core.Settings; +using Ombi.Settings.Settings.Models; +using System.Threading.Tasks; + +namespace Ombi.Attributes +{ + public class WizardActionFilter : IAsyncActionFilter + { + public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) + { + var settingsService = context.HttpContext.RequestServices.GetRequiredService>(); + + var settings = await settingsService.GetSettingsAsync(); + + if (!settings.Wizard) + { + await next(); + return; + } + context.Result = new UnauthorizedResult(); + } + } +} diff --git a/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.html b/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.html index 0aff4e4f6..f23735c46 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.html +++ b/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.html @@ -125,6 +125,23 @@ + + +
+
+ + + + + +
+
+
@@ -172,20 +189,6 @@
- - - - {{'MediaDetails.VideosTitle' | translate}} - - - -
- -
- -
-
-
diff --git a/src/Ombi/ClientApp/src/app/media-details/media-details.component.scss b/src/Ombi/ClientApp/src/app/media-details/media-details.component.scss index e8ed3e2e1..1923f9c09 100644 --- a/src/Ombi/ClientApp/src/app/media-details/media-details.component.scss +++ b/src/Ombi/ClientApp/src/app/media-details/media-details.component.scss @@ -255,3 +255,7 @@ border: 1px solid #00a4dc; color: #00a4dc; } + +::ng-deep .p-carousel-indicators { + display: none !important; + } diff --git a/src/Ombi/ClientApp/src/styles/primeng-overrides.scss b/src/Ombi/ClientApp/src/styles/primeng-overrides.scss index 4ccb0765e..e8c023644 100644 --- a/src/Ombi/ClientApp/src/styles/primeng-overrides.scss +++ b/src/Ombi/ClientApp/src/styles/primeng-overrides.scss @@ -9,10 +9,10 @@ .ui-carousel-viewport { border:0 !important; - background-color:transparent !important; + background-color:transparent !important; } .ui-carousel .ui-carousel-header { background-color:transparent !important; - border: 0 !important; -} \ No newline at end of file + border: 0 !important; +} diff --git a/src/Ombi/Controllers/V2/WizardController.cs b/src/Ombi/Controllers/V2/WizardController.cs new file mode 100644 index 000000000..e7fa82fec --- /dev/null +++ b/src/Ombi/Controllers/V2/WizardController.cs @@ -0,0 +1,35 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.Extensions.DependencyInjection; +using Ombi.Attributes; +using Ombi.Core.Settings; +using Ombi.Settings.Settings.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Ombi.Controllers.V2 +{ + [ServiceFilter(typeof(WizardActionFilter))] + [AllowAnonymous] + public class WizardController : V2Controller + { + + private ISettingsService _ombiSettings { get; } + + + [HttpGet] + public IActionResult Ok() + { + return Ok(); + } + + + + + } + + +} diff --git a/src/Ombi/Startup.cs b/src/Ombi/Startup.cs index fecaaccb3..56e28ce14 100644 --- a/src/Ombi/Startup.cs +++ b/src/Ombi/Startup.cs @@ -30,6 +30,7 @@ using Newtonsoft.Json; using ILogger = Serilog.ILogger; using Microsoft.AspNetCore.Diagnostics.HealthChecks; using Ombi.HealthChecks; +using Ombi.Attributes; namespace Ombi { @@ -97,6 +98,7 @@ namespace Ombi services.RegisterApplicationDependencies(); // Ioc and EF services.AddSwagger(); services.AddAppSettingsValues(Configuration); + services.AddScoped(); services.AddCors(o => o.AddPolicy("MyPolicy", builder => { From 069b8b5632a6b1334ccb547c8cbff761f85e6cf3 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Sat, 30 Jan 2021 23:41:23 +0000 Subject: [PATCH 3/4] Added the new Config API with the frontend services --- .../src/app/wizard/models/OmbiConfigModel.ts | 5 +++ .../src/app/wizard/services/wizard.service.ts | 18 ++++++++ .../ClientApp/src/app/wizard/wizard.module.ts | 2 + src/Ombi/Controllers/V2/WizardController.cs | 43 +++++++++++++------ src/Ombi/Models/V2/OmbiConfigModel.cs | 14 ++++++ 5 files changed, 70 insertions(+), 12 deletions(-) create mode 100644 src/Ombi/ClientApp/src/app/wizard/models/OmbiConfigModel.ts create mode 100644 src/Ombi/ClientApp/src/app/wizard/services/wizard.service.ts create mode 100644 src/Ombi/Models/V2/OmbiConfigModel.cs diff --git a/src/Ombi/ClientApp/src/app/wizard/models/OmbiConfigModel.ts b/src/Ombi/ClientApp/src/app/wizard/models/OmbiConfigModel.ts new file mode 100644 index 000000000..29e6e68a9 --- /dev/null +++ b/src/Ombi/ClientApp/src/app/wizard/models/OmbiConfigModel.ts @@ -0,0 +1,5 @@ +export interface IOmbiConfigModel { + applicationName: string; + applicationUrl: string; + logo: string; +} \ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/wizard/services/wizard.service.ts b/src/Ombi/ClientApp/src/app/wizard/services/wizard.service.ts new file mode 100644 index 000000000..0990ca384 --- /dev/null +++ b/src/Ombi/ClientApp/src/app/wizard/services/wizard.service.ts @@ -0,0 +1,18 @@ +import { PlatformLocation, APP_BASE_HREF } from "@angular/common"; +import { HttpClient } from "@angular/common/http"; +import { Injectable, Inject } from "@angular/core"; +import { ICustomizationSettings } from "../../interfaces"; +import { ServiceHelpers } from "../../services"; +import { IOmbiConfigModel } from "../models/OmbiConfigModel"; + + +@Injectable() +export class WizardService extends ServiceHelpers { + constructor(public http: HttpClient, @Inject(APP_BASE_HREF) href:string) { + super(http, "/api/v2/wizard/", href); + } + + public async downvoteAlbum(config: IOmbiConfigModel): Promise { + return await this.http.post(`${this.url}config`, config, {headers: this.headers}).toPromise(); + } +} diff --git a/src/Ombi/ClientApp/src/app/wizard/wizard.module.ts b/src/Ombi/ClientApp/src/app/wizard/wizard.module.ts index 1e34a1de9..e088fa6b3 100644 --- a/src/Ombi/ClientApp/src/app/wizard/wizard.module.ts +++ b/src/Ombi/ClientApp/src/app/wizard/wizard.module.ts @@ -17,6 +17,7 @@ import { JellyfinService } from "../services"; import { PlexService } from "../services"; import { IdentityService } from "../services"; import { PlexOAuthService } from "../services"; +import { WizardService } from "./services/wizard.service"; import { SharedModule } from "../shared/shared.module"; @@ -54,6 +55,7 @@ const routes: Routes = [ EmbyService, JellyfinService, PlexOAuthService, + WizardService, ], }) diff --git a/src/Ombi/Controllers/V2/WizardController.cs b/src/Ombi/Controllers/V2/WizardController.cs index e7fa82fec..bb3bed5b6 100644 --- a/src/Ombi/Controllers/V2/WizardController.cs +++ b/src/Ombi/Controllers/V2/WizardController.cs @@ -1,13 +1,10 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Filters; -using Microsoft.Extensions.DependencyInjection; using Ombi.Attributes; using Ombi.Core.Settings; +using Ombi.Helpers; +using Ombi.Models.V2; using Ombi.Settings.Settings.Models; -using System; -using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; namespace Ombi.Controllers.V2 @@ -16,20 +13,42 @@ namespace Ombi.Controllers.V2 [AllowAnonymous] public class WizardController : V2Controller { + private ISettingsService _customizationSettings { get; } - private ISettingsService _ombiSettings { get; } - - - [HttpGet] - public IActionResult Ok() + public WizardController(ISettingsService customizationSettings) { - return Ok(); + _customizationSettings = customizationSettings; } + [HttpPost("config")] + [ApiExplorerSettings(IgnoreApi =true)] + public async Task OmbiConfig([FromBody] OmbiConfigModel config) + { + if (config == null) + { + return BadRequest(); + } + var settings = await _customizationSettings.GetSettingsAsync(); + if (config.ApplicationName.HasValue()) + { + settings.ApplicationName = config.ApplicationName; + } - } + if(config.ApplicationUrl.HasValue()) + { + settings.ApplicationUrl = config.ApplicationUrl; + } + if(config.Logo.HasValue()) + { + settings.Logo = config.Logo; + } + await _customizationSettings.SaveSettingsAsync(settings); + + return new OkObjectResult(settings); + } + } } diff --git a/src/Ombi/Models/V2/OmbiConfigModel.cs b/src/Ombi/Models/V2/OmbiConfigModel.cs new file mode 100644 index 000000000..caecdfa2b --- /dev/null +++ b/src/Ombi/Models/V2/OmbiConfigModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Ombi.Models.V2 +{ + public class OmbiConfigModel + { + public string ApplicationName { get; set; } + public string ApplicationUrl { get; set; } + public string Logo { get; set; } + } +} From 440c3635d10e3649ec703d57ee0ba2e719304140 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Sat, 30 Jan 2021 23:41:58 +0000 Subject: [PATCH 4/4] Fixed methodname --- src/Ombi/ClientApp/src/app/wizard/services/wizard.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ombi/ClientApp/src/app/wizard/services/wizard.service.ts b/src/Ombi/ClientApp/src/app/wizard/services/wizard.service.ts index 0990ca384..d39bda9ed 100644 --- a/src/Ombi/ClientApp/src/app/wizard/services/wizard.service.ts +++ b/src/Ombi/ClientApp/src/app/wizard/services/wizard.service.ts @@ -12,7 +12,7 @@ export class WizardService extends ServiceHelpers { super(http, "/api/v2/wizard/", href); } - public async downvoteAlbum(config: IOmbiConfigModel): Promise { + public async addOmbiConfig(config: IOmbiConfigModel): Promise { return await this.http.post(`${this.url}config`, config, {headers: this.headers}).toPromise(); } }