You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Ombi/src/Ombi.Settings/Settings/Models/CustomizationSettings.cs

71 lines
2.0 KiB

using System;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using Ombi.Helpers;
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 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))
{
ApplicationUrl = part;
}
if (ApplicationUrl.EndsWith("/"))
{
ApplicationUrl.Remove(ApplicationUrl.Length - 1);
}
if (!part.StartsWith("/"))
{
part = "/" + part;
}
ApplicationUrl = ApplicationUrl + part;
}
}
}