diff --git a/archive/NerdTools-2022.10.08-x86_64-1.txz b/archive/NerdTools-2022.10.08-x86_64-1.txz new file mode 100644 index 0000000..a0336b5 Binary files /dev/null and b/archive/NerdTools-2022.10.08-x86_64-1.txz differ diff --git a/plugin/NerdTools.plg b/plugin/NerdTools.plg index 2eaa32f..4069c5d 100644 --- a/plugin/NerdTools.plg +++ b/plugin/NerdTools.plg @@ -3,8 +3,8 @@ - - + + @@ -17,6 +17,9 @@ ##&name; +###2022.10.08 +- The plugins column is changed by the current version +- The functionality to compare old versions is updated ###2022.10.05 - Fix remove packages on uninstalling plugin ###2022.10.04d @@ -112,6 +115,7 @@ rm -f &plgPATH;/&plgNAME;.txz removepkg /boot/extra/*_nerdtools.txz 1>/dev/null rm -f /boot/exta/*_nerdtools.txz 1>/dev/null +rm -f /boot/config/plugins/NerdTools 1>/dev/null echo "" echo "-----------------------------------------------------------" diff --git a/source/NerdTools/usr/local/emhttp/plugins/NerdTools/NerdTools.page b/source/NerdTools/usr/local/emhttp/plugins/NerdTools/NerdTools.page index ae465d1..61a4490 100644 --- a/source/NerdTools/usr/local/emhttp/plugins/NerdTools/NerdTools.page +++ b/source/NerdTools/usr/local/emhttp/plugins/NerdTools/NerdTools.page @@ -28,7 +28,7 @@ table.tablesorter tbody tr:nth-child(even) { Size Downloaded Installed - Plugins + Installed Version diff --git a/source/NerdTools/usr/local/emhttp/plugins/NerdTools/include/DownloadHelpers.php b/source/NerdTools/usr/local/emhttp/plugins/NerdTools/include/DownloadHelpers.php index 8558fa7..3f7a19f 100644 --- a/source/NerdTools/usr/local/emhttp/plugins/NerdTools/include/DownloadHelpers.php +++ b/source/NerdTools/usr/local/emhttp/plugins/NerdTools/include/DownloadHelpers.php @@ -6,7 +6,7 @@ function get_file_from_url($file, $url) { $ch_vers = curl_version(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //curl_setopt($ch, CURLOPT_TIMEOUT, 3600); -curl_setopt($ch, CURLOPT_NOPROGRESS, true); + curl_setopt($ch, CURLOPT_NOPROGRESS, true); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_USERAGENT, 'curl/'.$ch_vers['version']); //curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, 'progress_bar'); diff --git a/source/NerdTools/usr/local/emhttp/plugins/NerdTools/include/NerdToolsHelpers.php b/source/NerdTools/usr/local/emhttp/plugins/NerdTools/include/NerdToolsHelpers.php index c5ade45..d608f4b 100644 --- a/source/NerdTools/usr/local/emhttp/plugins/NerdTools/include/NerdToolsHelpers.php +++ b/source/NerdTools/usr/local/emhttp/plugins/NerdTools/include/NerdToolsHelpers.php @@ -13,6 +13,7 @@ if (!is_dir($pkg_extra_path)) $pkg_desc = 'https://raw.githubusercontent.com/UnRAIDES/unRAID-NerdTools/main/packages/packages-desc'; $pkg_repo = "https://api.github.com/repos/UnRAIDES/unRAID-NerdTools/contents/packages/$os_version"; +$pkg_repo = $_SERVER['HTTP_DEVELOP'] ? $pkg_repo = "https://api.github.com/repos/jsavargas/unRAID-NerdTools/contents/packages/$os_version?ref=develop" : $pkg_repo; $desc_file = $pkg_path.'packages-desc'; $repo_file = $pkg_path.'packages.json'; diff --git a/source/NerdTools/usr/local/emhttp/plugins/NerdTools/include/PackageQuery.php b/source/NerdTools/usr/local/emhttp/plugins/NerdTools/include/PackageQuery.php index 71de21a..02a86dd 100644 --- a/source/NerdTools/usr/local/emhttp/plugins/NerdTools/include/PackageQuery.php +++ b/source/NerdTools/usr/local/emhttp/plugins/NerdTools/include/PackageQuery.php @@ -30,7 +30,7 @@ foreach ($pkgs_github_array as $pkg_github) { $pkg_version = $pkg_nameArray[sizeof($pkg_nameArray) - 3]; // get package version - $pkg_nver = $pkg_name.'-'.str_replace('.', '_', $pkg_version); // add underscored version to package name + $pkg_nver = $pkg_name.'-'.str_replace('.', '__', $pkg_version); // add underscored version to package name $pkg_pattern = '/^'.$pkg_name.'-[0-9].*/'; // search pattern for packages @@ -56,16 +56,23 @@ foreach ($pkgs_github_array as $pkg_github) { } } + $downloadedpkg = !empty(preg_grep($pkg_pattern, $pkgs_installed)) ? array_values(preg_grep($pkg_pattern, $pkgs_installed))[0] : false; + $downloadedpkgv = $downloadedpkg ? preg_match('/^'.$pkg_name.'-(\d.+?)[-|_].*/',$downloadedpkg, $matches)? $matches[1]:false : false; + $updatePkg = version_compare($pkg_version, $downloadedpkgv, '>') ; + $pkg = [ - 'name' => $pkg_github['name'], // add full package name + 'name' => str_replace("_nerdtools.txz",".txz",$pkg_github['name']) , // add full package name 'pkgname' => $pkg_name, // add package name only 'pkgnver' => $pkg_nver, // add package name with underscored version 'pkgversion' => $pkg_version, // add package name with raw version + 'updatePkg' => $updatePkg, // add package name with raw version + 'updatePkgs' => "$pkg_version => $downloadedpkgv", // add package name with raw version 'size' => format_size($pkg_github['size'], 1, '?'), // add package size 'installed' => !empty(preg_grep($pkg_pattern, $pkgs_installed)) ? 'yes' : 'no', // checks if package name is installed 'installeq' => in_array(pathinfo($pkg_github['name'], PATHINFO_FILENAME), $pkgs_installed) ? 'yes' : 'no', // checks if package installed equals github exactly 'downloaded' => !empty(preg_grep($pkg_pattern, $pkgs_downloaded)) ? 'yes' : 'no', // checks if package name is downloaded 'downloadeq' => in_array($pkg_github['name'], $pkgs_downloaded) ? 'yes' : 'no', // checks if package downloaded equals github exactly + 'actualpkgv' => $downloadedpkgv ? $downloadedpkgv:" - ", // checks if package name is downloaded 'config' => $pkg_set, // install preference 'plugins' => $pkg_plgs, // plugins dependency on package 'desc' => $pkgs_desc_array[$pkg_name] diff --git a/source/NerdTools/usr/local/emhttp/plugins/NerdTools/js/jquery.NerdTools.js b/source/NerdTools/usr/local/emhttp/plugins/NerdTools/js/jquery.NerdTools.js index 23e7c54..b7ded52 100644 --- a/source/NerdTools/usr/local/emhttp/plugins/NerdTools/js/jquery.NerdTools.js +++ b/source/NerdTools/usr/local/emhttp/plugins/NerdTools/js/jquery.NerdTools.js @@ -41,7 +41,8 @@ function packageQuery(force) { var DownloadEQ = data.packages[i].downloadeq; var Installed = data.packages[i].installed; var InstallEQ = data.packages[i].installeq; - if (DownloadEQ == Downloaded && InstallEQ == Installed){ + var updatePkg = data.packages[i].updatePkg; + if (InstallEQ == Installed || !updatePkg){ if (Installed == "yes"){ if (Downloaded == "no") Update = " installed"; @@ -55,7 +56,7 @@ function packageQuery(force) { Ready = true; } - if (DownloadEQ != Downloaded) + if (DownloadEQ != Downloaded && updatePkg) Downloaded = 'old'; var Checked = ""; @@ -70,7 +71,7 @@ function packageQuery(force) { ""+data.packages[i].size+""+ // package size ""+Downloaded+""+ // package downloaded ""+Installed+""+ // package installed - ""+data.packages[i].plugins+""+ // package dependents + ""+data.packages[i].actualpkgv+""+ // package dependents ""+ ""+ ""); diff --git a/source/NerdTools/usr/local/emhttp/plugins/NerdTools/scripts/packagemanager b/source/NerdTools/usr/local/emhttp/plugins/NerdTools/scripts/packagemanager index 0ebfb57..dedce10 100755 --- a/source/NerdTools/usr/local/emhttp/plugins/NerdTools/scripts/packagemanager +++ b/source/NerdTools/usr/local/emhttp/plugins/NerdTools/scripts/packagemanager @@ -68,10 +68,11 @@ $pkg_find = ''; foreach ($pkg_cfg as $pkg_name => $pkg_pref) { // get preferences for each package $pkg_cmd = ''; $pkg_msg = ''; - $pkg_name = str_replace('_', '.', $pkg_name); // replace "_" with "." in package names + $pkg_name = str_replace('__', '.', $pkg_name); // replace "_" with "." in package names $pkg_pattern = '/^'.$pkg_name.'.-*/'; // search pattern for packages + $pkg_patternd = '/^'.$pkg_name.'.*_nerdtools.*/'; // search pattern for packages $pkg_install_status = !empty(preg_grep($pkg_pattern, $pkgs_installed)); // check install status - $pkg_download_status = !empty(preg_grep($pkg_pattern, $pkgs_downloaded)); // check package download status + $pkg_download_status = !empty(preg_grep($pkg_patternd, $pkgs_downloaded)); // check package download status $pkg_online_status = !empty(preg_grep($pkg_pattern, $pkgs_github_array)); $pkg_find .= " ! -name '".$pkg_name."*'"; @@ -95,6 +96,8 @@ foreach ($pkg_cfg as $pkg_name => $pkg_pref) { // get preferences for each packa logger(substr($plg_msg, 0, -2)); } + $pkg_file = str_replace("_nerdtools.txz",".txz",$pkg_file); + $pkg_file = str_replace(".txz","_nerdtools.txz",$pkg_file); // if package is selected to be installed if ($pkg_pref == 'yes') { // if executing from the wegui check status and download if necessary @@ -120,7 +123,7 @@ foreach ($pkg_cfg as $pkg_name => $pkg_pref) { // get preferences for each packa if (!$pkg_install_status) { // if package is not installed $pkg_msg = 'Installing'; - $pkg_cmd = 'upgradepkg --install-new '.$pkg_extra_path.$pkg_name.'* 2>&1'; + $pkg_cmd = 'upgradepkg --install-new '.$pkg_extra_path.$pkg_name.'*_nerdtools.txz 2>&1'; } } elseif ($pkg_pref == 'no' && $pkg_download_status && $argu) {