diff --git a/.vscode/launch.json b/.vscode/launch.json index 33155498..396abc9b 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -45,7 +45,7 @@ //"AYANOVA_LOG_LEVEL": "Debug", "AYANOVA_DEFAULT_TRANSLATION": "en", //TRANSLATION MUST BE en for Integration TESTING - "AYANOVA_PERMANENTLY_ERASE_DATABASE": "true", + //"AYANOVA_PERMANENTLY_ERASE_DATABASE": "true", "AYANOVA_DB_CONNECTION": "Server=localhost;Username=postgres;Password=raven;Database=AyaNova;", "AYANOVA_USE_URLS": "http://*:7575;", "AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles", diff --git a/server/AyaNova/models/dto/RequestTrial.cs b/server/AyaNova/models/dto/RequestTrial.cs index 347524e0..2d2f9266 100644 --- a/server/AyaNova/models/dto/RequestTrial.cs +++ b/server/AyaNova/models/dto/RequestTrial.cs @@ -7,7 +7,7 @@ namespace AyaNova.Models { public RequestTrial() { - DbId = string.Empty;//default this because it's coming from the client without a dbid as the server will set it before forwarding it on + DbId = "-";//default this because it's coming from the client without a dbid as the server will set it before forwarding it on } [Required] public string DbId { get; set; } diff --git a/server/AyaNova/util/License.cs b/server/AyaNova/util/License.cs index 8542245b..e3f5e0ed 100644 --- a/server/AyaNova/util/License.cs +++ b/server/AyaNova/util/License.cs @@ -481,6 +481,10 @@ namespace AyaNova.Core #region License fetching and handling + public class dtoFetchRequest + { + public string DbId { get; set; } + } /// /// Fetch a key, validate it and install it in the db then initialize with it @@ -493,12 +497,15 @@ namespace AyaNova.Core else log.LogInformation($"Fetching license for DBID {LicenseDbId}"); - string sUrl = $"{LICENSE_SERVER_URL}rvf/{LicenseDbId}"; + var FetchRequest=new dtoFetchRequest(){DbId=LicenseDbId}; + string sUrl = $"{LICENSE_SERVER_URL}rvf"; try { // string ResponseText = await ServiceProviderProvider.HttpClientFactory.CreateClient().GetStringAsync(sUrl); + + var content = new StringContent(JsonConvert.SerializeObject(FetchRequest), Encoding.UTF8, "application/json"); var client = ServiceProviderProvider.HttpClientFactory.CreateClient(); - var res = await client.GetAsync(sUrl); + var res = await client.PostAsync(sUrl, content); if (res.IsSuccessStatusCode) { var responseText = await res.Content.ReadAsStringAsync(); @@ -580,7 +587,7 @@ namespace AyaNova.Core //First fetch the schema db id for the servers database, the license must match var schema = await ct.SchemaVersion.AsNoTracking().SingleOrDefaultAsync(); //if (schema == null || schema.Id == Guid.Empty) - if (schema == null || string.IsNullOrWhiteSpace(schema.Id) ) + if (schema == null || string.IsNullOrWhiteSpace(schema.Id)) { //cryptic message deliberately, this is probably caused by someone trying to circumvent licensing var msg = "E1030 - Database integrity check failed (2). Contact support."; @@ -604,8 +611,8 @@ namespace AyaNova.Core } //ensure DB ID - // if (ldb.DbId == Guid.Empty) - if (string.IsNullOrWhiteSpace(ldb.DbId )) + // if (ldb.DbId == Guid.Empty) + if (string.IsNullOrWhiteSpace(ldb.DbId)) { ldb.DbId = ServerDbId; //Convert the no tracking record fetched above to tracking