Community
    • Login

    <NeedToBeUpdated> is always "yes"

    Scheduled Pinned Locked Moved General Discussion
    17 Posts 5 Posters 1.8k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      tfnab
      last edited by

      I have written a “plugin” for Nagios (monitoring tool) that checks the version of Notepad++ installed in my VDI environment against notepad-plus-plus dot org /update/getDownloadUrl.php

      With the latest version 8.5.7 the field <NeedToBeUpdated> has the value “yes” even if I provide the parameter that 8.5.7 is my installed version:

      notepad-plus-plus dot org /update/getDownloadUrl.php?version=8.5.7&param=x64

      <GUP>
      <NeedToBeUpdated>yes</NeedToBeUpdated>
      <Version>8.5.7</Version>
      <Location>https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v8.5.7/npp.8.5.7.Installer.x64.exe</Location>
      </GUP>
      

      Is this intentional, and if so what is the intention?

      mkupperM donhoD 2 Replies Last reply Reply Quote 2
      • mkupperM
        mkupper @tfnab
        last edited by

        @tfnab said in <NeedToBeUpdated> is always "yes":

        notepad-plus-plus dot org /update/getDownloadUrl.php?version=8.5.7&param=x64

        Try the URL
        https://notepad-plus-plus.org/update/getDownloadUrl.php?version=8.57&param=x64

        For notes on this please see Guide: How to correctly check for available Notepad++ updates which says:

        the version number has to be written with a single period only, after the major version number, e.g. ?version=7.64 for version 7.6.4.

        T 1 Reply Last reply Reply Quote 3
        • T
          tfnab @mkupper
          last edited by

          Thanks for pointing this out…

          You had me scratching my head though, because the “plugin” worked just fine for versions prior to 8.57

          Yes, I’m using the API “wrong”. What I do is use the value of the ProductVersion property of the executable in the URL. So I found this: Apparently the format of that property changed. For previous versions it had a single period only, e.g. 8.54, 8.56 – now this changed to 8.5.7 with two periods.

          Try this in PowerShell to see what I mean:

          ( gci 'notepad++.exe' ).VersionInfo.ProductVersion
          

          Which brings me back to: Is this intentional, and if so what is the intention?

          (No worries: I’m happy to rewrite my code. Really just curious more than anything else.)

          T mkupperM 2 Replies Last reply Reply Quote 3
          • T
            tfnab @tfnab
            last edited by

            Alright I dug deeper and what I observed is, at the end of the day, a result of this change:

            github dot com /notepad-plus-plus/notepad-plus-plus/pull/14025

            To me this is a closed case then.

            I’ll ponder this some more, and then my Nagios plugin will probably just get the latest version like so:

            notepad-plus-plus dot org /update/getDownloadUrl.php?param=x64

            and do without the <NeedToBeUpdated> tag entirely. This is fairly easy to implement and I see the least potential for it to break again. (Unless of course the change mentioned above breaks something else and gets rolled back :-o)

            Alan KilbornA 1 Reply Last reply Reply Quote 4
            • Alan KilbornA
              Alan Kilborn @tfnab
              last edited by

              @tfnab said in <NeedToBeUpdated> is always "yes":

              github dot com /notepad-plus-plus/notepad-plus-plus/pull/14025

              Not sure why you didn’t just make this a real link:
              https://github.com/notepad-plus-plus/notepad-plus-plus/pull/14025

              T 1 Reply Last reply Reply Quote 0
              • T
                tfnab @Alan Kilborn
                last edited by

                Because the forum won’t let me post links. “You need 5 reputation to post links.” Can’t even leave the “@” and your username at the beginning of my reply. Sorry!

                Alan KilbornA PeterJonesP 2 Replies Last reply Reply Quote 3
                • Alan KilbornA
                  Alan Kilborn @tfnab
                  last edited by

                  @tfnab

                  OK, understood.
                  You should NOW have 5 reputation points, as I upvoted 5 of your posts.

                  1 Reply Last reply Reply Quote 2
                  • PeterJonesP
                    PeterJones @tfnab
                    last edited by

                    @tfnab said in <NeedToBeUpdated> is always "yes":

                    You need 5 reputation to post links

                    The threshold has now been lowered to 1. Sorry for the inconvenience

                    1 Reply Last reply Reply Quote 2
                    • mkupperM
                      mkupper @tfnab
                      last edited by

                      @tfnab said in <NeedToBeUpdated> is always "yes":

                      Yes, I’m using the API “wrong”.

                      When I saw that bit in the documentation about needing to remove the extra dots before calling the API I was wondering why the API could not have dealt with this itself.

                      I started doing the mental gymnastics but discovered I’m no longer that flexible. I’ll need to write down the various permutations and see what breaks, for example, should someone call the API with a version greater than the current version using both dotted and dot removed version numbers, and the best way to normalize the value passed to the API.

                      T 1 Reply Last reply Reply Quote 2
                      • T
                        tfnab @mkupper
                        last edited by

                        @mkupper I may be blind… is that PHP script in the GitHub repo somewhere? If so I’d be more than happy to have a look myself and possibly provide a patch.

                        mkupperM 1 Reply Last reply Reply Quote 0
                        • mkupperM
                          mkupper @tfnab
                          last edited by

                          @tfnab It’s part of the WinGUP project and is at https://github.com/gup4win/wingup/blob/master/src/ConfigFiles/getDownLoadUrl.php

                          GUP.exe that ships with Notepad++ and is run when someone does a check for updates.

                          I don’t know if @donho has been keeping the WinGUP project up to date when he make changes to https://notepad-plus-plus.org/update/getDownloadUrl.php

                          T 1 Reply Last reply Reply Quote 0
                          • T
                            tfnab @mkupper
                            last edited by

                            @mkupper Given that param (which is used to distinguish between 32-bit and 64-bit versions) isn’t really used in the update check script I would assume it’s not up to date. Hence I’m not going to bother forking and creating a pull request… maybe this is of help anyway:

                            I would simply replace this (line 25)

                            if ($curentVersion >= $lastestVersion)
                            

                            with this:

                            if (substr_count($curentVersion,'.') > 1 && version_compare($curentVersion,$lastestVersionStr,'>=') || $curentVersion >= $lastestVersion)
                            

                            I think it should cover all scenarios, at least the ones I can think of.

                            mkupperM 1 Reply Last reply Reply Quote 1
                            • mkupperM
                              mkupper @tfnab
                              last edited by mkupper

                              Thank you @tfnab

                              I have posted the issue to github and also cross-posted it as a v8.5.7 regression.

                              FWIW, I ran a test from Powershell wihch confirmed your findings:

                              ( gci 'C:\npp\npp853-RTM\notepad++.exe' ).VersionInfo.ProductVersion -> 8.53
                              ( gci 'C:\npp\npp854-RC1\notepad++.exe' ).VersionInfo.ProductVersion -> 8.54
                              ( gci 'C:\npp\npp854-RC2\notepad++.exe' ).VersionInfo.ProductVersion -> 8.54
                              ( gci 'C:\npp\npp854-RTM\notepad++.exe' ).VersionInfo.ProductVersion -> 8.54
                              ( gci 'C:\npp\npp855-RC1\notepad++.exe' ).VersionInfo.ProductVersion -> 8.55
                              ( gci 'C:\npp\npp856-RTM\notepad++.exe' ).VersionInfo.ProductVersion -> 8.56
                              ( gci 'C:\npp\npp857-RC1\notepad++.exe' ).VersionInfo.ProductVersion -> 8.5.7
                              ( gci 'C:\npp\npp857-RTM\notepad++.exe' ).VersionInfo.ProductVersion -> 8.5.7
                              
                              1 Reply Last reply Reply Quote 3
                              • mkupperM mkupper referenced this topic on
                              • donhoD
                                donho @tfnab
                                last edited by donho

                                https://notepad-plus-plus.org/update/getDownloadUrl.php is internal URL for Notepad++ packages doing self auto-updating, but it not supposed for outside usage (from any individual or IT people of enterprise doing it manually). Therefore no support for the internal URL normally.

                                However, I have no way so far to hide the URL from outside, so I will explain how it does work.

                                From the v8.5.7, Notepad++ has changed its displayed version (from X.YZ to X.Y.Z) but keep its old version notation (X.YZ) as internal use for keeping the auto-update working.

                                So if you want to use Notepad++ internal URL for your update use, and your Notepad++ version is X.Y.Z (Y & Z are always 1 digit) you have to pass https://notepad-plus-plus.org/update/getDownloadUrl.php?version=X.YZ to make it work. For the case of v8.5.7, it’ll be https://notepad-plus-plus.org/update/getDownloadUrl.php?version=8.57

                                Note that getDownloadUrl.php could change its way to manage the auto-update in the future. Since it’s an internal used URL, there’s no warranty to keep its retro-compatibility.

                                Hope this explanation helps.

                                T 1 Reply Last reply Reply Quote 3
                                • T
                                  tfnab @donho
                                  last edited by

                                  @donho All understood perfectly well.

                                  Please consider change of policy (and of the update check web service) anyway!

                                  In some environments auto updates cannot be used. Reasons include (but not limited to): users don’t have admin privileges, “golden image” cannot be changed at runtime.

                                  For those scenarios it would still be nice to have update checks. After all it worked nice with the file properties version up until 8.56/8.5.6

                                  You changed the version scheme of that displayed version in 8.5.7 catering to people who run external version control mechanisms. So following the same reasoning please consider this one additional small change to address what is practically the same requirement! It would be highly appreciated.

                                  1 Reply Last reply Reply Quote 1
                                  • donhoD
                                    donho
                                    last edited by

                                    FYI
                                    https://notepad-plus-plus.org/update/getDownloadUrl.php has been modified.
                                    It work with both X.Y.Z and X.YZ now.

                                    T 1 Reply Last reply Reply Quote 5
                                    • T
                                      tfnab @donho
                                      last edited by

                                      @donho Thanks a lot. This is much appreciated.

                                      You’ve broken one other feature along the way: the guide says:

                                      if you just paste https://notepad-plus-plus.org/update/getDownloadUrl.php into your browser’s address bar, you will only get a generic answer that currently contains this http download url:
                                      http://notepad-plus-plus.org/repository/7.x/7.5.9/npp.7.5.9.Installer.exe

                                      This is no longer the case. Omitting the version parameter just returns this:

                                      <GUP><NeedToBeUpdated>no</NeedToBeUpdated></GUP>
                                      

                                      instead of the latest version number and download link. Tbh it doesn’t affect me, but maybe someone else cares?

                                      1 Reply Last reply Reply Quote 0
                                      • mkupperM mkupper referenced this topic on
                                      • First post
                                        Last post
                                      The Community of users of the Notepad++ text editor.
                                      Powered by NodeBB | Contributors