2020-12-06 10:46:04 +01:00
// Copyright (c) Umbraco.
// See LICENSE for more details.
2021-07-05 14:27:49 +01:00
using System.ComponentModel ;
2020-03-16 14:02:08 +01:00
2022-06-07 15:28:38 +02:00
namespace Umbraco.Cms.Core.Configuration.Models ;
/// <summary>
/// Typed configuration options for content settings.
/// </summary>
[UmbracoOptions(Constants.Configuration.ConfigContent)]
public class ContentSettings
2020-03-16 14:02:08 +01:00
{
2022-06-07 15:28:38 +02:00
internal const bool StaticResolveUrlsFromTextString = false ;
2021-07-05 14:27:49 +01:00
2024-05-21 10:13:26 +01:00
internal const string StaticDefaultPreviewBadge = @ "
< script src = "" { 0 } / website / preview . js "" > < / script >
< umb - website - preview path = "" { 0 } "" url = "" { 1 } "" unique = "" { 2 } "" > < / umb - website - preview > ";
2020-03-18 11:29:29 +01:00
2022-06-07 15:28:38 +02:00
internal const string StaticDisallowedUploadFiles = "ashx,aspx,ascx,config,cshtml,vbhtml,asmx,air,axd,xamlx" ;
internal const bool StaticShowDeprecatedPropertyEditors = false ;
2024-12-05 12:21:33 +01:00
internal const string StaticLoginBackgroundImage = "assets/login.jpg" ;
internal const string StaticLoginLogoImage = "assets/logo_light.svg" ;
internal const string StaticLoginLogoImageAlternative = "assets/logo_dark.svg" ;
internal const string StaticBackOfficeLogo = "assets/logo.svg" ;
2022-06-07 15:28:38 +02:00
internal const bool StaticHideBackOfficeLogo = false ;
internal const bool StaticDisableDeleteWhenReferenced = false ;
internal const bool StaticDisableUnpublishWhenReferenced = false ;
2022-09-07 14:38:54 +02:00
internal const bool StaticAllowEditInvariantFromNonDefault = false ;
2023-03-13 14:04:16 +01:00
internal const bool StaticShowDomainWarnings = true ;
2025-01-08 09:14:14 +01:00
internal const bool StaticShowUnroutableContentWarnings = true ;
2022-06-07 15:28:38 +02:00
/// <summary>
/// Gets or sets a value for the content notification settings.
/// </summary>
public ContentNotificationSettings Notifications { get ; set ; } = new ( ) ;
/// <summary>
/// Gets or sets a value for the content imaging settings.
/// </summary>
public ContentImagingSettings Imaging { get ; set ; } = new ( ) ;
/// <summary>
/// Gets or sets a value indicating whether URLs should be resolved from text strings.
/// </summary>
[DefaultValue(StaticResolveUrlsFromTextString)]
public bool ResolveUrlsFromTextString { get ; set ; } = StaticResolveUrlsFromTextString ;
/// <summary>
/// Gets or sets a value for the collection of error pages.
/// </summary>
public ContentErrorPage [ ] Error404Collection { get ; set ; } = Array . Empty < ContentErrorPage > ( ) ;
/// <summary>
/// Gets or sets a value for the preview badge mark-up.
/// </summary>
[DefaultValue(StaticDefaultPreviewBadge)]
public string PreviewBadge { get ; set ; } = StaticDefaultPreviewBadge ;
/// <summary>
/// Gets or sets a value indicating whether deprecated property editors should be shown.
/// </summary>
[DefaultValue(StaticShowDeprecatedPropertyEditors)]
public bool ShowDeprecatedPropertyEditors { get ; set ; } = StaticShowDeprecatedPropertyEditors ;
/// <summary>
/// Gets or sets a value for the path to the login screen background image.
/// </summary>
[DefaultValue(StaticLoginBackgroundImage)]
public string LoginBackgroundImage { get ; set ; } = StaticLoginBackgroundImage ;
/// <summary>
2023-11-18 02:53:58 +13:00
/// Gets or sets a value for the path to the login screen logo image
/// shown on top of the background image set in <see cref="LoginBackgroundImage" />.
2022-06-07 15:28:38 +02:00
/// </summary>
2023-11-18 02:53:58 +13:00
/// <remarks>The alternative version of this logo can be found at <see cref="LoginLogoImageAlternative"/>.</remarks>
2022-06-07 15:28:38 +02:00
[DefaultValue(StaticLoginLogoImage)]
public string LoginLogoImage { get ; set ; } = StaticLoginLogoImage ;
2023-11-18 02:53:58 +13:00
/// <summary>
/// Gets or sets a value for the path to the login screen logo image when shown on top
/// of a light background (e.g. in mobile resolutions).
/// </summary>
/// <remarks>This is the alternative version to the regular logo found at <see cref="LoginLogoImage"/>.</remarks>
2024-05-23 15:14:23 +02:00
[DefaultValue(StaticLoginLogoImageAlternative)]
public string LoginLogoImageAlternative { get ; set ; } = StaticLoginLogoImageAlternative ;
2023-11-18 02:53:58 +13:00
2024-12-05 12:21:33 +01:00
/// <summary>
/// Gets or sets a value for the path to the backoffice logo.
/// </summary>
[DefaultValue(StaticBackOfficeLogo)]
public string BackOfficeLogo { get ; set ; } = StaticBackOfficeLogo ;
2022-06-07 15:28:38 +02:00
/// <summary>
/// Gets or sets a value indicating whether to hide the backoffice umbraco logo or not.
/// </summary>
[DefaultValue(StaticHideBackOfficeLogo)]
2024-12-05 12:21:33 +01:00
[Obsolete("This setting is no longer used and will be removed in future versions. An alternative BackOffice logo can be set using the BackOfficeLogo setting.")]
2022-06-07 15:28:38 +02:00
public bool HideBackOfficeLogo { get ; set ; } = StaticHideBackOfficeLogo ;
/// <summary>
/// Gets or sets a value indicating whether to disable the deletion of items referenced by other items.
/// </summary>
[DefaultValue(StaticDisableDeleteWhenReferenced)]
public bool DisableDeleteWhenReferenced { get ; set ; } = StaticDisableDeleteWhenReferenced ;
/// <summary>
/// Gets or sets a value indicating whether to disable the unpublishing of items referenced by other items.
/// </summary>
[DefaultValue(StaticDisableUnpublishWhenReferenced)]
public bool DisableUnpublishWhenReferenced { get ; set ; } = StaticDisableUnpublishWhenReferenced ;
/// <summary>
2023-07-17 21:52:04 +02:00
/// Gets or sets the model representing the global content version cleanup policy
2022-06-07 15:28:38 +02:00
/// </summary>
public ContentVersionCleanupPolicySettings ContentVersionCleanupPolicy { get ; set ; } = new ( ) ;
2022-09-07 14:38:54 +02:00
/// <summary>
/// Gets or sets a value indicating whether to allow editing invariant properties from a non-default language variation.
/// </summary>
[DefaultValue(StaticAllowEditInvariantFromNonDefault)]
public bool AllowEditInvariantFromNonDefault { get ; set ; } = StaticAllowEditInvariantFromNonDefault ;
2022-11-17 09:43:57 +01:00
/// <summary>
/// Gets or sets a value for the collection of file extensions that are allowed for upload.
/// </summary>
public string [ ] AllowedUploadedFileExtensions { get ; set ; } = Array . Empty < string > ( ) ;
/// <summary>
/// Gets or sets a value for the collection of file extensions that are disallowed for upload.
/// </summary>
[DefaultValue(StaticDisallowedUploadFiles)]
public string [ ] DisallowedUploadedFileExtensions { get ; set ; } = StaticDisallowedUploadFiles . Split ( ',' ) ;
2023-03-01 15:17:08 +01:00
/// <summary>
/// Gets or sets the allowed external host for media. If empty only relative paths are allowed.
/// </summary>
public string [ ] AllowedMediaHosts { get ; set ; } = Array . Empty < string > ( ) ;
2023-03-13 14:04:16 +01:00
/// <summary>
/// Gets or sets a value indicating whether to show domain warnings.
/// </summary>
[DefaultValue(StaticShowDomainWarnings)]
public bool ShowDomainWarnings { get ; set ; } = StaticShowDomainWarnings ;
2025-01-08 09:14:14 +01:00
/// <summary>
/// Gets or sets a value indicating whether to show unroutable content warnings.
/// </summary>
[DefaultValue(StaticShowUnroutableContentWarnings)]
public bool ShowUnroutableContentWarnings { get ; set ; } = StaticShowUnroutableContentWarnings ;
2020-03-16 14:02:08 +01:00
}