You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make sure people use correct API URL and token (+ few other changes)
And some other more-less cosmetical changes.
Fix for calling UpdateStatusbar lot of times on window focus. This
probably wasn't the cause of freezes (my window froze without triggering
those), but it was still worth to optimize it I guess.
Fix domain for stats.
// TODO: Maybe check out https://docs.microsoft.com/en-us/windows/desktop/controls/embed-nonbutton-controls-in-toolbars to create counter within toolbar as alternative?
if(!_shownInvalidApiTokenMessage)// we want to inform user only once, and if he does not provide the token, let's not bomb him with error each time after he types something
390
+
if((int)response.StatusCode==403)
391
+
{
392
+
Logger.Error("Could not pulse (error 403). Please make sure you entered a valid API token in Code::Stats settings.",ex);
393
+
if(!_hasAlreadyShownInvalidApiTokenMessage)// we want to inform user only once, and if they do not provide the token, let's not bomb him with error each time after they type something
394
+
{
395
+
MessageBox.Show("Could not pulse. Please make sure you entered a valid API token in Code::Stats settings.\nAll recorded XP from this session will be lost if you do not provide the correct API token!","Code::Stats – error 403",MessageBoxButtons.OK,MessageBoxIcon.Error);
MessageBox.Show("Could not pulse. Please make sure you entered a valid API token in Code::Stats settings.","Code::Stats - error 403",MessageBoxButtons.OK,MessageBoxIcon.Error);
381
-
_shownInvalidApiTokenMessage=true;
402
+
Logger.Error("Could not pulse (error 404). The entered custom endpoint ("+URL+") is invalid. ",ex);
403
+
MessageBox.Show("Could not pulse. Invalid API endpoint URL. Please make sure you entered a valid API URL in Code::Stats settings or delete the value altogether to restore the default.\nAll recorded XP from this session will be lost if you do not provide the correct API URL path!","Code::Stats – error 404",MessageBoxButtons.OK,MessageBoxIcon.Error);
404
+
405
+
//_settingsForm.txtAPIURL.Focus();
406
+
//_settingsForm.txtAPIURL.SelectAll();
407
+
_settingsForm.FocusTxtAPIURL();
408
+
SettingsPopup();
409
+
_settingsForm.ShowAPIURLTooltip();
410
+
}
411
+
else
412
+
{
413
+
Logger.Error("Could not pulse - HTTP error "+(int)response.StatusCode+". ",ex);
382
414
}
383
-
Logger.Error("Could not pulse. Please make sure you entered a valid API token in Code::Stats settings.",ex);
stringHtmlResult=client.DownloadString("https://p0358.cf/codestats/report.php?pluginver="+Constants.PluginVersion+"&cid="+CodeStatsPackage.Guid+"&editorname="+Constants.EditorName+"&editorver="+Constants.EditorVersion+"&is64proc="+ProcessorArchitectureHelper.Is64BitProcess.ToString().ToLowerInvariant());// expected response: ok
632
+
stringHtmlResult=client.DownloadString("https://p0358.net/codestats/report.php?pluginver="+Constants.PluginVersion+"&cid="+CodeStatsPackage.Guid+"&editorname="+Constants.EditorName+"&editorver="+Constants.EditorVersion+"&is64process="+ProcessorArchitectureHelper.Is64BitProcess.ToString().ToLowerInvariant()+"&is64sys="+ProcessorArchitectureHelper.Is64BitOperatingSystem.ToString().ToLowerInvariant());// expected response: ok
600
633
if(HtmlResult.Contains("ok"))_reportedStats=true;
601
634
}
602
635
@@ -613,6 +646,12 @@ public static WebProxy GetProxy()
613
646
{
614
647
WebProxyproxy=null;
615
648
649
+
if(String.IsNullOrWhiteSpace(Proxy))
650
+
{
651
+
Logger.Debug("No proxy will be used. It's not set.");
0 commit comments