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)
{
sb.AppendLine(UNLICENSED_TOKEN);
sb.AppendLine($"DB ID: {LicenseDbId}");
sb.AppendLine($"Server DB ID: {ServerDbId}");
}
else
{
@@ -317,7 +317,7 @@ namespace AyaNova.Core
sb.AppendLine($"Registered to: {ActiveKey.RegisteredTo}");
sb.AppendLine($"Key ID: {ActiveKey.Id}");
sb.AppendLine($"DB ID: {LicenseDbId}");
sb.AppendLine($"Server DB ID: {ServerDbId}");
sb.AppendLine($"Type: {(ActiveKey.RentalLicense ? "Service" : "Perpetual")}");
if (ActiveKey.WillExpire)
sb.AppendLine($"License expires: {DateUtil.ServerDateTimeString(ActiveKey.LicenseExpiration)}");
@@ -364,6 +364,7 @@ namespace AyaNova.Core
sb.Append($"regto: {ActiveKey.RegisteredTo}, ");
sb.Append($"keyid: {ActiveKey.Id}, ");
sb.Append($"dbid: {LicenseDbId}, ");
// sb.Append($"serverdbid: {ServerDbId}");
sb.Append($"type: {(ActiveKey.RentalLicense ? "service" : "perpetual")}, ");
if (ActiveKey.WillExpire)
sb.Append($"exp: {DateUtil.ServerDateTimeString(ActiveKey.LicenseExpiration)}, ");
@@ -400,6 +401,7 @@ namespace AyaNova.Core
{
license = new
{
serverDbId = ServerDbId,
licensedTo = ActiveKey.RegisteredTo,
dbId = ActiveKey.DbId,
keySerial = ActiveKey.Id,
@@ -492,8 +494,8 @@ namespace AyaNova.Core
if (res.IsSuccessStatusCode)
{
var responseText = await res.Content.ReadAsStringAsync();
var responseJson=JObject.Parse(responseText);
var keyText=responseJson["data"]["key"].Value<string>();
var responseJson = JObject.Parse(responseText);
var keyText = responseJson["data"]["key"].Value<string>();
AyaNovaLicenseKey ParsedKey = Parse(keyText, log);
if (ParsedKey != null)
@@ -503,13 +505,16 @@ namespace AyaNova.Core
}
return $"E1020 - Error fetching license key: No key was returned";
}
else{
else
{
//some kind of server error??
if((int)res.StatusCode > 499){
return $"E1020 - License server error fetching license key, contact technical support: {res.ReasonPhrase}";
if ((int)res.StatusCode > 499)
{
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(res.StatusCode== System.Net.HttpStatusCode.NotFound){
if (res.StatusCode == System.Net.HttpStatusCode.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 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