mirror of
https://github.com/aljazceru/BTCPayServerPlugins.git
synced 2025-12-17 07:34:24 +01:00
add forward endpoint
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
<PropertyGroup>
|
||||
<Product>Coinjoin</Product>
|
||||
<Description>Allows you to integrate your btcpayserver store with coinjoins.</Description>
|
||||
<Version>1.0.91</Version>
|
||||
<Version>1.0.92</Version>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace WalletWasabi.Backend.Controllers;
|
||||
public class WabisabiCoordinatorSettings
|
||||
{
|
||||
public bool Enabled { get; set; } = false;
|
||||
|
||||
public Uri ForwardEndpoint { get; set; } = new Uri("https://wasabiwallet.io/");
|
||||
public string NostrIdentity { get; set; }
|
||||
public Uri NostrRelay { get; set; } = new Uri("wss://relay.primal.net");
|
||||
|
||||
|
||||
@@ -12,10 +12,13 @@ namespace WalletWasabi.Backend.Controllers;
|
||||
public class WasabiLeechController : Controller
|
||||
{
|
||||
private readonly WabisabiCoordinatorClientInstanceManager _coordinatorClientInstanceManager;
|
||||
private readonly WabisabiCoordinatorService _wabisabiCoordinatorService;
|
||||
|
||||
public WasabiLeechController(WabisabiCoordinatorClientInstanceManager coordinatorClientInstanceManager)
|
||||
public WasabiLeechController(WabisabiCoordinatorClientInstanceManager coordinatorClientInstanceManager,
|
||||
WabisabiCoordinatorService wabisabiCoordinatorService)
|
||||
{
|
||||
_coordinatorClientInstanceManager = coordinatorClientInstanceManager;
|
||||
_wabisabiCoordinatorService = wabisabiCoordinatorService;
|
||||
}
|
||||
|
||||
[HttpGet("api/v4/Wasabi/legaldocuments")]
|
||||
@@ -32,14 +35,22 @@ public class WasabiLeechController : Controller
|
||||
[Route("{*key}")]
|
||||
public async Task<IActionResult> Forward(string key, CancellationToken cancellationToken)
|
||||
{
|
||||
if (!_coordinatorClientInstanceManager.HostedServices.TryGetValue("zksnacks", out var coordinator))
|
||||
return BadRequest();
|
||||
if (!_wabisabiCoordinatorService.Started)
|
||||
return NotFound();
|
||||
|
||||
var settings = await _wabisabiCoordinatorService.GetSettings();
|
||||
|
||||
var b = new UriBuilder(coordinator.Coordinator);
|
||||
b.Path = key;
|
||||
b.Query = Request.QueryString.ToString();
|
||||
if (settings.ForwardEndpoint is not null)
|
||||
{
|
||||
var b = new UriBuilder(settings.ForwardEndpoint)
|
||||
{
|
||||
Path = key,
|
||||
Query = Request.QueryString.ToString()
|
||||
};
|
||||
|
||||
return RedirectPreserveMethod(b.ToString());
|
||||
return RedirectPreserveMethod(b.ToString());
|
||||
}
|
||||
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,11 @@
|
||||
<textarea rows="10" cols="40" class="form-control " asp-for="TermsConditions" >
|
||||
</textarea>
|
||||
</div>
|
||||
<div class="form-group pt-3">
|
||||
<label class="form-label" for="config">Coordinator endpoint redirect</label>
|
||||
<input asp-for="ForwardEndpoint" type="url" class="form-control"/>
|
||||
<p>When someone enters your coordinator endpoint, forward to this url (except for coinjoin endpoints).</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xxl-constrain col-xl-4">
|
||||
|
||||
Reference in New Issue
Block a user