luci-app-opkg: only show packages with higher version in upgrade tab
authorJo-Philipp Wich <jo@mein.io>
Fri, 4 Jan 2019 08:15:49 +0000 (09:15 +0100)
committerJo-Philipp Wich <jo@mein.io>
Fri, 4 Jan 2019 08:15:49 +0000 (09:15 +0100)
Fixes #2422.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js

index 274a982929c3158d8e82d4881857dad6f1013c58..4a36b0a3c32d89e0d99c5e4b4b379d6287c23ceb 100644 (file)
@@ -135,7 +135,7 @@ function display(pattern)
 
                if (currentDisplayMode === 'updates') {
                        var avail = packages.available.pkgs[name];
-                       if (!avail || avail.version === pkg.version)
+                       if (!avail || compareVersion(avail.version, pkg.version) <= 0)
                                continue;
 
                        ver = '%s ยป %s'.format(
@@ -291,6 +291,9 @@ function compareVersion(val, ref)
        val = val || '';
        ref = ref || '';
 
+       if (val === ref)
+               return 0;
+
        while (vi < val.length || ri < ref.length) {
                var first_diff = 0;