Example #1
0
        private string GetContent()
        {
            if (RuntimeInfo.IsProduction && _generatedContent != null)
            {
                return(_generatedContent);
            }

            var builder = new StringBuilder();

            builder.AppendLine("window.Lidarr = {");
            builder.AppendLine($"  apiRoot: '{_urlBase}/api/v1',");
            builder.AppendLine($"  apiKey: '{_apiKey}',");
            builder.AppendLine($"  release: '{BuildInfo.Release}',");
            builder.AppendLine($"  version: '{BuildInfo.Version.ToString()}',");
            builder.AppendLine($"  branch: '{_configFileProvider.Branch.ToLower()}',");
            builder.AppendLine($"  analytics: {_analyticsService.IsEnabled.ToString().ToLowerInvariant()},");
            builder.AppendLine($"  userHash: '{HashUtil.AnonymousToken()}',");
            builder.AppendLine($"  urlBase: '{_urlBase}',");
            builder.AppendLine($"  isProduction: {RuntimeInfo.IsProduction.ToString().ToLowerInvariant()}");
            builder.AppendLine("};");

            _generatedContent = builder.ToString();

            return(_generatedContent);
        }
Example #2
0
        public void InitializeScope()
        {
            SentrySdk.ConfigureScope(scope =>
            {
                scope.User = new User
                {
                    Id = HashUtil.AnonymousToken()
                };

                scope.Contexts.App.Name      = BuildInfo.AppName;
                scope.Contexts.App.Version   = BuildInfo.Version.ToString();
                scope.Contexts.App.StartTime = _startTime;
                scope.Contexts.App.Hash      = HashUtil.AnonymousToken();
                scope.Contexts.App.Build     = BuildInfo.Release; // Git commit cache?

                scope.SetTag("culture", Thread.CurrentThread.CurrentCulture.Name);
                scope.SetTag("branch", BuildInfo.Branch);
            });
        }
Example #3
0
 public void should_create_the_same_id()
 {
     HashUtil.AnonymousToken().Should().Be(HashUtil.AnonymousToken());
 }
Example #4
0
 public void should_create_anon_id()
 {
     HashUtil.AnonymousToken().Should().NotBeNullOrEmpty();
 }
Example #5
0
 public SentryUser Create()
 {
     return(new SentryUser(HashUtil.AnonymousToken()));
 }