示例#1
0
 public GridConfig(
     AppCaches appCaches,
     IManifestParser manifestParser,
     IJsonSerializer jsonSerializer,
     IHostingEnvironment hostingEnvironment,
     ILoggerFactory loggerFactory)
 => EditorsConfig =
示例#2
0
 public GridEditorsConfig(AppCaches appCaches, IHostingEnvironment hostingEnvironment, IManifestParser manifestParser, IJsonSerializer jsonSerializer, ILogger <GridEditorsConfig> logger)
 {
     _appCaches          = appCaches;
     _hostingEnvironment = hostingEnvironment;
     _manifestParser     = manifestParser;
     _jsonSerializer     = jsonSerializer;
     _logger             = logger;
 }
示例#3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TelemetryService"/> class.
 /// </summary>
 public TelemetryService(
     IManifestParser manifestParser,
     IUmbracoVersion umbracoVersion,
     ISiteIdentifierService siteIdentifierService)
 {
     _manifestParser        = manifestParser;
     _umbracoVersion        = umbracoVersion;
     _siteIdentifierService = siteIdentifierService;
 }
示例#4
0
    protected override IEnumerable <ISection> CreateItems(IServiceProvider factory)
    {
        // get the manifest parser just-in-time - injecting it in the ctor would mean that
        // simply getting the builder in order to configure the collection, would require
        // its dependencies too, and that can create cycles or other oddities
        IManifestParser manifestParser = factory.GetRequiredService <IManifestParser>();

        return(base.CreateItems(factory).Concat(manifestParser.CombinedManifest.Sections));
    }
