Jump to content

Abaksoft

uniGUI Subscriber
  • Posts

    1558
  • Joined

  • Last visited

  • Days Won

    87

Posts posted by Abaksoft

  1. 34 minutes ago, andyhill said:

    I added the ajax code to your skeleton sample and it worked so it obviously has to do with timing issues.

     I will need time to strip my project down and identify the timing/synchronisation problems - thank you for your input.

    Good to hear that :)

    Thx

  2. 11 hours ago, andyhill said:

    it is normal programming that only has issues (not working) with Touch Login Form.

    I tested  with Touch Login Form and works fine !

    
    procedure TfrmLogin.UnimButton1Click(Sender: TObject);
    var st:string;
    begin
      st:=UnimEdit1.Text;
      UnimButton1.JSInterface.JSCallGlobal('localStorage.setItem', ['K1', st] );   // Key , Value  (always string)
    end;
    
    procedure TfrmLogin.UnimButton2Click(Sender: TObject);
    begin
      with UnimEdit2.JSInterface do
        JSCall('setValue', [jsstatement('localStorage.getItem("K1")')]);      // important : Key must be Quoted " "
    end;
    
    procedure TfrmLogin.UnimButton3Click(Sender: TObject);
    begin
      UnimButton3.JSInterface.JSCallGlobal('localStorage.removeItem', ['K1']);
    end;

     

    - Unigui Build 1568

    - Chrome Version 115.0.5790.102 (Build officiel) (64 bits)

     

    See attached  LoginMobile.zip 

    LoginMobile.zip

  3. On 7/23/2023 at 8:15 AM, fraxzi said:

    Hi Everyone,

     

    I have .1568 and using Hyperserver in IIS 10 and Websocket.. the app uses 16416 port.

    in my local pc everything worked fine.. I received websocket broadcast.. BUT in https environment (IIS) the thing is not working at all... (chrome browser, other browser not working too)

    What Am I missing??

    Please Somebody help me on this.

    Hello,

    Did you follow step by step the guide :

    http://www.unigui.com/doc/online_help/websockets--ssl.htm

     

  4. 3 hours ago, andyhill said:
          try
            JSInterface.JSCallGlobal('localStorage.removeItem', ['_K1_']);
            JSInterface.JSCallGlobal('localStorage.removeItem', ['_K2_']);
          except
          end;
    
          try
            Button.JSInterface.JSCallGlobal('localStorage.removeItem', ['_K1_']);
            Button.JSInterface.JSCallGlobal('localStorage.removeItem', ['_K2_']);
          except
          end;

    Can someone please advise why RemoveItem fails to remove ? Thanks in advance

    Hello,

    This can help you:

    http://forums.unigui.com/index.php?/topic/12306-how-can-i-access-local-storage/&do=findComment&comment=65734

     

    Did you, first set your key _K1_  ?

  5. On 7/13/2023 at 3:13 PM, Farshad Mohajeri said:

    Hi,

    It grows because a new session will be created. However, after a while old session will timeout and number will decrease.

    @Farshad

    Sorry if i come back again.

    uniGUIApplication.BroadcastMessage can reach all active (live) sessions. So the new websokets you have coded knows, for sure the total of these active sessions.

    If it's not hard, could you add please, a function that would give this number?

    n:=GetTotalActiveSessions;

    This will simplify many things.

    Thx

  6. 19 hours ago, Gustavo_GRSoft said:

     := gridItens.CurrRow + 1;    HERE

       end;
    end;
     

    Replace :

    gridItens.CurrRow := gridItens.CurrRow + 1;    

    by:  if not vtItens.Eof then vtItens.Next;

     

  7. Dears,

    You have chosen to be a developer. For what ?

    the answer is simple: It's because you love everything that is:

    - Beautiful

    - TRUE

    - and Fair

    it makes you lights in this dark world. but...you are forgetting something very important: your health.

    guys, we develop too much, we stay too long in front of our screens and we end up with hypertension, heart palpitations, loss of visual acuity, and other nasty syndromes...

    I wanted to launch this alert, because I myself am concerned.

    Fortunately, there is a solution:

    Do SPORT and drink lots of water.

    it's funny, isn't it!

    try it and you will see: it will be beneficial for you and your family and moreover, you will develop twice as fast.

    Have a good day

    • Like 6
  8. 1 hour ago, Farshad Mohajeri said:

    After a while old session will timeout and number will decrease.

    Thank you Farshad,

    Very hapy to hear you.

    I am developping an  inventory mobile unigui application for supermarkets.

    This application is sold by number of active sessions (users smatphones).

    Example : if customer has two employees, he will buy a licence for maximum 2 actives sessions.

    So, it is important to have in live active sessions with accuracy.

    Conclusion :

    - what is the best way to get in live number of true active sessions ?

    - can websokets give this information (a function) ?

    Thx

  9. On 7/11/2023 at 5:57 AM, Sherzod said:

    web sockets.

    Hello  Maestro,

    Sorry for bypassing this topic.

    Can we get the number of all  opened (active) sessions with web sockets ?

    (In classical methode : unigui demo "Session List"  sometimes works, sometimes no : if i refresh browser, number grows).

    Here is my function :

    function TDM_Sessions.Nb_Sessions:cardinal;
    //  works elusively
    var
      I : Integer;
      S : TUniGUISessions;
      U : TUniGUISession;
      n:integer;
    
    begin
      n:=0;
      S:= UniServerModule.SessionManager.Sessions;
    
      S.Lock;
      try
        for I := 0 to S.SessionList.Count -1 do
        begin
          U:=S.SessionList[i];
    
          if (U.UniMainModule as TUniMainModule<>Nil)  // Ghost Sessions
          and (U<>Nil)                                 // Ghost Sessions
          then
            inc(n);
        end;
    
      finally
        S.Unlock;
      end;
    
      result:=n;
    end;

    Thx.

  10. On 6/27/2023 at 7:38 PM, picyka said:
    If this works, it will help a lot of people.

    No, it does'nt work.

    Self signed certificats are for testing purpose or for local network.

    If you want to use your domain name from web as secure https://xxxx.domain.com.br 

    the task is hard : you have to export your certificat from your server and communicate it to all your known clients to install it on there PC / Device !

     

    Mmm...Asking ChatGp4

    "is it possible to get a free trusted certificate for a public websites ?"

    Answer:

    "Yes, it is possible to obtain a free trusted certificate for a public website. There are several certificate authorities (CAs) that offer free SSL/TLS certificates that are trusted by major browsers. Here are a few popular options:

    Let's Encrypt: Let's Encrypt is a non-profit CA that provides free SSL/TLS certificates. They offer an automated certificate issuance and renewal process, making it easy to obtain and manage certificates for your website.

    Cloudflare: Cloudflare offers a free SSL/TLS service called "Universal SSL." When you sign up for their service, they provide you with a free SSL certificate that is automatically installed on your website. Cloudflare acts as a reverse proxy, encrypting the traffic between the client and Cloudflare's servers.

    ZeroSSL: ZeroSSL offers free SSL certificates that are valid for 90 days. They provide both automated and manual certificate generation options. ZeroSSL also offers an ACME client that can be integrated into your server for automated certificate issuance and renewal.

    SSL.com: SSL.com provides a free SSL certificate option called "SSL.com FREE." Their free certificate is valid for 90 days and supports both domain validation and wildcard certificates.

    It's worth noting that while these free certificates are trusted by browsers, they may have some limitations compared to paid certificates. For example, they may have a shorter validity period, limited support, or fewer additional features. If your website has specific requirements or needs extended validation, you may need to consider a paid certificate from a trusted CA.

    Additionally, some hosting providers or content delivery networks (CDNs) also offer integrated SSL/TLS solutions with free certificates. It's worth checking if your hosting provider has any options available for obtaining trusted certificates at no additional cost."

  11. The best practice in web, is to:

    - use uniDbGrid with ReadOnly = True also for its Dataset

    - FetchAll = False 

    - and to display fields in a frame for modification in one transaction.

     

    With this, i have never seen those errors messages.

  12. Asking ChatGpt4 : "Can https disturbe Ajax command ?"

    Answer :

    "No, the "https" protocol does not inherently disturb Ajax commands. The "https" protocol (Hypertext Transfer Protocol Secure) is simply a secure version of the HTTP protocol used for communication between a web browser and a web server.".....

    "HTTPS should not interfere with the functionality of AJAX commands"...

    ____________

    So, i suspect iis encryption.

    Can you try with a timer on your button to delay your calendar refresh.

  13. 45 minutes ago, picyka said:

    does this work for domains too?

    On a local network ?

    YES  with ...etc/hosts file.

    You have to define this domaine name on server and all client PC etc/hosts file.

    Example

    192.168.1.11   mywebsite1.dev

    Here 192.168.1.11 is IP Server. Thus, all your clients browsers will point to server IP with url : mywebsite1.dev

    ____________________

    See  point 2 from:

    http://forums.unigui.com/index.php?/topic/18951-help-with-ssl-intranet/&do=findComment&comment=136006

     

     

    if you want DNS instead of IP, replace the Section  [alt_names]  by :
    [alt_names]
    DNS.1   = mywebsite1.dev
    DNS.2   = mywebsite2.dev


    On a local network, without internet, mywebsite1.dev should be defined on C:\Windows\System32\drivers\etc\hosts  file :
    192.168.1.11  mywebsite1.dev

     

     

     

  14.  

    In a previous topic, we saw how to create a Self Signed Certificate with mkCert and trusted it with mmc.

    That works fine but havy method !   

    Here we will see  an other method much easier :

     

    OK, Step by Step :

    1. install the latest OPENSSL

    2. Prepare a conf file (NotePad) :

    [req]
    default_bits  = 2048
    distinguished_name = req_distinguished_name
    req_extensions = req_ext
    x509_extensions = v3_req
    prompt = no
    [req_distinguished_name]
    countryName = XX
    stateOrProvinceName = N/A
    localityName = N/A
    organizationName = Self-signed certificate
    commonName = 120.0.0.1: Self-signed certificate
    [req_ext]
    subjectAltName = @alt_names
    [v3_req]
    subjectAltName = @alt_names
    [alt_names]
    IP.1 = 192.168.1.11

     

    2. Save it as    C:\Program Files\OpenSSL-Win64\bin\san.cnf
    - Replace IP.1 variable by your IP adress (local machine)
    - if you want DNS instead of IP, replace the Section  [alt_names]  by :
    [alt_names]
    DNS.1   = mywebsite1.dev
    DNS.2   = mywebsite2.dev


    On a local network, without internet, mywebsite1.dev should be defined on C:\Windows\System32\drivers\etc\hosts  file :
    192.168.1.11  mywebsite1.dev


    3. Create your 3 .pem files (like Unigui doc) but with this conf :

    3.1. cmd as admin
    cd C:\Program Files\OpenSSL-Win64\bin

    openssl genrsa -out root.key 2048
    openssl req -x509 -days 3650 -new -nodes -key root.key -out root.pem -config san.cnf
    openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout key.pem -out cert.pem -config san.cnf

     


    4. Copy the 3 .pem files 
    C:\Program Files\OpenSSL-Win64\bin  :
    root.pem
    cert.pem
    Key.pem

    near your Unigui Project.exe 

     

    5. Add the cert.pem on the Windows Trusted Root Certificates (in case of a windows server).

    The most important step here, wich is not indicated on the Unigui doc : (FmSoft Team, could you please add it )

     

    Copy your cert.pem on a temporary location, example  C:\cert.pem
    Open PowerShell as admin
    Type these commands :

    $certPath = "C:\cert.pem"
    $cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($certPath)
    $cert.Import($certPath)
    $certStore = New-Object System.Security.Cryptography.X509Certificates.X509Store -ArgumentList "Root", "LocalMachine"
    $certStore.Open("ReadWrite")
    $certStore.Add($cert)
    $certStore.Close()


    This will automatically add the certificat cert.pem  on the trusted root certificats zone.
    If you want to do it in a single ligne (1 command ), just add  ;  between commands
    line1; line2; line3;....;line7

    You can verify the new certificat, by openin win + R : mmc
    and go to the trusted root certificates zone


    6. Run your Unigui SSL Project, and you will see the black padlock protected site.

    Have fun :)

    • Thanks 1
×
×
  • Create New...