public void Execute(HttpContext httpContext, ContentEntity content)
        {
            if (httpContext == null)
            {
                throw new ArgumentNullException(nameof(httpContext));
            }
            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }

            var ttl = _EksTtlCalculator.Execute(content.Created);

            httpContext.Response.Headers.Add("cache-control", $"public, immutable, max-age={ ttl }, s-maxage={ ttl }");
        }
        private async Task Resign(ContentEntity item)
        {
            await using var db = _ContentDbContext();
            await using var tx = db.BeginTransaction();

            var content = await ReplaceSig(item.Content);

            var e = new ContentEntity
            {
                Created         = item.Created,
                Release         = item.Release,
                ContentTypeName = item.ContentTypeName,
                Content         = content,
                Type            = _ToType,
                PublishingId    = item.PublishingId
            };
            await db.Content.AddAsync(e);

            db.SaveAndCommit();
        }
コード例 #3
0
        public async Task Execute(ContentArgs args)
        {
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }

            var contentBytes = Encoding.UTF8.GetBytes(args.Json);

            var e = new ContentEntity
            {
                Created         = _DateTimeProvider.Snapshot,
                Release         = args.Release,
                Type            = args.ContentType,
                PublishingId    = _PublishingIdService.Create(contentBytes),
                Content         = await _SignedFormatter.SignedContentPacket(contentBytes),
                ContentTypeName = MediaTypeNames.Application.Zip
            };

            await _DbContext.Content.AddAsync(e);
        }