diff --git a/MP.Land/Data/LicenseService.cs b/MP.Land/Data/LicenseService.cs index 56da8707..a9919f55 100644 --- a/MP.Land/Data/LicenseService.cs +++ b/MP.Land/Data/LicenseService.cs @@ -28,6 +28,12 @@ namespace MP.Land.Data /// URL dell'API x chiamate gestione licenze /// private static string apiUrl = "https://liman.egalware.com/ELM.API/"; + //private static string apiUrl = "https://localhost:44351/"; + + /// + /// Chiave redis x info della licenza + /// + private static string rkeyAppInfo = "LongCache:AppInfo"; private readonly IDistributedCache distributedCache; @@ -176,7 +182,7 @@ namespace MP.Land.Data RestClient client = new RestClient(apiUrl); //client.Authenticator = new HttpBasicAuthenticator("username", "password"); string MKeyEnc = HttpUtility.UrlEncode(MasterKey); - var request = new RestRequest($"/api/attivazioni/?chiave={MKeyEnc}", Method.Get); + var request = new RestRequest($"api/attivazioni/?chiave={MKeyEnc}", Method.Get); var response = await client.GetAsync(request); // controllo risposta if (response.StatusCode == System.Net.HttpStatusCode.OK) @@ -188,6 +194,29 @@ namespace MP.Land.Data return await Task.FromResult(answ); } + /// + /// Recupera info licenza da remoto + /// + private async Task> OnlineAppInfo() + { + List answ = new List(); + // cerco online + RestClient client = new RestClient(apiUrl); + string MKeyEnc = HttpUtility.UrlEncode(MasterKey); + //string mKey = System.Net.WebUtility.UrlEncode(MasterKey); + string reqUrl = $"api/licenza/{Installazione}?CodApp={Applicazione}&Chiave={MKeyEnc}"; + var request = new RestRequest(reqUrl, Method.Get); + var response = await client.GetAsync(request); + // controllo risposta + if (response.StatusCode == System.Net.HttpStatusCode.OK) + { + // verifico risposta + string rawData = $"{response.Content}"; + answ = JsonConvert.DeserializeObject?>(rawData); + } + return await Task.FromResult(answ); + } + private void ReportUpdated() { if (EA_InfoUpdated != null) @@ -357,7 +386,7 @@ namespace MP.Land.Data string answ = "ND"; // cerco online RestClient client = new RestClient(apiUrl); - var request = new RestRequest($"/api/health", Method.Get); + var request = new RestRequest($"api/health", Method.Get); var response = await client.GetAsync(request); // controllo risposta if (response.StatusCode == System.Net.HttpStatusCode.OK) @@ -382,19 +411,51 @@ namespace MP.Land.Data return fatto; } + public async Task> LicAppCache() + { + List dbResult = new List(); + string cacheKey = $"{rkeyAppInfo}:{MasterKey}"; + trackCache(cacheKey); + string rawData = await getRSV(cacheKey); + if (!string.IsNullOrEmpty(rawData)) + { + var cacheRes = JsonConvert.DeserializeObject?>(rawData); + if (cacheRes != null) + { + dbResult = cacheRes; + } + } + + return await Task.FromResult(dbResult); + } + /// /// Init della classe con variabili di base da Redis/DB /// public async Task RefreshLicense() { bool fatto = false; + // scadenza info a 15 gg... + int numDays = 15; + + // dati applicativo + var appData = await OnlineAppInfo(); + if (appData != null) + { + if (appData.Count > 0) + { + fatto = await setAppInfo(appData, numDays); + // salvo info licenza... + NumLicRemote = appData[0].NumLicenze; + } + } + + // dati attivazioni var onlineAct = await OnlineActivationList(); if (onlineAct != null) { if (onlineAct.Count > 0) { - // scadenza info a 15 gg... - int numDays = 15; infoExpiry = DateTime.Now.AddDays(numDays); ActivList = onlineAct; fatto = await setActivList(onlineAct, numDays); @@ -418,6 +479,20 @@ namespace MP.Land.Data return fatto; } + public async Task setAppInfo(List newAppInfo, int numDays) + { + bool fatto = false; + string cacheKey = $"{rkeyAppInfo}:{MasterKey}"; + var rawData = JsonConvert.SerializeObject(newAppInfo); + await setRSV(cacheKey, rawData, numDays * cacheFact * 24); + fatto = true; + if (EA_InfoUpdated != null) + { + EA_InfoUpdated?.Invoke(); + } + return fatto; + } + #endregion Public Methods } } \ No newline at end of file diff --git a/MP.Land/MP.Land.csproj b/MP.Land/MP.Land.csproj index 1723f2d9..1258a56a 100644 --- a/MP.Land/MP.Land.csproj +++ b/MP.Land/MP.Land.csproj @@ -3,7 +3,7 @@ net6.0 MP.Land - 6.15.2204.2309 + 6.15.2204.2612 diff --git a/MP.Land/Pages/About.razor b/MP.Land/Pages/About.razor index bb0f5664..454aeb2c 100644 --- a/MP.Land/Pages/About.razor +++ b/MP.Land/Pages/About.razor @@ -5,7 +5,7 @@ @inject LicenseService LicServ
-
+
@@ -85,7 +85,7 @@ Key
- @MastKey + @MastKey
diff --git a/MP.Land/Pages/About.razor.cs b/MP.Land/Pages/About.razor.cs index e4168f46..523620b5 100644 --- a/MP.Land/Pages/About.razor.cs +++ b/MP.Land/Pages/About.razor.cs @@ -42,22 +42,28 @@ namespace MP.Land.Pages private async Task reloadLicenseData() { + int cDelay = 5; // recupero dati + await Task.Delay(cDelay); LicServ.InitAkv(); Installazione = LicServ.Installazione; Applicazione = LicServ.Applicazione; - Licenze=$"{LicServ.NumLicDb}/??"; MastKey = LicServ.MasterKey; + await Task.Delay(cDelay); + var fatto = await LicServ.RefreshLicense(); + await Task.Delay(cDelay); + Licenze = $"{LicServ.NumLicDb}/{LicServ.NumLicRemote}"; // verifico stati ServerStatus = await LicServ.checkLimanServer(); bool okRemoteSrv = ServerStatus == "OK"; bool okScadenza = LicServ.checkLicenseActive(LicServ.MasterKey); - bool okNumLic = true; //((licenzeGPW.licenzeAttive <= licenzeGPW.licenzeDb) && (licenzeGPW.licenzeDb <= licenzeGPW.licenzeOnline)); + bool okNumLic = (LicServ.NumLicDb <= LicServ.NumLicRemote); // aggiornamento css secondo status colore da check mainCss = okNumLic ? "alert alert-success shadowBox" : "alert alert-warning shadowBox"; expDateCss = okScadenza ? "d-flex justify-content-between" : "d-flex justify-content-between bg-danger text-warning"; remSrvCss = okRemoteSrv ? "d-flex justify-content-between" : "d-flex justify-content-between bg-danger text-warning"; + await Task.Delay(cDelay); } private void updatePageHead() diff --git a/MP.Land/Resources/ChangeLog.html b/MP.Land/Resources/ChangeLog.html index 2adb7933..d50e830c 100644 --- a/MP.Land/Resources/ChangeLog.html +++ b/MP.Land/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo gestione Programmi MAPO -

Versione: 6.15.2204.2309

+

Versione: 6.15.2204.2612


Note di rilascio:
    diff --git a/MP.Land/Resources/VersNum.txt b/MP.Land/Resources/VersNum.txt index 38bc608a..b7394df7 100644 --- a/MP.Land/Resources/VersNum.txt +++ b/MP.Land/Resources/VersNum.txt @@ -1 +1 @@ -6.15.2204.2309 +6.15.2204.2612 diff --git a/MP.Land/Resources/manifest.xml b/MP.Land/Resources/manifest.xml index 7462ed24..1aa276ce 100644 --- a/MP.Land/Resources/manifest.xml +++ b/MP.Land/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.15.2204.2309 + 6.15.2204.2612 https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html false diff --git a/MP.Land/wwwroot/css/site.css b/MP.Land/wwwroot/css/site.css index f5cae2b6..b389c07e 100644 --- a/MP.Land/wwwroot/css/site.css +++ b/MP.Land/wwwroot/css/site.css @@ -63,6 +63,52 @@ a, .footer { line-height: 1.8em; } +.textTrim { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} +.maxChar { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} +.max5Char { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + width: 5rem; +} +.max10Char { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + width: 10rem; +} +.max20Char { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + width: 20rem; +} +.max30Char { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + width: 30rem; +} +.max40Char { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + width: 40rem; +} +.max50Char { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + width: 50rem; +} /*------------------------------------------------------------------ [ Shortcuts / .shortcuts ] */ @@ -76,7 +122,7 @@ a, min-width: 9rem; min-height: 5rem; display: inline-block; - padding: 0.66666667rem 0; + padding: 2rem/3 0; margin: 0 2px 1em; vertical-align: top; text-decoration: none; @@ -89,13 +135,13 @@ a, filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffeeeeee', GradientType=0); border: 1px solid #ddd; box-sizing: border-box; - border-radius: 0.5rem; + border-radius: 1rem/2; } .shortcuts .shortcut-sm { min-width: 4.5rem; min-height: 3rem; display: inline-block; - padding: 0.25rem 0; + padding: 1rem/4 0; margin: 0 2px 1em; vertical-align: top; text-decoration: none; @@ -108,7 +154,7 @@ a, filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffeeeeee', GradientType=0); border: 1px solid #ddd; box-sizing: border-box; - border-radius: 0.5rem; + border-radius: 1rem/2; } .shortcuts .shortcut .shortcut-icon { width: 100%; diff --git a/MP.Land/wwwroot/css/site.less b/MP.Land/wwwroot/css/site.less index 93470694..a7b985d8 100644 --- a/MP.Land/wwwroot/css/site.less +++ b/MP.Land/wwwroot/css/site.less @@ -63,6 +63,50 @@ a, .btn-link { line-height: 1.8em; } + +.textTrim { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + + +.maxChar { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.max5Char { + .maxChar; + width: 5rem; +} + +.max10Char { + .maxChar; + width: 10rem; +} + +.max20Char { + .maxChar; + width: 20rem; +} + +.max30Char { + .maxChar; + width: 30rem; +} + +.max40Char { + .maxChar; + width: 40rem; +} + +.max50Char { + .maxChar; + width: 50rem; +} + /*------------------------------------------------------------------ [ Shortcuts / .shortcuts ] */ diff --git a/MP.Land/wwwroot/css/site.min.css b/MP.Land/wwwroot/css/site.min.css index e465ff8c..a44f94b9 100644 --- a/MP.Land/wwwroot/css/site.min.css +++ b/MP.Land/wwwroot/css/site.min.css @@ -1 +1 @@ -@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');@import url('fonts.min.css');h1,h2,h3,h4,h5,h6,b,display-1,display-2,display-3,display-4{font-family:'Lato',sans-serif}html,body,.textCondensed{font-family:'Roboto Condensed',sans-serif}a,.btn-link{color:#0366d6}.btn-primary{color:#fff;background-color:#1b6ec2;border-color:#1861ac}.content{padding-top:1.1rem}.valid.modified:not([type=checkbox]){outline:1px solid #26b050}.invalid{outline:1px solid #f00}.validation-message{color:#f00}.textStriked{text-decoration:line-through}#blazor-error-ui{background:#ffffe0;bottom:0;box-shadow:0 -1px 2px rgba(0,0,0,.2);display:none;left:0;padding:.6rem 1.25rem .7rem 1.25rem;position:fixed;width:100%;z-index:1000}#blazor-error-ui .dismiss{cursor:pointer;position:absolute;right:.75rem;top:.5rem}.footer{line-height:1.8em}.shortcuts{text-align:center}.shortcuts .shortcut-icon{font-size:2rem}.shortcuts .shortcut{min-width:9rem;min-height:5rem;display:inline-block;padding:.66666667rem 0;margin:0 2px 1em;vertical-align:top;text-decoration:none;background:#f3f3f3;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fff),to(#eee));background-image:-webkit-linear-gradient(top,#fff,0%,#eee,100%);background-image:-moz-linear-gradient(top,#fff 0%,#eee 100%);background-image:linear-gradient(to bottom,#fff 0%,#eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffeeeeee',GradientType=0);border:1px solid #ddd;box-sizing:border-box;border-radius:.5rem}.shortcuts .shortcut-sm{min-width:4.5rem;min-height:3rem;display:inline-block;padding:.25rem 0;margin:0 2px 1em;vertical-align:top;text-decoration:none;background:#f3f3f3;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fff),to(#eee));background-image:-webkit-linear-gradient(top,#fff,0%,#eee,100%);background-image:-moz-linear-gradient(top,#fff 0%,#eee 100%);background-image:linear-gradient(to bottom,#fff 0%,#eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffeeeeee',GradientType=0);border:1px solid #ddd;box-sizing:border-box;border-radius:.5rem}.shortcuts .shortcut .shortcut-icon{width:100%;margin-top:0;margin-bottom:0;font-size:2rem;color:#333}.shortcuts .shortcut-sm .shortcut-icon{width:100%;margin-top:0;margin-bottom:0;font-size:2rem;color:#333}.shortcuts .shortcut:hover{background:#e8e8e8;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fafafa),to(#e1e1e1));background-image:-webkit-linear-gradient(top,#fafafa,0%,#e1e1e1,100%);background-image:-moz-linear-gradient(top,#fafafa 0%,#e1e1e1 100%);background-image:linear-gradient(to bottom,#fafafa 0%,#e1e1e1 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffafafa',endColorstr='#ffe1e1e1',GradientType=0)}.shortcuts .shortcut-sm:hover{background:#e8e8e8;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fafafa),to(#e1e1e1));background-image:-webkit-linear-gradient(top,#fafafa,0%,#e1e1e1,100%);background-image:-moz-linear-gradient(top,#fafafa 0%,#e1e1e1 100%);background-image:linear-gradient(to bottom,#fafafa 0%,#e1e1e1 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffafafa',endColorstr='#ffe1e1e1',GradientType=0)}.shortcuts .shortcut:active{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.shortcuts .shortcut-sm:active{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.shortcuts .shortcut:hover .shortcut-icon{color:#c93}.shortcuts .shortcut-sm:hover .shortcut-icon{color:#666}.shortcuts .shortcut-label{display:block;margin-top:.75em;font-weight:400;color:#666}@media(max-width:640px){.shortcuts .shortcut{min-width:8rem;min-height:4rem}body{font-size:.8em}} \ No newline at end of file +@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');@import url('fonts.min.css');h1,h2,h3,h4,h5,h6,b,display-1,display-2,display-3,display-4{font-family:'Lato',sans-serif}html,body,.textCondensed{font-family:'Roboto Condensed',sans-serif}a,.btn-link{color:#0366d6}.btn-primary{color:#fff;background-color:#1b6ec2;border-color:#1861ac}.content{padding-top:1.1rem}.valid.modified:not([type=checkbox]){outline:1px solid #26b050}.invalid{outline:1px solid #f00}.validation-message{color:#f00}.textStriked{text-decoration:line-through}#blazor-error-ui{background:#ffffe0;bottom:0;box-shadow:0 -1px 2px rgba(0,0,0,.2);display:none;left:0;padding:.6rem 1.25rem .7rem 1.25rem;position:fixed;width:100%;z-index:1000}#blazor-error-ui .dismiss{cursor:pointer;position:absolute;right:.75rem;top:.5rem}.footer{line-height:1.8em}.textTrim{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.maxChar{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.max5Char{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:5rem}.max10Char{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:10rem}.max20Char{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:20rem}.max30Char{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:30rem}.max40Char{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:40rem}.max50Char{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:50rem}.shortcuts{text-align:center}.shortcuts .shortcut-icon{font-size:2rem}.shortcuts .shortcut{min-width:9rem;min-height:5rem;display:inline-block;padding:2rem/3 0;margin:0 2px 1em;vertical-align:top;text-decoration:none;background:#f3f3f3;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fff),to(#eee));background-image:-webkit-linear-gradient(top,#fff,0%,#eee,100%);background-image:-moz-linear-gradient(top,#fff 0%,#eee 100%);background-image:linear-gradient(to bottom,#fff 0%,#eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffeeeeee',GradientType=0);border:1px solid #ddd;box-sizing:border-box;border-radius:1rem/2}.shortcuts .shortcut-sm{min-width:4.5rem;min-height:3rem;display:inline-block;padding:1rem/4 0;margin:0 2px 1em;vertical-align:top;text-decoration:none;background:#f3f3f3;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fff),to(#eee));background-image:-webkit-linear-gradient(top,#fff,0%,#eee,100%);background-image:-moz-linear-gradient(top,#fff 0%,#eee 100%);background-image:linear-gradient(to bottom,#fff 0%,#eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffeeeeee',GradientType=0);border:1px solid #ddd;box-sizing:border-box;border-radius:1rem/2}.shortcuts .shortcut .shortcut-icon{width:100%;margin-top:0;margin-bottom:0;font-size:2rem;color:#333}.shortcuts .shortcut-sm .shortcut-icon{width:100%;margin-top:0;margin-bottom:0;font-size:2rem;color:#333}.shortcuts .shortcut:hover{background:#e8e8e8;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fafafa),to(#e1e1e1));background-image:-webkit-linear-gradient(top,#fafafa,0%,#e1e1e1,100%);background-image:-moz-linear-gradient(top,#fafafa 0%,#e1e1e1 100%);background-image:linear-gradient(to bottom,#fafafa 0%,#e1e1e1 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffafafa',endColorstr='#ffe1e1e1',GradientType=0)}.shortcuts .shortcut-sm:hover{background:#e8e8e8;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fafafa),to(#e1e1e1));background-image:-webkit-linear-gradient(top,#fafafa,0%,#e1e1e1,100%);background-image:-moz-linear-gradient(top,#fafafa 0%,#e1e1e1 100%);background-image:linear-gradient(to bottom,#fafafa 0%,#e1e1e1 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffafafa',endColorstr='#ffe1e1e1',GradientType=0)}.shortcuts .shortcut:active{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.shortcuts .shortcut-sm:active{box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.shortcuts .shortcut:hover .shortcut-icon{color:#c93}.shortcuts .shortcut-sm:hover .shortcut-icon{color:#666}.shortcuts .shortcut-label{display:block;margin-top:.75em;font-weight:400;color:#666}@media(max-width:640px){.shortcuts .shortcut{min-width:8rem;min-height:4rem}body{font-size:.8em}} \ No newline at end of file