<commit_before>﻿using System;
using Microsoft.Extensions.Logging;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using BTCPayServer.Logging;
using Microsoft.Extensions.Hosting;
using NBXplorer;
using NBXplorer.Models;
using System.Collections.Concurrent;
using BTCPayServer.Events;
using BTCPayServer.Services;

namespace BTCPayServer.HostedServices
{
    public class CssThemeManager
    {
        public CssThemeManager(SettingsRepository settingsRepository)
        {
            Update(settingsRepository);
        }

        private async void Update(SettingsRepository settingsRepository)
        {
            var data = (await settingsRepository.GetSettingAsync<PoliciesSettings>()) ?? new PoliciesSettings();
            Update(data);
        }

        public void Update(PoliciesSettings data)
        {
            UpdateBootstrap(data.BootstrapCssUri);
            UpdateCreativeStart(data.CreativeStartCssUri);
        } 

        private string _bootstrapUri;
        public string BootstrapUri
        {
            get { return _bootstrapUri; }
        }
        public void UpdateBootstrap(string newUri)
        {
            if (String.IsNullOrWhiteSpace(newUri))
                _bootstrapUri = "/vendor/bootstrap4/css/bootstrap.css";
            else
                _bootstrapUri = newUri;
        }

        private string _creativeStartUri;
        public string CreativeStartUri
        {
            get { return _creativeStartUri; }
        }
        public void UpdateCreativeStart(string newUri)
        {
            if (String.IsNullOrWhiteSpace(newUri))
                _creativeStartUri = "/vendor/bootstrap4-creativestart/creative.css";
            else
                _creativeStartUri = newUri;
        }
    }
}<commit_msg>Primitive versioning of css files to ensure update on change<commit_after>﻿using System;
using Microsoft.Extensions.Logging;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using BTCPayServer.Logging;
using Microsoft.Extensions.Hosting;
using NBXplorer;
using NBXplorer.Models;
using System.Collections.Concurrent;
using BTCPayServer.Events;
using BTCPayServer.Services;

namespace BTCPayServer.HostedServices
{
    public class CssThemeManager
    {
        public CssThemeManager(SettingsRepository settingsRepository)
        {
            Update(settingsRepository);
        }

        private async void Update(SettingsRepository settingsRepository)
        {
            var data = (await settingsRepository.GetSettingAsync<PoliciesSettings>()) ?? new PoliciesSettings();
            Update(data);
        }

        public void Update(PoliciesSettings data)
        {
            UpdateBootstrap(data.BootstrapCssUri);
            UpdateCreativeStart(data.CreativeStartCssUri);
        } 

        private string _bootstrapUri = "/vendor/bootstrap4/css/bootstrap.css?v=" + DateTime.Now.Ticks;
        public string BootstrapUri
        {
            get { return _bootstrapUri; }
        }
        public void UpdateBootstrap(string newUri)
        {
            if (String.IsNullOrWhiteSpace(newUri))
                _bootstrapUri = "/vendor/bootstrap4/css/bootstrap.css?v="+ DateTime.Now.Ticks;
            else
                _bootstrapUri = newUri;
        }

        private string _creativeStartUri = "/vendor/bootstrap4-creativestart/creative.css?v=" + DateTime.Now.Ticks;
        public string CreativeStartUri
        {
            get { return _creativeStartUri; }
        }
        public void UpdateCreativeStart(string newUri)
        {
            if (String.IsNullOrWhiteSpace(newUri))
                _creativeStartUri = "/vendor/bootstrap4-creativestart/creative.css?v=" + DateTime.Now.Ticks;
            else
                _creativeStartUri = newUri;
        }
    }
}
{'fraction_non_alphanumeric': 0.07583182873355687, 'fraction_numerical': 0.0015475883415011606, 'mean_word_length': 2.404741000877963, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2550117', 'n_tokens_mistral': 1022, 'n_tokens_neox': 1014, 'n_words': 201}