Kaju self-updater talk

  1. ‹ Older
  2. 2 months ago

    Sure, it's just the easiest way I've found to get around the Windows write permission issue that only ever happens for me when trying to auto-update the app within the Program Files folder.

    I'm yet to try Kaju on the Mac so will report back my findingss when I do.

    Thanks again for such a great utility!

  3. Kem T

    Feb 17 Pre-Release Testers, Xojo Pro New York

    I could probably do something similar via an AppleScript that calls an authorized shell on the Mac, but that would leave out Linux.

  4. Sure, that would be great. I only build for Windows and Mac so it would work for me but obviously it would be good for Linux developers to have a solution too. I really have no idea about Linux at all though so I'm afraid I can't offer any ideas on that front.

    One thing I did note about that example is that you need to add Chr(34) around f.NativePath since the script failed during testing on a test user account that by default did not have admin rights:

    sh.Execute("Wscript.exe " + Chr(34) + f.NativePath + Chr(34) )
  5. Kem T

    Feb 17 Pre-Release Testers, Xojo Pro New York

    To be clear, I won't be doing any of this until I need it, and I may never need it. If someone wants this functionality, they should write it and submit it back to the project.

    At least, that's how open-source is supposed to work...

  6. Sure. Good to discuss though in case others are using Kaju and run into similar problems.

  7. Beatrix W

    Feb 22 Pre-Release Testers Europe (Germany)

    Don't do a version with the number 4.0.4.

    I wanted to check why I get "an error occurred" when loading an update after updating from 4.0.3 to 4.0.4. I changed the version information to an older version and did some debugging. When coming to the code

    				dim raw as string = http.Get( url, 10 )
    				if http.HTTPStatusCode = 404 or instr(raw, "404") > 0 then // Not found
    						mResult = ResultType.NoUpdateAvailable
    						exit do
    						
    				elseif raw = "" then
    						if HandleError( KajuLocale.kErrorNoUpdateData ) then
    								continue do
    						else
    								exit do
    						end if
    				end if

    it looked at first glance like the socket had problems with getting the update data. Instead I have a download url

    "URL":"http://www.mothsoftware.com/downloads/MailArchiverX404.dmg"

  8. Beatrix W

    Feb 22 Pre-Release Testers Europe (Germany)

    The download complete event has the same problem:

    if instr(url, "404") > 0 then
  9. Kem T

    Feb 23 Pre-Release Testers, Xojo Pro New York

    D'oh!

  10. Kem T

    Feb 23 Pre-Release Testers, Xojo Pro New York

    Wait, that's not in the project code...

  11. Kem T

    Feb 23 Pre-Release Testers, Xojo Pro New York

    This is the original code:

      dim raw as string = http.Get( url, 5 )
      if http.HTTPStatusCode = 404 then // Not found
        mResult = ResultType.NoUpdateAvailable
        exit do
        
      elseif raw = "" then
        if HandleError( KajuLocale.kErrorNoUpdateData ) then
          continue do
        else
          exit do
        end if
      end if
     
  12. Tim P

    Feb 23 Pre-Release Testers, Xojo Pro

    For anyone who didn't notice the difference like me, Beatrix's version is checking the response text for "404" as well.

  13. Kem T

    Feb 23 Pre-Release Testers, Xojo Pro New York

    Right. I'm not sure why that's needed, but it you really want to do that, at least use a regular expression to make sure the 404 is standalone, and something else to make sure the JSON markers for the packet are not there.

  14. Beatrix W

    Feb 23 Pre-Release Testers Europe (Germany)

    Hmm.. as the senior moments are getting worse and worse: I seem to remember that the socket didn't give the proper status code. Therefore, I added the code to shoot myself into the foot.

  15. Tim P

    Feb 23 Pre-Release Testers, Xojo Pro
    Edited 2 months ago by Tim P

    @Beatrix W Hmm.. as the senior moments are getting worse and worse: I seem to remember that the socket didn't give the proper status code. Therefore, I added the code to shoot myself into the foot.

    Perhaps you might want to search for "file not found" in the response text instead of "404"

    It's not exactly a good workaround for the socket not having the right response code, but it's less likely to result in a false positive match.

  16. 5 days ago

    Beatrix W

    Apr 21 Pre-Release Testers Europe (Germany)

    Ran into this issue again and found out what is causing it. I've got something in my htaccess file that makes a redirect to another page. This also affects Kaju. I get

    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"><html><head><title>302 Found</title></head><body><h1>Found</h1><p>The document has moved <a href="http://www.mothsoftware.com/errors/404/index.html">here</a>.</p></body></html>

    as result if I use a wrong url. The socket doesn't have a 404 status code because there is a page after all. Does anyone have a better idea than checking for "<title>302 Found</title>"?

  17. Kem T

    Apr 21 Pre-Release Testers, Xojo Pro New York

    Did you try setting AllowRedirection?

  18. Beatrix W

    Apr 21 Pre-Release Testers Europe (Germany)

    I tried allowRedirection but this doesn't change anything. I want to know if there is a 404 error not if there is a redirect.

  19. Kem T

    Apr 21 Pre-Release Testers, Xojo Pro New York

    Oh. The page it redirects to doesn't return 404? But it should, right?

  20. 4 days ago

    Beatrix W

    Apr 22 Pre-Release Testers Europe (Germany)
    Edited 4 days ago by Beatrix W

    Let's start from the beginning. I want to improve this code here:

     if http.HTTPStatusCode = 404 then
        mResult = ResultType.NoUpdateAvailable
        exit do

    Since I never ever screw anything up I want that to work with my website in case I delete the json file or whatnot. Let's say I use this code with

    url = "http://www.mothsoftware.com/test.json"

    To make my website nicer what would normally give a 404 error is redirected to

    http://www.mothsoftware.com/errors/404/index.html

    The socket doesn't give a status code of 404 because there is a page. Checking for a 404 in the result was a really bad idea which screwed up my release 4.0.4. At the moment my code looks like this

     if http.HTTPStatusCode = 404 or instr(raw, "<title>302 Found</title>") > 0 then // Not found
        
        mResult = ResultType.NoUpdateAvailable
        
        dim theAlert as new MessageDialog
        theAlert.Message = KajuLocale.kErrorBadUpdateData
        call theAlert.ShowModal
        exit do

    with an added error message. The question is, if there is a better solution than the instr check. Checking for redirection didn't change anything. Wouldn't make a difference since I don't want the redirection anyways. I can't find what I did to my htaccess file. But I would have thought that having a nice 404 is a common thing to do for websites.

  21. Kem T

    Apr 22 Pre-Release Testers, Xojo Pro New York

    @Beatrix W The socket doesn't give a status code of 404 because there is a page.

    This is incorrect behavior. Yes, there is a page, but it's not the content the user was looking for, it's a "not found" error, so this page should always return status 404, not 200. Nobody goes to that page intentionally.

    Having said that, I'm not sure what the problem is. Yes, Kaju will think it got to a valid url even though it didn't, but the later code that looks for the signature and JSON data should flag it, no?

    You can also change the code this way:

    if http.HTTPStatusCode <> 200 then ...

    In fact, that might be a good change for the project anyway.

or Sign Up to reply!