Browse Source

Feature/webp (#798)

* Webp support.

* Temporary test.

* Increase scripting timeouts for tests.

* No quotes.
pull/800/head
Sebastian Stehle 4 years ago
committed by GitHub
parent
commit
b4584c7084
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/JintScriptEngine.cs
  2. 4
      backend/src/Squidex.Infrastructure/Commands/DomainObjectGrainFormatter.cs
  3. 15
      backend/src/Squidex/Config/Domain/InfrastructureServices.cs
  4. 8
      backend/src/Squidex/appsettings.json
  5. 2
      backend/tests/docker-compose.yml

4
backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/JintScriptEngine.cs

@ -224,6 +224,10 @@ namespace Squidex.Domain.Apps.Core.Scripting
{
throw new ValidationException(T.Get("common.jsError", new { message = ex.Message }));
}
catch (OperationCanceledException)
{
throw new ValidationException(T.Get("common.jsError", new { message = "Timeout" }));
}
catch (DomainException)
{
throw;

4
backend/src/Squidex.Infrastructure/Commands/DomainObjectGrainFormatter.cs

@ -11,7 +11,7 @@ namespace Squidex.Infrastructure.Commands
{
public static class DomainObjectGrainFormatter
{
public static string Format(IIncomingGrainCallContext context)
public static readonly Func<IIncomingGrainCallContext, string> Format = context =>
{
if (context.InterfaceMethod == null)
{
@ -34,6 +34,6 @@ namespace Squidex.Infrastructure.Commands
}
return context.InterfaceMethod.Name;
}
};
}
}

15
backend/src/Squidex/Config/Domain/InfrastructureServices.cs

@ -51,6 +51,19 @@ namespace Squidex.Config.Domain
services.AddAsyncLocalCache();
services.AddBackgroundCache();
var timeoutExecution = config.GetValue<TimeSpan>("scripting:timeoutExecution");
var timeoutScript = config.GetValue<TimeSpan>("scripting:timeoutScript");
services.AddSingletonAs(c =>
new JintScriptEngine(
c.GetRequiredService<IMemoryCache>(),
c.GetRequiredService<IEnumerable<IJintExtension>>())
{
TimeoutExecution = timeoutExecution,
TimeoutScript = timeoutScript
}).As<IScriptEngine>();
services.AddSingletonAs(_ => SystemClock.Instance)
.As<IClock>();
@ -96,7 +109,7 @@ namespace Squidex.Config.Domain
services.AddSingletonAs<UserFluidExtension>()
.As<IFluidExtension>();
services.AddSingleton<Func<IIncomingGrainCallContext, string>>(DomainObjectGrainFormatter.Format);
services.AddSingleton(DomainObjectGrainFormatter.Format);
}
public static void AddSquidexUsageTracking(this IServiceCollection services, IConfiguration config)

8
backend/src/Squidex/appsettings.json

@ -75,6 +75,14 @@
}
},
"scripting": {
// The timeout for the whole script execution.
"timeoutExecution": "00:00:04",
// The timeout for the synchronous part of the script.
"timeoutScript": "00:00:00.200"
},
"languages": {
// Use custom languages where the key is the language code and the value is the english name.
"custom": ""

2
backend/tests/docker-compose.yml

@ -18,6 +18,8 @@ services:
- IDENTITY__ADMINCLIENTSECRET=xeLd6jFxqbXJrfmNLlO2j1apagGGGSyZJhFnIuHp4I0=
- STORE__MONGODB__CONFIGURATION=mongodb://mongo
- STORE__TYPE=MongoDB
- SCRIPTING__TIMEOUTSCRIPT=00:00:10
- SCRIPTING__TIMEOUTEXECUTION=00:00:10
- GRAPHQL__CACHEDURATION=0
networks:
- internal

Loading…
Cancel
Save