diff --git a/plugins/dynamix.plugin.manager/Plugins.page b/plugins/dynamix.plugin.manager/Plugins.page
index 0378df17b..07bb00415 100644
--- a/plugins/dynamix.plugin.manager/Plugins.page
+++ b/plugins/dynamix.plugin.manager/Plugins.page
@@ -4,8 +4,8 @@ Title="Installed Plugins"
Tabs="true"
---
-
-
-
-Click check for updates to check all plugins. This page might take some time to load depending on your internet connection and how many plugins need to be checked.
-
-
-Plugin Author Version Status
-Please wait, retrieving plugin information ...
+Plugin Author Version Status Uninstall
+Please wait,=$stale?' updating and':''?> retrieving plugin information ...
diff --git a/plugins/dynamix.plugin.manager/Update.page b/plugins/dynamix.plugin.manager/Update.page
new file mode 100644
index 000000000..200483ffa
--- /dev/null
+++ b/plugins/dynamix.plugin.manager/Update.page
@@ -0,0 +1,47 @@
+Menu="About"
+Title="Update OS"
+---
+
+
+$empty = "Please wait, updating and retrieving system information ... "?>
+
+
+
+System Author Version Status Release
+=$empty?>
+
diff --git a/plugins/dynamix.plugin.manager/icons/updateos.png b/plugins/dynamix.plugin.manager/icons/updateos.png
new file mode 100644
index 000000000..e68175c03
Binary files /dev/null and b/plugins/dynamix.plugin.manager/icons/updateos.png differ
diff --git a/plugins/dynamix.plugin.manager/include/PluginHelpers.php b/plugins/dynamix.plugin.manager/include/PluginHelpers.php
index 21a3954c0..f47717b1e 100644
--- a/plugins/dynamix.plugin.manager/include/PluginHelpers.php
+++ b/plugins/dynamix.plugin.manager/include/PluginHelpers.php
@@ -1,6 +1,6 @@
-$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
+$docroot = $docroot ?: $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// Invoke the plugin command with indicated method
function plugin($method, $arg = '') {
@@ -21,12 +21,12 @@ function plugin($method, $arg = '') {
return implode("\n", $output);
}
-function make_link($method, $arg) {
+function make_link($method, $arg, $extra='') {
$id = basename($arg, ".plg").$method;
- $check = $method=='update' ? "" : " ";
+ $check = $method=='remove' ? " " : "";
$disabled = $check ? " disabled" : "";
- $cmd = $method == "delete" ? "/plugins/dynamix.plugin.manager/scripts/plugin_rm&arg1=$arg" : "/plugins/dynamix.plugin.manager/scripts/plugin&arg1=$method&arg2=$arg";
- return "{$check} ";
+ $cmd = $method == "delete" ? "/plugins/dynamix.plugin.manager/scripts/plugin_rm&arg1=$arg" : "/plugins/dynamix.plugin.manager/scripts/plugin&arg1=$method&arg2=$arg".($extra?"&arg3=$extra":"");
+ return "{$check} ";
}
// trying our best to find an icon
@@ -47,4 +47,7 @@ function icon($name) {
// last resort - plugin manager icon
return "plugins/dynamix.plugin.manager/images/dynamix.plugin.manager.png";
}
+function mk_option($select,$value) {
+ return "".ucfirst($value)." ";
+}
?>
diff --git a/plugins/dynamix.plugin.manager/include/ShowPlugins.php b/plugins/dynamix.plugin.manager/include/ShowPlugins.php
index f1fb95b30..adb1bb39a 100644
--- a/plugins/dynamix.plugin.manager/include/ShowPlugins.php
+++ b/plugins/dynamix.plugin.manager/include/ShowPlugins.php
@@ -1,6 +1,6 @@
-$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
+$docroot = $docroot ?: $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Markdown.php";
require_once "$docroot/plugins/dynamix.plugin.manager/include/PluginHelpers.php";
$current = parse_ini_file('/etc/unraid-version');
-foreach (glob("/var/log/plugins/*.plg", GLOB_NOSORT) as $plugin_link) {
-// only consider symlinks
+$stale = $_GET['stale'] ?? false;
+$release = $_GET['release'] ?? false;
+$system = $_GET['system'] ?? false;
+$empty = true;
+$nofetch = false;
+$builtin = ['unRAIDServer','dynamix'];
+$https = ['stable' => 'https://raw.github.com/limetech/\&name;/master/\&name;.plg',
+ 'next' => 'https://s3.amazonaws.com/dnld.lime-technology.com/\&category;/\&name;.plg'];
+
+foreach (glob("/var/log/plugins/*.plg",GLOB_NOSORT) as $plugin_link) {
+//only consider symlinks
$plugin_file = @readlink($plugin_link);
if ($plugin_file === false) continue;
-// plugin name
- $name = plugin("name", $plugin_file);
- if ($name === false) $name = basename($plugin_file, ".plg");
-// link/icon
+//plugin name
+ $name = plugin('name',$plugin_file) ?: basename($plugin_file,".plg");
+ $custom = in_array($name,$builtin);
+//switch between system and custom plugins
+ if (($system && !$custom) || (!$system && $custom)) continue;
+//forced plugin check?
+ if ($stale || $system) plugin('check',$name.'.plg');
+//OS update?
+ $os = $system && $name==$builtin[0];
+ $toggle = false;
+//toggle stable/next release?
+ if ($os && $release) {
+ $toggle = plugin('version',$plugin_file);
+ $tmp_plg = "$name-.plg";
+ $tmp_file = "/var/tmp/$name.plg";
+ copy($plugin_file,$tmp_file);
+ exec("sed -ri 's|^(|' $tmp_file");
+ symlink($tmp_file,"/var/log/plugins/$tmp_plg");
+ plugin('check',$tmp_plg);
+ copy("/tmp/plugins/$tmp_plg",$tmp_file);
+ $plugin_file = $tmp_file;
+ }
+//link/icon
$icon = icon($name);
- if ($launch = plugin("launch", $plugin_file))
- $link = " ";
+ if ($launch = plugin('launch',$plugin_file))
+ $link = " ";
else
- $link = " ";
-// desc
+ $link = " ";
+//description
$readme = "plugins/{$name}/README.md";
if (file_exists($readme))
$desc = Markdown(file_get_contents($readme));
else
$desc = Markdown("**{$name}**");
-// author
- $author = plugin("author", $plugin_file);
- if ($author === false) $author = "anonymous";
-// version
- $version = plugin("version", $plugin_file);
- if ($version === false) $version = "unknown";
-// version info
- $version_info = $version;
-// status info
- $status_info = "no update";
+//author
+ $author = plugin('author',$plugin_file) ?: "anonymous";
+//version
+ $version = plugin('version',$plugin_file) ?: "unknown";
+//category
+ $cat = strpos($version,'rc')!==false ? 'next' : 'stable';
+//status
+ $status = 'no update';
$changes_file = $plugin_file;
- $URL = plugin("pluginURL", $plugin_file);
+ $URL = plugin('pluginURL',$plugin_file);
if ($URL !== false) {
- $filename = "/tmp/plugins/".basename($URL);
+ $filename = "/tmp/plugins/".(($os && $release) ? $tmp_plg : basename($URL));
if (file_exists($filename)) {
- $latest = plugin("version", $filename);
- if (strcmp($latest, $version) > 0) {
- $unRAID = plugin("unRAID", $filename);
- if ($unRAID === false || version_compare($current['version'], $unRAID, '>=')) {
- $version_info .= "{$latest} ";
- $status_info = make_link("update", basename($plugin_file));
- $changes_file = $filename;
- } else {
- $status_info = "up-to-date";
- }
+ if ($toggle && $toggle != $version) {
+ $status = make_link('install',$plugin_file,'forced');
} else {
- $status_info = "up-to-date";
+ $latest = plugin('version',$filename);
+ if (strcmp($latest,$version) > 0) {
+ $unRAID = plugin('unRAID',$filename);
+ if ($unRAID === false || version_compare($current['version'],$unRAID,'>=')) {
+ $version .= "{$latest} ";
+ $status = make_link("update",basename($plugin_file));
+ $changes_file = $filename;
+ } else {
+ $status = "up-to-date";
+ }
+ } else {
+ $status = "up-to-date";
+ }
}
} else {
- if ($_GET['stale']) $status_info = "unknown";
+ if ($stale) $status = "unknown";
}
+ $nofetch |= ($status == 'no update');
}
- $changes = plugin("changes", $changes_file);
+ $changes = plugin('changes',$changes_file);
if ($changes !== false) {
$txtfile = "/tmp/plugins/".basename($plugin_file,'.plg').".txt";
- file_put_contents($txtfile, $changes);
- $version_info .= " ";
+ file_put_contents($txtfile,$changes);
+ $version .= " ";
}
-// action
- $action = strpos($plugin_file, "$docroot/plugins") !== 0 ? make_link("remove", basename($plugin_file)) : "built-in";
-// write plugin information
+//write plugin information
+ $empty = false;
echo " ";
echo "{$link}
";
echo "{$desc} ";
echo "{$author} ";
- echo "{$version_info} ";
- echo "{$status_info} ";
- echo "{$action} ";
+ echo "{$version} ";
+ echo "{$status} ";
+ echo "";
+ if ($system) {
+ if ($os) {
+ echo "";
+ echo mk_option($cat,'stable');
+ echo mk_option($cat,'next');
+ echo " ";
+ }
+ } else {
+ echo make_link('remove',basename($plugin_file));
+ }
+ echo " ";
echo " ";
+//remove temporary symlink
+ @unlink("/var/log/plugins/$tmp_plg");
}
+if ($empty) echo " No plugins installed";
+elseif ($nofetch) echo " ";
?>
diff --git a/plugins/dynamix.plugin.manager/scripts/plugin b/plugins/dynamix.plugin.manager/scripts/plugin
index 7a0a2f08a..df360e11d 100755
--- a/plugins/dynamix.plugin.manager/scripts/plugin
+++ b/plugins/dynamix.plugin.manager/scripts/plugin
@@ -7,13 +7,15 @@
$usage = <<
.inline_help{display:none}
+.upgrade_notice{position:fixed;top:1px;left:0;width:100%;height:40px;line-height:40px;color:#E68A00;background:#FEEFB3;border-bottom:#E68A00 1px solid;text-align:center;font-size:15px;z-index:999}
+.upgrade_notice i{margin:14px;float:right;cursor:pointer}
$banner = '/boot/config/plugins/dynamix/banner.png';
echo "#header.image{background-image:url(";
@@ -136,7 +138,6 @@ function openBox(cmd,title,height,width,load) {
var options = load ? {modal:true,onClose:function(){location=location;}} : {modal:true};
Shadowbox.open({content:run, player:'iframe', title:title, height:height, width:width, options:options});
}
-
function openWindow(cmd,title,height,width) {
// open regular window (run in background)
var window_name = title.replace(/ /g,"_");
@@ -171,7 +172,19 @@ function showNotice(data,plugin) {
var href = "href=\"#\" onclick=\"openBox('/plugins/dynamix.plugin.manager/scripts/plugin&arg1=update&arg2="+plugin+".plg','Update Plugin',600,900,true)\"";
else
var href = "href=\"/Plugins\"";
- $('#user-notice').html(data.replace(/(.*?)<\/a>/," $1 "));
+ $('#user-notice').html(data.replace(/(.*)<\/a>/," $1 "));
+}
+function showUpgrade(data,plugin) {
+ var href = "href=\"#\" onclick=\"hideUpgrade();openBox('/plugins/dynamix.plugin.manager/scripts/plugin&arg1=update&arg2="+plugin+".plg','Update Plugin',600,900,true)\"";
+ if ($.cookie('os_upgrade')==null)
+ $('.upgrade_notice').html(data.replace(/(.*)<\/a>/," $2 ")+" ").show();
+}
+function hideUpgrade(set) {
+ $('.upgrade_notice').hide();
+ if (set)
+ $.cookie('os_upgrade','true',{path:'/'});
+ else
+ $.removeCookie('os_upgrade',{path:'/'});
}
function notifier() {
var tub1 = 0, tub2 = 0, tub3 = 0;
@@ -272,6 +285,7 @@ $(document).ajaxSend(function(elm, xhr, s){