differentiate between 1.0 and 2.0 legal docs
MODIFY
WalletWasabi.Backend/Controllers/SoftwareController.cs
WalletWasabi.Backend/Controllers/SoftwareController.cs
@@ -15,7 +15,7 @@ public class SoftwareController : ControllerBase
{
ClientVersion = Constants.ClientVersion.ToString(3),
BackendMajorVersion = Constants.BackendMajorVersion,
- LegalDocumentsVersion = Constants.LegalDocumentsVersion.ToString()
+ LegalDocumentsVersion = Constants.OldLegalDocumentsVersion.ToString()
};
/// <summary>

MODIFY
WalletWasabi.Backend/Controllers/WasabiController.cs
WalletWasabi.Backend/Controllers/WasabiController.cs
@@ -19,9 +19,28 @@ public class WasabiController : ControllerBase
/// <response code="200">Returns the legal documents.</response>
[HttpGet("legaldocuments")]
[ProducesResponseType(typeof(byte[]), 200)]
- public async Task<IActionResult> GetLegalDocumentsAsync()
+ public async Task<IActionResult> GetLegalDocumentsAsync(string? id)
{
- var content = await System.IO.File.ReadAllBytesAsync(LegalDocuments.EmbeddedFilePath);
+ string filePath;
+
+ // If the document id is null, then the request comes from WW1.0 client.
+ if (id is null)
+ {
+ filePath = LegalDocuments.EmbeddedFilePath;
+ }
+ else
+ {
+ if (Version.TryParse(id, out var requestedVersion) && requestedVersion == Constants.WW2LegalDocumentsVersion)
+ {
+ filePath = LegalDocuments.EmbeddedFilePathForWW2;
+ }
+ else
+ {
+ return NotFound();
+ }
+ }
+
+ var content = await System.IO.File.ReadAllBytesAsync(filePath);
return File(content, "text/plain");
}
}

MODIFY
WalletWasabi/Helpers/Constants.cs
WalletWasabi/Helpers/Constants.cs
@@ -61,7 +61,8 @@ public static class Constants
public static readonly Version HwiVersion = new("2.0.2");
public static readonly Version BitcoinCoreVersion = new("21.2");
- public static readonly Version LegalDocumentsVersion = new(2, 0);
+ public static readonly Version OldLegalDocumentsVersion = new(2, 0);
+ public static readonly Version WW2LegalDocumentsVersion = new(2, 0, 1);
// Defined in hours. Do not modify these values or the order!
public static readonly int[] CoinJoinFeeRateMedianTimeFrames = new[] { 24, 168, 720 };

MODIFY
WalletWasabi/Legal/LegalDocuments.cs
WalletWasabi/Legal/LegalDocuments.cs
@@ -10,6 +10,7 @@ namespace WalletWasabi.Legal;
public class LegalDocuments
{
public static readonly string EmbeddedFilePath = Path.Combine(EnvironmentHelpers.GetFullBaseDirectory(), "Legal", "Assets", "LegalDocuments.txt");
+ public static readonly string EmbeddedFilePathForWW2 = Path.Combine(EnvironmentHelpers.GetFullBaseDirectory(), "Legal", "Assets", "LegalDocuments2.txt");
public LegalDocuments(Version version, string content)
{

MODIFY
WalletWasabi/WebClients/Wasabi/WasabiClient.cs
WalletWasabi/WebClients/Wasabi/WasabiClient.cs
@@ -262,7 +262,7 @@ public class WasabiClient
{
using HttpResponseMessage response = await HttpClient.SendAsync(
HttpMethod.Get,
- $"/api/v{ApiVersion}/wasabi/legaldocuments",
+ $"/api/v{ApiVersion}/wasabi/legaldocuments?id={Helpers.Constants.WW2LegalDocumentsVersion}",
cancel: cancel).ConfigureAwait(false);
if (response.StatusCode != HttpStatusCode.OK)

differentiate between 1.0 and 2.0 legal docs