|
|
@ -13,6 +13,7 @@ using Squidex.Domain.Apps.Read.Assets; |
|
|
using Squidex.Domain.Apps.Read.Contents; |
|
|
using Squidex.Domain.Apps.Read.Contents; |
|
|
using Squidex.Domain.Apps.Read.Contents.GraphQL; |
|
|
using Squidex.Domain.Apps.Read.Contents.GraphQL; |
|
|
using Squidex.Domain.Apps.Read.Schemas; |
|
|
using Squidex.Domain.Apps.Read.Schemas; |
|
|
|
|
|
using Squidex.Infrastructure.Assets; |
|
|
|
|
|
|
|
|
// ReSharper disable ConvertIfStatementToReturnStatement
|
|
|
// ReSharper disable ConvertIfStatementToReturnStatement
|
|
|
|
|
|
|
|
|
@ -20,11 +21,17 @@ namespace Squidex.Pipeline |
|
|
{ |
|
|
{ |
|
|
public sealed class GraphQLUrlGenerator : IGraphQLUrlGenerator |
|
|
public sealed class GraphQLUrlGenerator : IGraphQLUrlGenerator |
|
|
{ |
|
|
{ |
|
|
|
|
|
private readonly IAssetStore assetStore; |
|
|
private readonly MyUrlsOptions urlsOptions; |
|
|
private readonly MyUrlsOptions urlsOptions; |
|
|
|
|
|
|
|
|
public GraphQLUrlGenerator(IOptions<MyUrlsOptions> urlsOptions) |
|
|
public bool CanGenerateAssetSourceUrl { get; } |
|
|
|
|
|
|
|
|
|
|
|
public GraphQLUrlGenerator(IOptions<MyUrlsOptions> urlsOptions, IAssetStore assetStore, bool allowAssetSourceUrl) |
|
|
{ |
|
|
{ |
|
|
|
|
|
this.assetStore = assetStore; |
|
|
this.urlsOptions = urlsOptions.Value; |
|
|
this.urlsOptions = urlsOptions.Value; |
|
|
|
|
|
|
|
|
|
|
|
CanGenerateAssetSourceUrl = allowAssetSourceUrl; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public string GenerateAssetThumbnailUrl(IAppEntity appEntity, IAssetEntity assetEntity) |
|
|
public string GenerateAssetThumbnailUrl(IAppEntity appEntity, IAssetEntity assetEntity) |
|
|
@ -46,5 +53,10 @@ namespace Squidex.Pipeline |
|
|
{ |
|
|
{ |
|
|
return urlsOptions.BuildUrl($"api/content/{appEntity.Name}/{schemaEntity.Name}/{contentEntity.Id}"); |
|
|
return urlsOptions.BuildUrl($"api/content/{appEntity.Name}/{schemaEntity.Name}/{contentEntity.Id}"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public string GenerateAssetSourceUrl(IAppEntity appEntity, IAssetEntity assetEntity) |
|
|
|
|
|
{ |
|
|
|
|
|
return assetStore.GenerateSourceUrl(assetEntity.Id.ToString(), assetEntity.FileVersion, null); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|