This commit is contained in:
2020-06-14 15:37:53 +00:00
parent f2b7b79d46
commit cb2953ad0f

View File

@@ -308,7 +308,7 @@ namespace AyaNova.Core
if (ActiveKey.IsEmpty) if (ActiveKey.IsEmpty)
{ {
sb.AppendLine(UNLICENSED_TOKEN); sb.AppendLine(UNLICENSED_TOKEN);
sb.AppendLine($"DB ID: {LicenseDbId}"); sb.AppendLine($"Server DB ID: {ServerDbId}");
} }
else else
{ {
@@ -317,7 +317,7 @@ namespace AyaNova.Core
sb.AppendLine($"Registered to: {ActiveKey.RegisteredTo}"); sb.AppendLine($"Registered to: {ActiveKey.RegisteredTo}");
sb.AppendLine($"Key ID: {ActiveKey.Id}"); sb.AppendLine($"Key ID: {ActiveKey.Id}");
sb.AppendLine($"DB ID: {LicenseDbId}"); sb.AppendLine($"Server DB ID: {ServerDbId}");
sb.AppendLine($"Type: {(ActiveKey.RentalLicense ? "Service" : "Perpetual")}"); sb.AppendLine($"Type: {(ActiveKey.RentalLicense ? "Service" : "Perpetual")}");
if (ActiveKey.WillExpire) if (ActiveKey.WillExpire)
sb.AppendLine($"License expires: {DateUtil.ServerDateTimeString(ActiveKey.LicenseExpiration)}"); sb.AppendLine($"License expires: {DateUtil.ServerDateTimeString(ActiveKey.LicenseExpiration)}");
@@ -364,6 +364,7 @@ namespace AyaNova.Core
sb.Append($"regto: {ActiveKey.RegisteredTo}, "); sb.Append($"regto: {ActiveKey.RegisteredTo}, ");
sb.Append($"keyid: {ActiveKey.Id}, "); sb.Append($"keyid: {ActiveKey.Id}, ");
sb.Append($"dbid: {LicenseDbId}, "); sb.Append($"dbid: {LicenseDbId}, ");
// sb.Append($"serverdbid: {ServerDbId}");
sb.Append($"type: {(ActiveKey.RentalLicense ? "service" : "perpetual")}, "); sb.Append($"type: {(ActiveKey.RentalLicense ? "service" : "perpetual")}, ");
if (ActiveKey.WillExpire) if (ActiveKey.WillExpire)
sb.Append($"exp: {DateUtil.ServerDateTimeString(ActiveKey.LicenseExpiration)}, "); sb.Append($"exp: {DateUtil.ServerDateTimeString(ActiveKey.LicenseExpiration)}, ");
@@ -400,6 +401,7 @@ namespace AyaNova.Core
{ {
license = new license = new
{ {
serverDbId = ServerDbId,
licensedTo = ActiveKey.RegisteredTo, licensedTo = ActiveKey.RegisteredTo,
dbId = ActiveKey.DbId, dbId = ActiveKey.DbId,
keySerial = ActiveKey.Id, keySerial = ActiveKey.Id,
@@ -492,8 +494,8 @@ namespace AyaNova.Core
if (res.IsSuccessStatusCode) if (res.IsSuccessStatusCode)
{ {
var responseText = await res.Content.ReadAsStringAsync(); var responseText = await res.Content.ReadAsStringAsync();
var responseJson=JObject.Parse(responseText); var responseJson = JObject.Parse(responseText);
var keyText=responseJson["data"]["key"].Value<string>(); var keyText = responseJson["data"]["key"].Value<string>();
AyaNovaLicenseKey ParsedKey = Parse(keyText, log); AyaNovaLicenseKey ParsedKey = Parse(keyText, log);
if (ParsedKey != null) if (ParsedKey != null)
@@ -503,13 +505,16 @@ namespace AyaNova.Core
} }
return $"E1020 - Error fetching license key: No key was returned"; return $"E1020 - Error fetching license key: No key was returned";
} }
else{ else
{
//some kind of server error?? //some kind of server error??
if((int)res.StatusCode > 499){ if ((int)res.StatusCode > 499)
return $"E1020 - License server error fetching license key, contact technical support: {res.ReasonPhrase}"; {
return $"E1020 - License server error fetching license key, contact technical support: {res.ReasonPhrase}";
} }
//If it's NOT FOUND, that's not an error, just a normal response to be expected //If it's NOT FOUND, that's not an error, just a normal response to be expected
if(res.StatusCode== System.Net.HttpStatusCode.NotFound){ if (res.StatusCode == System.Net.HttpStatusCode.NotFound)
{
return "notfound"; return "notfound";
} }
@@ -722,7 +727,7 @@ namespace AyaNova.Core
string keyNoWS = System.Text.RegularExpressions.Regex.Replace(StringUtil.Extract(k, "[KEY", "KEY]").Trim(), "(\"(?:[^\"\\\\]|\\\\.)*\")|\\s+", "$1"); string keyNoWS = System.Text.RegularExpressions.Regex.Replace(StringUtil.Extract(k, "[KEY", "KEY]").Trim(), "(\"(?:[^\"\\\\]|\\\\.)*\")|\\s+", "$1");
string keySig = StringUtil.Extract(k, "[SIGNATURE", "SIGNATURE]").Trim(); string keySig = StringUtil.Extract(k, "[SIGNATURE", "SIGNATURE]").Trim();
//bugbug second time around after installing key, keysig has cr/lf characters in it after this extract method runs, not sure wtf as it isnt there the first time //bugbug second time around after installing key, keysig has cr/lf characters in it after this extract method runs, not sure wtf as it isnt there the first time
#region Check Signature #region Check Signature