Jump to content

irigsoft

uniGUI Subscriber
  • Posts

    1374
  • Joined

  • Last visited

  • Days Won

    22

Everything posted by irigsoft

  1. OK, how You will connect to my VPN server, without knowing user and password ? I think if you know the VPN user and password for the VPN server, then you have every right to connect.
  2. Thank You. How to get country_name in global variable on uniMainmodule ?
  3. Thanks, this is a good way to get a "state" by date, but what if the user's regional settings are wrong? my goal is to protect myself from attacks from foreign countries, so it is assumed that they will try to circumvent the proper login
  4. Good question, but if it uses a VPN, it means that this user has default connectivity rights. (VPN connection to the server is activated)
  5. I have done this so far: function getIPDetails (sRemIP: String): String; begin UniSession.AddJS (' new Promise(function(resolve, reject) {' + + ' const xhttp = new XMLHttpRequest();' + ' xhttp.onreadystatechange = function () {' + ' if (this.readyState == 4 && this.status == 200) {' + ' console.log(JSON.parse(xhttp.responseText));' + ' }' + '};' + ' xhttp.open("GET", "http://ip-api.io/json/" + ' + sRemIP + ', true);' + ' xhttp.send();' + '}' ); Result := ?????? end; usage TUniServerModule.UniGUIServerModuleHTTPCommand begin IF AnsiUpperCase (getIPDetails (ARequestInfo.RemoteIP)) <> AnsiUpperCase (MySettings ['AcceptRequestFromCountry']) then begin AResponseInfo.ContentText := '<h1>Restricted Country</h1>'; Handled := True; AResponseInfo.CloseSession; exit; end; end; I didn't try it.
  6. My plan is: 1. Client try to connect - send GET (or POST) command to uniGui 2. On UniGUIServerModuleHTTPCommand I get RemoteIP address 3. Check IP lookup with this API (like example) function getIPDetails() { var ipAddress = document.getElementById("txtIP").value; var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function () { if (this.readyState == 4 && this.status == 200) { console.log(JSON.parse(xhttp.responseText)); } }; xhttp.open("GET", "http://ip-api.io/json/" + ipAddress, true); xhttp.send(); } 4. If Country is different from my Country, then add this IP address to BlockedIPList. The Question1 is: Is there some integrated getIPDetails on uniGui ? The Question2 is:If there is no integrated getIPDetails in uniGui, then how to use this function on UniGUIServerModuleHTTPCommand and return Country name on some variable ?
  7. Thanks, I have already integrated this. I have an application in which I want to allow access only to users from the country where the server is located. For example, only consumers from Germany. I have a procedure that blocks IP addresses when they try some suspicious activity. But I want to block all addresses that are not from my country. When an IP address tries to open a session (when connecting to the server), I want to check its Country and block it (add to Blockiplist) if it is not on my Country.
  8. Thanks, but this is fine if I know the IP addresses of the attackers, but I want to allow access only to the IP addresses from the location (Country) of my server. I found some IP location detection APIs, but I think this will block the server in case of strong attacks because it will check the location of each IP. something like that: https://stackoverflow.com/questions/3489460/how-to-get-visitors-location-i-e-country-using-geolocation function getIPDetails() { var ipAddress = document.getElementById("txtIP").value; var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function () { if (this.readyState == 4 && this.status == 200) { console.log(JSON.parse(xhttp.responseText)); } }; xhttp.open("GET", "http://ip-api.io/json/" + ipAddress, true); xhttp.send(); } <input type="text" id="txtIP" placeholder="Enter the ip address" /> <button onclick="getIPDetails()">Get IP Details</button> but if is possible on server side : UniGUIServerModuleHTTPCommand
  9. Hello, I want to block from my uniGui application all IP addresses from locations (Countries) other than my country. Is there a way integrated in unigui ?
  10. If Mutual is not possible, You can try with HMAC authorization
  11. maybe this will give more info: https://stackoverflow.com/questions/47942288/request-client-certificate-on-javascript https://coderedirect.com/questions/424200/sending-client-certificate-via-javascript but You are right, unigui framework must give use this kind of ssl protection.
  12. Hello, I'm not sure (because I didn't do it), but you can try the information from these links, trying to use XmlHttpRequests : https://www.qtcentre.org/threads/44629-Using-XMLHttpRequest-for-HTTPS-Post-to-server-with-SSL-certificate https://reqbin.com/req/javascript/c-lfozgltr/curl-https-request https://social.msdn.microsoft.com/Forums/en-US/51ab1bd9-969e-485f-976d-571bfbbd3405/mutual-ssl-authentication-from-cross-origin-requests?forum=windowsazurewebsitespreview
  13. 1. Create uniGui Application as Service (or StandAlone application if You want to show some data in a windows tray) 2. On this application You get sended data and then send it to the default printer. uniMainModule: function mmReadDocument (iType: Integer; sDocument: String): String; var ParamsList, sAnswerList, sDataList : TStringList; Wait : Integer; I : Integer; begin Wait := 0; repeat sleep (5); Inc (Wait); If (Wait >= 36000) then break; until (not ServerModule.isBusy); TRY sAnswerList := TStringList.Create; sAnswerList.StrictDelimiter := True; ParamsList := TStringList.Create; sDataList := TStringList.Create; sDataList.StrictDelimiter := True; sDataList.Delimiter := '#'; sAnswerList.Text := ''; sDataList.DelimitedText := DecodeBase64 (sDocument); ServerModule.isBusy := True; TRY SEND DATA TO The default PRINTER ServerModule.isBusy := False; sAnswerList.Clear; ParamsList.Clear; sDataList.Clear; EXCEPT on E:Exception do begin sAnswerList.Text := e.Message; ShowMessage ('2 ExecuteCommands Error:' + e.Message); end; END; end; uniServerModule: procedure TUniServerModule.UniGUIServerModuleHTTPCommand begin //check if pdf file is sended if (POS ('/pdf',ARequestInfo.URI) > 0) then begin // DO YOUR REST STUFF AResponseInfo.ResponseNo := 200; AResponseInfo.ContentEncoding := '1251'; ARequestInfo.Document := mmReadDocument (2,Copy (ARequestInfo.Document,Length ('/pdf=')+1,Length (ARequestInfo.Document))); AResponseInfo.ContentText := ARequestInfo.Document; AResponseInfo.WriteContent; Handled := True; AResponseInfo.CloseSession; end; end; 3. from Server Application just send data.
  14. You can create a Windows based service (with uniGui) and install it on a client machine. Then, when the application from the browser wants to print directly, send data such as Base64 string to this service and use it to print.
  15. hello, look here : https://www.google.com/search?q=javascript+print+directly+to+default+printer&oq=javascript+print+direct&aqs=chrome.2.69i57j0i19l4j0i19i22i30l5.10143j0j7&sourceid=chrome&ie=UTF-8 for many examples in javascript. or look here:
  16. no, You have try to get Scrollbox.ControlCount, not only Scrollbox.ComponentCount
  17. Hello, how many Controls You have in this ScrollBar ? TuniPanels are Components TuniButtons are Controls !
  18. ver 1524, this work perfect, thank You: uniDBGrid1.JSInterface.JSCode('var me='#1'; var _view=null; var _lockedview=null; if (!me.lockedGrid && !me.normalGrid) {_view=me.getView()} else {_view=me.normalGrid.getView(); _lockedview=me.lockedGrid.getView()}; '+ 'if (_view) {_view.summaryFeature.summaryBar.hide()};'+ 'if (_lockedview) {_lockedview.summaryFeature.summaryBar.hide()};' );
  19. Hello, I'm trying the example "\ Demos \ Desktop \ GridSummaryPage" and I want to add a check box with Summary.Enable: = Checkbox.Checked to show / hide the summary row. Is it possible during the runtime?
  20. Hello, Can You try to apply Your example with "url = https://google.com", did You will get same Ajax Error ?
×
×
  • Create New...