Add checkoutLink and defaultLanguage to GreenField invoice

This commit is contained in:
nicolas.dorier
2020-12-10 23:34:50 +09:00
parent 6cf29123f3
commit 798cf66e3f
11 changed files with 137 additions and 17 deletions

View File

@@ -11,6 +11,7 @@ using BTCPayServer.HostedServices;
using BTCPayServer.Models;
using BTCPayServer.Models.StoreViewModels;
using BTCPayServer.Security;
using BTCPayServer.Services;
using BTCPayServer.Services.Apps;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
@@ -31,15 +32,18 @@ namespace BTCPayServer.Controllers
private readonly IFileProvider _fileProvider;
public IHttpClientFactory HttpClientFactory { get; }
public LanguageService LanguageService { get; }
SignInManager<ApplicationUser> SignInManager { get; }
public HomeController(IHttpClientFactory httpClientFactory,
CssThemeManager cachedServerSettings,
IWebHostEnvironment webHostEnvironment,
LanguageService languageService,
SignInManager<ApplicationUser> signInManager)
{
HttpClientFactory = httpClientFactory;
_cachedServerSettings = cachedServerSettings;
LanguageService = languageService;
_fileProvider = webHostEnvironment.WebRootFileProvider;
SignInManager = signInManager;
}
@@ -116,6 +120,12 @@ namespace BTCPayServer.Controllers
{
return View(new BitpayTranslatorViewModel());
}
[Route("misc/lang")]
[Authorize(AuthenticationSchemes = AuthenticationSchemes.Cookie)]
public IActionResult Languages()
{
return Json(LanguageService.GetLanguages(), new JsonSerializerSettings() { Formatting = Formatting.Indented });
}
[Route("swagger/v1/swagger.json")]
[Authorize(AuthenticationSchemes = AuthenticationSchemes.Cookie + "," + AuthenticationSchemes.Greenfield)]