diff --git a/NightscoutWatcher.lpi b/NightscoutWatcher.lpi index f140aa4..800cf2c 100644 --- a/NightscoutWatcher.lpi +++ b/NightscoutWatcher.lpi @@ -24,9 +24,9 @@ - + - + diff --git a/forms/ufMain.pas b/forms/ufMain.pas index 622448e..fc2a84d 100644 --- a/forms/ufMain.pas +++ b/forms/ufMain.pas @@ -520,18 +520,23 @@ procedure TfMain.actSetNightscoutSiteExecute(Sender: TObject); TimerIntervalSecs := -1; if WasConnected then TimerIntervalSecs := 20; - DialogResult := TfTimerDialog.Execute(Self, 'Nighscout site', 'Type URL of Nightscout site', Url, [pbOK, pbCancel], TimerIntervalSecs); + Msg := 'Type in URL of Nightscout site.' + #13#10 + + 'If there is an error appeare try to change protocol to HTTP instead of HTTPS in URL.'; + DialogResult := TfTimerDialog.Execute(Self, 'Nighscout site', Msg, Url, [pbOK, pbCancel], TimerIntervalSecs); if DialogResult = mrOK then begin if (Url <> '') and (SetNightscoutUrl(Url)) then tmrTimer(tmr) else + begin actSetNightscoutSiteExecute(Sender); + end; end else if (DialogResult = mrCancel) and not WasConnected then begin - Msg := 'To obtain CGM data you have to type full URL of your Nightscout site.' + #13#10 + - 'Only HTTP protocol is supported.' + #13#10 + + Msg := 'To obtain CGM data you have to type in full URL of your Nightscout site.' + #13#10 + + 'To support HTTPS you have to download libeay32.dll and ssleay32.dll and put it to the project directory.' + #13#10 + + 'Otherwise only HTTP protocol is supported. Try to change protocol to HTTP instead of HTTPS in URL.' + #13#10#13#10 + 'Do you want to try again?'; if MessageDlg(Msg, mtWarning, [mbYes, mbCancel], -1) = mrYes then actSetNightscoutSiteExecute(Sender); @@ -1255,18 +1260,9 @@ procedure TfMain.HardInvalidate(); function TfMain.SetNightscoutUrl(Url: string): Boolean; begin Result := False; - Url := Trim(Url); - if Url = '' then + if Trim(Url) = '' then Exit; - Url := ReplaceText(Url, 'https://', 'http://'); - Url := ReplaceText(Url, 'http://', 'http://'); - if Url[Length(Url)] = '/' then - Url := Copy(Url, 1, Length(Url) - 1); - - if Pos('http://', Url) < 1 then - Url := 'http://' + Url; - Settings.NightscoutUrl := Url; Result := True; end; diff --git a/forms/uftimerdialog.lfm b/forms/uftimerdialog.lfm index 422b663..2a0597e 100644 --- a/forms/uftimerdialog.lfm +++ b/forms/uftimerdialog.lfm @@ -1,11 +1,11 @@ object fTimerDialog: TfTimerDialog - Left = 394 - Height = 130 - Top = 577 + Left = 806 + Height = 135 + Top = 264 Width = 525 BorderStyle = bsDialog Caption = 'fTimerDialog' - ClientHeight = 130 + ClientHeight = 135 ClientWidth = 525 Constraints.MinHeight = 130 Constraints.MinWidth = 400 @@ -24,7 +24,7 @@ object fTimerDialog: TfTimerDialog object pb: TButtonPanel Left = 6 Height = 34 - Top = 90 + Top = 95 Width = 513 OKButton.Name = 'OKButton' OKButton.DefaultCaption = True