@@ -24,54 +24,48 @@ public class DasBlogSettings : IDasBlogSettings
2424 {
2525 private readonly string siteSecurityConfigFilePath ;
2626 private readonly ConfigFilePathsDataOption filePathDataOptions ;
27-
27+ private readonly IOptionsMonitor < SiteConfig > siteConfigMonitor ;
28+ private readonly IOptionsMonitor < MetaTags > metaTagsMonitor ;
29+ private readonly IOptionsMonitor < OEmbedProviders > embedProvidersMonitor ;
30+
2831 public DasBlogSettings ( IWebHostEnvironment env , IOptionsMonitor < SiteConfig > siteConfig , IOptionsMonitor < MetaTags > metaTagsConfig ,
29- IOptionsMonitor < OEmbedProviders > embedProvidersConfig ,
32+ IOptionsMonitor < OEmbedProviders > embedProvidersConfig ,
3033 ISiteSecurityConfig siteSecurityConfig , IOptions < ConfigFilePathsDataOption > optionsAccessor )
3134 {
3235 WebRootDirectory = env . ContentRootPath ;
33- SiteConfiguration = siteConfig . CurrentValue ;
34- OEmbedProviders = embedProvidersConfig . CurrentValue ;
36+ siteConfigMonitor = siteConfig ;
37+ metaTagsMonitor = metaTagsConfig ;
38+ embedProvidersMonitor = embedProvidersConfig ;
3539 SecurityConfiguration = siteSecurityConfig ;
36- MetaTags = metaTagsConfig . CurrentValue ;
3740 filePathDataOptions = optionsAccessor . Value ;
3841
39- RssUrl = RelativeToRoot ( "feed/rss" ) ;
40- PingBackUrl = RelativeToRoot ( "feed/pingback" ) ;
41- CategoryUrl = RelativeToRoot ( "category" ) ;
42- ArchiveUrl = RelativeToRoot ( "archive" ) ;
43- MicroSummaryUrl = RelativeToRoot ( "site/microsummary" ) ;
44- RsdUrl = RelativeToRoot ( "feed/rsd" ) ;
45- ShortCutIconUrl = RelativeToRoot ( string . Format ( "theme/{0}/favicon.ico" , SiteConfiguration . Theme ) ) ;
46- ThemeCssUrl = RelativeToRoot ( string . Format ( "theme/{0}/custom.css" , SiteConfiguration . Theme ) ) ;
47-
4842 siteSecurityConfigFilePath = filePathDataOptions . SecurityConfigFilePath ;
4943 }
5044
5145 public string WebRootDirectory { get ; }
5246
53- public string PingBackUrl { get ; }
47+ public string PingBackUrl => RelativeToRoot ( "feed/pingback" ) ;
48+
49+ public string RssUrl => RelativeToRoot ( "feed/rss" ) ;
5450
55- public string RssUrl { get ; }
51+ public string CategoryUrl => RelativeToRoot ( "category" ) ;
5652
57- public string CategoryUrl { get ; }
53+ public string ArchiveUrl => RelativeToRoot ( "archive" ) ;
5854
59- public string ArchiveUrl { get ; }
55+ public string MicroSummaryUrl => RelativeToRoot ( "site/microsummary" ) ;
6056
61- public string MicroSummaryUrl { get ; }
57+ public string RsdUrl => RelativeToRoot ( "feed/rsd" ) ;
6258
63- public string RsdUrl { get ; }
59+ public string ShortCutIconUrl => RelativeToRoot ( string . Format ( "theme/{0}/favicon.ico" , SiteConfiguration . Theme ) ) ;
6460
65- public string ShortCutIconUrl { get ; }
61+ public string ThemeCssUrl => RelativeToRoot ( string . Format ( "theme/{0}/custom.css" , SiteConfiguration . Theme ) ) ;
6662
67- public string ThemeCssUrl { get ; }
68-
69- public IMetaTags MetaTags { get ; set ; }
63+ public IMetaTags MetaTags => metaTagsMonitor . CurrentValue ;
7064
71- public ISiteConfig SiteConfiguration { get ; set ; }
65+ public ISiteConfig SiteConfiguration => siteConfigMonitor . CurrentValue ;
7266
7367 public ISiteSecurityConfig SecurityConfiguration { get ; }
74- public IOEmbedProviders OEmbedProviders { get ; set ; }
68+ public IOEmbedProviders OEmbedProviders => embedProvidersMonitor . CurrentValue ;
7569
7670 private static Regex htmlFilterRegex = new Regex ( "<(?<end>/)?(?<name>\\ w+)((\\ s+(?<attNameValue>(?<attName>\\ w+)(\\ s*=\\ s*(?:\" (?<attVal>[^\" ]*)\" |'(?<attVal>[^']*)'|(?<attVal>[^'\" >\\ s]+)))?))+\\ s*|\\ s*)(?<self>/)?>" ,
7771 RegexOptions . CultureInvariant | RegexOptions . IgnoreCase | RegexOptions . Multiline | RegexOptions . Compiled ) ;
0 commit comments