diff --git a/src/Ombi.Api.Github/GithubApi.cs b/src/Ombi.Api.Github/GithubApi.cs index f7b3fbcbf..6865b33fe 100644 --- a/src/Ombi.Api.Github/GithubApi.cs +++ b/src/Ombi.Api.Github/GithubApi.cs @@ -24,16 +24,5 @@ namespace Ombi.Api.Github request.AddHeader("User-Agent", "Ombi"); return await _api.Request>(request); } - - public async Task GetThemesRawContent(string url) - { - var sections = url.Split('/'); - var lastPart = sections.Last(); - url = url.Replace(lastPart, string.Empty); - var request = new Request(lastPart, url, HttpMethod.Get); - request.AddHeader("Accept", "application/vnd.github.v3+json"); - request.AddHeader("User-Agent", "Ombi"); - return await _api.RequestContent(request); - } } } diff --git a/src/Ombi.Api.Github/IGithubApi.cs b/src/Ombi.Api.Github/IGithubApi.cs index 307158b72..1cca37f02 100644 --- a/src/Ombi.Api.Github/IGithubApi.cs +++ b/src/Ombi.Api.Github/IGithubApi.cs @@ -7,6 +7,5 @@ namespace Ombi.Api.Github public interface IGithubApi { Task> GetCakeThemes(); - Task GetThemesRawContent(string url); } } \ No newline at end of file diff --git a/src/Ombi.Settings/Settings/Models/CustomizationSettings.cs b/src/Ombi.Settings/Settings/Models/CustomizationSettings.cs index 120c14bd8..6c18c712f 100644 --- a/src/Ombi.Settings/Settings/Models/CustomizationSettings.cs +++ b/src/Ombi.Settings/Settings/Models/CustomizationSettings.cs @@ -1,55 +1,16 @@ -using System; -using System.ComponentModel.DataAnnotations.Schema; -using Newtonsoft.Json; -using Ombi.Helpers; - -namespace Ombi.Settings.Settings.Models +namespace Ombi.Settings.Settings.Models { public class CustomizationSettings : Settings { public string ApplicationName { get; set; } public string ApplicationUrl { get; set; } - public string CustomCssLink { get; set; } + public string CustomCss { get; set; } public bool EnableCustomDonations { get; set; } public string CustomDonationUrl { get; set; } public string CustomDonationMessage { get; set; } public string Logo { get; set; } - - public string PresetThemeName { get; set; } - public string PresetThemeContent { get; set; } public bool RecentlyAddedPage { get; set; } - [NotMapped] - public string PresetThemeVersion - { - get - { - if (HasPresetTheme) - { - var parts = PresetThemeName.Split('-'); - return parts[3].Replace(".css", string.Empty); - } - return string.Empty; - } - } - - [NotMapped] - public string PresetThemeDisplayName - { - get - { - if (HasPresetTheme) - { - var parts = PresetThemeName.Split('-'); - return parts[1]; - } - return string.Empty; - } - } - - [NotMapped] - public bool HasPresetTheme => PresetThemeName.HasValue() || PresetThemeContent.HasValue(); - public void AddToUrl(string part) { if (string.IsNullOrEmpty(ApplicationUrl)) diff --git a/src/Ombi/ClientApp/app/interfaces/ISettings.ts b/src/Ombi/ClientApp/app/interfaces/ISettings.ts index 979ef2310..e74e10883 100644 --- a/src/Ombi/ClientApp/app/interfaces/ISettings.ts +++ b/src/Ombi/ClientApp/app/interfaces/ISettings.ts @@ -114,25 +114,13 @@ export interface ICustomizationSettings extends ISettings { applicationName: string; applicationUrl: string; logo: string; - customCssLink: string; + customCss: string; enableCustomDonations: boolean; customDonationUrl: string; customDonationMessage: string; - hasPresetTheme: boolean; - presetThemeName: string; - presetThemeContent: string; - presetThemeDisplayName: string; - presetThemeVersion: string; recentlyAddedPage: boolean; } -export interface IThemes { - fullName: string; - displayName: string; - version: string; - url: string; -} - export interface IJobSettings { embyContentSync: string; sonarrSync: string; diff --git a/src/Ombi/ClientApp/app/services/settings.service.ts b/src/Ombi/ClientApp/app/services/settings.service.ts index 7feee1996..0994cf6d8 100644 --- a/src/Ombi/ClientApp/app/services/settings.service.ts +++ b/src/Ombi/ClientApp/app/services/settings.service.ts @@ -31,7 +31,6 @@ import { ISlackNotificationSettings, ISonarrSettings, ITelegramNotifcationSettings, - IThemes, IUpdateSettings, IUserManagementSettings, IVoteSettings, @@ -135,14 +134,6 @@ export class SettingsService extends ServiceHelpers { return this.http.post(`${this.url}/customization`, JSON.stringify(settings), {headers: this.headers}); } - public getThemes(): Observable { - return this.http.get(`${this.url}/themes`, {headers: this.headers}); - } - - public getThemeContent(themeUrl: string): Observable { - return this.http.get(`${this.url}/themecontent?url=${themeUrl}`, {responseType: "text", headers: this.headers}); - } - public getEmailNotificationSettings(): Observable { return this.http.get(`${this.url}/notifications/email`, {headers: this.headers}); } diff --git a/src/Ombi/ClientApp/app/settings/customization/customization.component.html b/src/Ombi/ClientApp/app/settings/customization/customization.component.html index 9d05edf1f..32d91aed9 100644 --- a/src/Ombi/ClientApp/app/settings/customization/customization.component.html +++ b/src/Ombi/ClientApp/app/settings/customization/customization.component.html @@ -47,15 +47,6 @@ - -
- -
- -
-
-
@@ -63,7 +54,7 @@
-
+
-
+
-
+
- -
- -
+
-
- +
+
- Preset themes are powered by - layer#Cake. -
diff --git a/src/Ombi/ClientApp/app/settings/customization/customization.component.ts b/src/Ombi/ClientApp/app/settings/customization/customization.component.ts index 098a6f5cc..0daf9ffad 100644 --- a/src/Ombi/ClientApp/app/settings/customization/customization.component.ts +++ b/src/Ombi/ClientApp/app/settings/customization/customization.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from "@angular/core"; -import { ICustomizationSettings, IThemes } from "../../interfaces"; +import { ICustomizationSettings } from "../../interfaces"; import { NotificationService } from "../../services"; import { SettingsService } from "../../services"; @@ -10,7 +10,6 @@ import { SettingsService } from "../../services"; export class CustomizationComponent implements OnInit { public settings: ICustomizationSettings; - public themes: IThemes[]; public advanced: boolean; constructor(private settingsService: SettingsService, private notificationService: NotificationService) { } @@ -18,26 +17,6 @@ export class CustomizationComponent implements OnInit { public ngOnInit() { this.settingsService.getCustomization().subscribe(x => { this.settings = x; - this.settingsService.getThemes().subscribe(t => { - this.themes = t; - - const existingTheme = this.themes.filter((item) => { - return item.fullName === this.settings.presetThemeName; - })[0]; - - if (existingTheme) { - const index = this.themes.indexOf(existingTheme, 0); - if (index > -1) { - this.themes.splice(index, 1); - } - } - if (x.hasPresetTheme) { - this.themes.unshift({displayName: x.presetThemeDisplayName, fullName: x.presetThemeName, url: existingTheme.url, version: x.presetThemeVersion}); - this.themes.unshift({displayName: "None", fullName: "None", url: "", version: ""}); - } else { - this.themes.unshift({displayName: "Please Select", fullName: "-1", url: "-1", version: ""}); - } - }); }); } @@ -62,26 +41,4 @@ export class CustomizationComponent implements OnInit { }); } - - public dropDownChange(event: any): void { - const selectedThemeFullName = event.target.value; - const selectedTheme = this.themes.filter((val) => { - return val.fullName === selectedThemeFullName; - })[0]; - - if (selectedTheme.fullName === this.settings.presetThemeName) { - return; - } - - if (selectedTheme.fullName === "None" || selectedTheme.fullName === "-1") { - this.settings.presetThemeName = ""; - this.settings.presetThemeContent = ""; - return; - } - - this.settings.presetThemeName = selectedThemeFullName; - this.settingsService.getThemeContent(selectedTheme.url).subscribe(x => { - this.settings.presetThemeContent = x; - }); - } } diff --git a/src/Ombi/Controllers/SettingsController.cs b/src/Ombi/Controllers/SettingsController.cs index 338b55f21..6b9476ce6 100644 --- a/src/Ombi/Controllers/SettingsController.cs +++ b/src/Ombi/Controllers/SettingsController.cs @@ -274,19 +274,6 @@ namespace Ombi.Controllers return model; } - /// - /// Gets the content of the theme available - /// - /// - /// - [HttpGet("themecontent")] - [AllowAnonymous] - public async Task GetThemeContent([FromQuery]string url) - { - var css = await _githubApi.GetThemesRawContent(url); - return Content(css, "text/css"); - } - /// /// Gets the Sonarr Settings. /// diff --git a/src/Ombi/Views/Shared/_Layout.cshtml b/src/Ombi/Views/Shared/_Layout.cshtml index 85b8adfd7..0ae4bfcfa 100644 --- a/src/Ombi/Views/Shared/_Layout.cshtml +++ b/src/Ombi/Views/Shared/_Layout.cshtml @@ -1,4 +1,5 @@ @using Ombi.Core.Settings +@using Ombi.Helpers @using Ombi.Settings.Settings.Models @inject ISettingsService Settings @inject ISettingsService CustomizationSettings @@ -105,29 +106,12 @@ @{ - if (customization.HasPresetTheme) + if (customization.CustomCss.HasValue()) { - if (!string.IsNullOrEmpty(baseUrl)) - { - if (!customization.PresetThemeContent.Contains("/" + baseUrl)) - { - var index = customization.PresetThemeContent.IndexOf("/api/"); - if (index > 0) - { - customization.PresetThemeContent = customization.PresetThemeContent.Insert(index, "/" + baseUrl); - } - } - } - - } - - if (!string.IsNullOrEmpty(customization.CustomCssLink)) - { - - } } @RenderBody()