示例#5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TelemetryService"/> class.
 /// </summary>
 public TelemetryService(
     IOptionsMonitor <GlobalSettings> globalSettings,
     IManifestParser manifestParser,
     IUmbracoVersion umbracoVersion)
 {
     _manifestParser = manifestParser;
     _umbracoVersion = umbracoVersion;
     _globalSettings = globalSettings;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TelemetryService"/> class.
 /// </summary>
 public TelemetryService(
     IManifestParser manifestParser,
     IUmbracoVersion umbracoVersion,
     ISiteIdentifierService siteIdentifierService,
     IUsageInformationService usageInformationService,
     IMetricsConsentService metricsConsentService)
 {
     _manifestParser          = manifestParser;
     _umbracoVersion          = umbracoVersion;
     _siteIdentifierService   = siteIdentifierService;
     _usageInformationService = usageInformationService;
     _metricsConsentService   = metricsConsentService;
 }
    /// <summary>
    ///     Returns the JavaScript to load the back office's assets
    /// </summary>
    /// <returns></returns>
    public static async Task <string> GetScriptForLoadingBackOfficeAsync(
        this IRuntimeMinifier minifier,
        GlobalSettings globalSettings,
        IHostingEnvironment hostingEnvironment,
        IManifestParser manifestParser)
    {
        var files = new HashSet <string>(StringComparer.InvariantCultureIgnoreCase);

        foreach (var file in await minifier.GetJsAssetPathsAsync(BackOfficeWebAssets.UmbracoCoreJsBundleName))
        {
            files.Add(file);
        }

        foreach (var file in await minifier.GetJsAssetPathsAsync(BackOfficeWebAssets.UmbracoExtensionsJsBundleName))
        {
            files.Add(file);
        }

        // process the independent bundles
        if (manifestParser.CombinedManifest.Scripts.TryGetValue(BundleOptions.Independent,
                                                                out IReadOnlyList <ManifestAssets>?independentManifestAssetsList))
        {
            foreach (ManifestAssets manifestAssets in independentManifestAssetsList)
            {
                var bundleName =
                    BackOfficeWebAssets.GetIndependentPackageBundleName(manifestAssets, AssetType.Javascript);
                foreach (var asset in await minifier.GetJsAssetPathsAsync(bundleName))
                {
                    files.Add(asset);
                }
            }
        }

        // process the "None" bundles, meaning we'll just render the script as-is
        foreach (var asset in await minifier.GetJsAssetPathsAsync(BackOfficeWebAssets
                                                                  .UmbracoNonOptimizedPackageJsBundleName))
        {
            files.Add(asset);
        }

        var result = BackOfficeJavaScriptInitializer.GetJavascriptInitialization(
            files,
            "umbraco",
            globalSettings,
            hostingEnvironment);

        result += await GetStylesheetInitializationAsync(minifier, manifestParser);

        return(result);
    }
 public BackOfficeWebAssets(
     IRuntimeMinifier runtimeMinifier,
     IManifestParser parser,
     PropertyEditorCollection propertyEditorCollection,
     IHostingEnvironment hostingEnvironment,
     IOptions <GlobalSettings> globalSettings,
     CustomBackOfficeAssetsCollection customBackOfficeAssetsCollection)
 {
     _runtimeMinifier                  = runtimeMinifier;
     _parser                           = parser;
     _propertyEditorCollection         = propertyEditorCollection;
     _hostingEnvironment               = hostingEnvironment;
     _globalSettings                   = globalSettings.Value;
     _customBackOfficeAssetsCollection = customBackOfficeAssetsCollection;
 }
示例#9
0
 public PackagingService(
     IAuditService auditService,
     ICreatedPackagesRepository createdPackages,
     IPackageInstallation packageInstallation,
     IEventAggregator eventAggregator,
     IManifestParser manifestParser,
     IKeyValueService keyValueService,
     PackageMigrationPlanCollection packageMigrationPlans)
 {
     _auditService          = auditService;
     _createdPackages       = createdPackages;
     _packageInstallation   = packageInstallation;
     _eventAggregator       = eventAggregator;
     _manifestParser        = manifestParser;
     _keyValueService       = keyValueService;
     _packageMigrationPlans = packageMigrationPlans;
 }
示例#10
0
 public BackOfficeController(
     IBackOfficeUserManager userManager,
     IRuntimeState runtimeState,
     IRuntimeMinifier runtimeMinifier,
     IOptionsSnapshot <GlobalSettings> globalSettings,
     IHostingEnvironment hostingEnvironment,
     ILocalizedTextService textService,
     IGridConfig gridConfig,
     BackOfficeServerVariables backOfficeServerVariables,
     AppCaches appCaches,
     IBackOfficeSignInManager signInManager,
     IBackOfficeSecurityAccessor backofficeSecurityAccessor,
     ILogger <BackOfficeController> logger,
     IJsonSerializer jsonSerializer,
     IBackOfficeExternalLoginProviders externalLogins,
     IHttpContextAccessor httpContextAccessor,
     IBackOfficeTwoFactorOptions backOfficeTwoFactorOptions,
     IManifestParser manifestParser,
     ServerVariablesParser serverVariables,
     IOptions <SecuritySettings> securitySettings)
 {
     _userManager               = userManager;
     _runtimeState              = runtimeState;
     _runtimeMinifier           = runtimeMinifier;
     _globalSettings            = globalSettings.Value;
     _hostingEnvironment        = hostingEnvironment;
     _textService               = textService;
     _gridConfig                = gridConfig ?? throw new ArgumentNullException(nameof(gridConfig));
     _backOfficeServerVariables = backOfficeServerVariables;
     _appCaches     = appCaches;
     _signInManager = signInManager;
     _backofficeSecurityAccessor = backofficeSecurityAccessor;
     _logger                     = logger;
     _jsonSerializer             = jsonSerializer;
     _externalLogins             = externalLogins;
     _httpContextAccessor        = httpContextAccessor;
     _backOfficeTwoFactorOptions = backOfficeTwoFactorOptions;
     _manifestParser             = manifestParser;
     _serverVariables            = serverVariables;
     _securitySettings           = securitySettings;
 }
 public BackOfficeController(
     IBackOfficeUserManager userManager,
     IRuntimeState runtimeState,
     IRuntimeMinifier runtimeMinifier,
     IOptions <GlobalSettings> globalSettings,
     IHostingEnvironment hostingEnvironment,
     ILocalizedTextService textService,
     IGridConfig gridConfig,
     BackOfficeServerVariables backOfficeServerVariables,
     AppCaches appCaches,
     IBackOfficeSignInManager signInManager,
     IBackOfficeSecurityAccessor backofficeSecurityAccessor,
     ILogger <BackOfficeController> logger,
     IJsonSerializer jsonSerializer,
     IBackOfficeExternalLoginProviders externalLogins,
     IHttpContextAccessor httpContextAccessor,
     IBackOfficeTwoFactorOptions backOfficeTwoFactorOptions,
     IManifestParser manifestParser,
     ServerVariablesParser serverVariables)
     : this(userManager,
            runtimeState,
            runtimeMinifier,
            globalSettings,
            hostingEnvironment,
            textService,
            gridConfig,
            backOfficeServerVariables,
            appCaches,
            signInManager,
            backofficeSecurityAccessor,
            logger,
            jsonSerializer,
            externalLogins,
            httpContextAccessor,
            backOfficeTwoFactorOptions,
            manifestParser,
            serverVariables,
            StaticServiceProvider.Instance.GetRequiredService <IOptions <SecuritySettings> >()
            )
 {
 }
    /// <summary>
    ///     Gets the back office css bundle paths and formats a JS call to lazy load them
    /// </summary>
    private static async Task <string> GetStylesheetInitializationAsync(
        IRuntimeMinifier minifier,
        IManifestParser manifestParser)
    {
        var files = new HashSet <string>(StringComparer.InvariantCultureIgnoreCase);

        foreach (var file in await minifier.GetCssAssetPathsAsync(BackOfficeWebAssets.UmbracoCssBundleName))
        {
            files.Add(file);
        }

        // process the independent bundles
        if (manifestParser.CombinedManifest.Stylesheets.TryGetValue(BundleOptions.Independent,
                                                                    out IReadOnlyList <ManifestAssets>?independentManifestAssetsList))
        {
            foreach (ManifestAssets manifestAssets in independentManifestAssetsList)
            {
                var bundleName = BackOfficeWebAssets.GetIndependentPackageBundleName(manifestAssets, AssetType.Css);
                foreach (var asset in await minifier.GetCssAssetPathsAsync(bundleName))
                {
                    files.Add(asset);
                }
            }
        }

        // process the "None" bundles, meaning we'll just render the script as-is
        foreach (var asset in await minifier.GetCssAssetPathsAsync(BackOfficeWebAssets
                                                                   .UmbracoNonOptimizedPackageCssBundleName))
        {
            files.Add(asset);
        }

        var sb = new StringBuilder();

        foreach (var file in files)
        {
            sb.AppendFormat("{0}LazyLoad.css('{1}');", Environment.NewLine, file);
        }

        return(sb.ToString());
    }
 public ParameterEditorCollection(DataEditorCollection dataEditors, IManifestParser manifestParser)
     : base(() => dataEditors
            .Where(x => (x.Type & EditorType.MacroParameter) > 0)
            .Union(manifestParser.CombinedManifest.PropertyEditors))
 {
 }
 public PackageResolver()
 {
     _manifestParser = new ManifestParser();
 }
示例#15
0
 public GridConfig(AppCaches appCaches, IManifestParser manifestParser, IJsonSerializer jsonSerializer, IHostingEnvironment hostingEnvironment, ILoggerFactory loggerFactory)
 {
     EditorsConfig = new GridEditorsConfig(appCaches, hostingEnvironment, manifestParser, jsonSerializer, loggerFactory.CreateLogger <GridEditorsConfig>());
 }