mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Register functions once
This commit is contained in:
parent
e5dd40c99c
commit
7f6c653f64
@ -90,7 +90,7 @@ public class AuthorControls : ControllerBase
|
||||
{
|
||||
var data = await KnownFolders.EntryPoint.Combine(@"Controllers\Templates\AuthorControls.html")
|
||||
.ReadAllTextAsync();
|
||||
var func = NettleEngine.GetCompiler().RegisterWJFunctions().Compile(data);
|
||||
var func = NettleEngine.GetCompiler().Compile(data);
|
||||
return func(o);
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ namespace Wabbajack.BuildServer.Controllers;
|
||||
[Route("/authored_files")]
|
||||
public class AuthoredFiles : ControllerBase
|
||||
{
|
||||
private static readonly Func<object, string> HandleGetListTemplate = NettleEngine.GetCompiler().RegisterWJFunctions().Compile(@"
|
||||
private static readonly Func<object, string> HandleGetListTemplate = NettleEngine.GetCompiler().Compile(@"
|
||||
<html><body>
|
||||
<table>
|
||||
{{each $.files }}
|
||||
|
@ -11,12 +11,15 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Nettle;
|
||||
using Nettle.Compiler;
|
||||
using Newtonsoft.Json;
|
||||
using Octokit;
|
||||
using Wabbajack.BuildServer;
|
||||
using Wabbajack.DTOs.JsonConverters;
|
||||
using Wabbajack.Networking.GitHub;
|
||||
using Wabbajack.Server.DataModels;
|
||||
using Wabbajack.Server.Extensions;
|
||||
using Wabbajack.Server.Services;
|
||||
|
||||
namespace Wabbajack.Server;
|
||||
@ -85,6 +88,8 @@ public class Startup
|
||||
services.AddMvc();
|
||||
services.AddControllers()
|
||||
.AddNewtonsoftJson(o => { o.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; });
|
||||
|
||||
NettleEngine.GetCompiler().RegisterWJFunctions();
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
|
Loading…
Reference in New Issue
Block a user