• Login
Community
  • Login

<NeedToBeUpdated> is always "yes"

Scheduled Pinned Locked Moved General Discussion
17 Posts 5 Posters 2.2k 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 Sep 16, 2023, 7:46 AM

    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?

    M D 2 Replies Last reply Sep 16, 2023, 5:16 PM Reply Quote 2
    • M
      mkupper @tfnab
      last edited by Sep 16, 2023, 5:16 PM

      @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 Sep 17, 2023, 7:03 AM Reply Quote 3
      • T
        tfnab @mkupper
        last edited by Sep 17, 2023, 7:03 AM

        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 M 2 Replies Last reply Sep 17, 2023, 8:48 AM Reply Quote 3
        • T
          tfnab @tfnab
          last edited by Sep 17, 2023, 8:48 AM

          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)

          A 1 Reply Last reply Sep 17, 2023, 11:10 AM Reply Quote 4
          • A
            Alan Kilborn @tfnab
            last edited by Sep 17, 2023, 11:10 AM

            @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 Sep 17, 2023, 1:05 PM Reply Quote 0
            • T
              tfnab @Alan Kilborn
              last edited by Sep 17, 2023, 1:05 PM

              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!

              A P 2 Replies Last reply Sep 17, 2023, 1:07 PM Reply Quote 3
              • A
                Alan Kilborn @tfnab
                last edited by Sep 17, 2023, 1:07 PM

                @tfnab

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

                1 Reply Last reply Reply Quote 2
                • P
                  PeterJones @tfnab
                  last edited by Sep 17, 2023, 2:21 PM

                  @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
                  • M
                    mkupper @tfnab
                    last edited by Sep 17, 2023, 3:47 PM

                    @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 Sep 17, 2023, 6:11 PM Reply Quote 2
                    • T
                      tfnab @mkupper
                      last edited by Sep 17, 2023, 6:11 PM

                      @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.

                      M 1 Reply Last reply Sep 17, 2023, 11:42 PM Reply Quote 0
                      • M
                        mkupper @tfnab
                        last edited by Sep 17, 2023, 11:42 PM

                        @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 Sep 18, 2023, 12:34 PM Reply Quote 0
                        • T
                          tfnab @mkupper
                          last edited by Sep 18, 2023, 12:34 PM

                          @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.

                          M 1 Reply Last reply Sep 18, 2023, 3:50 PM Reply Quote 1
                          • M
                            mkupper @tfnab
                            last edited by mkupper Sep 18, 2023, 3:55 PM Sep 18, 2023, 3:50 PM

                            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
                            • M mkupper referenced this topic on Sep 18, 2023, 3:54 PM
                            • D
                              donho @tfnab
                              last edited by donho Sep 20, 2023, 5:36 PM Sep 20, 2023, 5:33 PM

                              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 Sep 21, 2023, 9:03 AM Reply Quote 3
                              • T
                                tfnab @donho
                                last edited by Sep 21, 2023, 9:03 AM

                                @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
                                • D
                                  donho
                                  last edited by Sep 21, 2023, 11:27 AM

                                  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 Sep 25, 2023, 7:38 AM Reply Quote 5
                                  • T
                                    tfnab @donho
                                    last edited by Sep 25, 2023, 7:38 AM

                                    @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
                                    • M mkupper referenced this topic on Jun 3, 2024, 6:14 PM
                                    1 out of 17
                                    • First post
                                      1/17
                                      Last post
                                    The Community of users of the Notepad++ text editor.
                                    Powered by NodeBB | Contributors