Merge branch 'unraid:master' into master

This commit is contained in:
Squidly271
2025-04-10 16:23:37 -04:00
committed by GitHub
6 changed files with 54 additions and 32 deletions

View File

@@ -360,10 +360,10 @@ function doAction(action, title, id) {
if (!access.includes(path[0])) return;
var user = /^(user0?|rootshare)$/.test(path[1]);
var root = '/'+path[0]+(user ? '/'+path[1] : '');
var share = user||!path[2]||(link&&path.length==3) ? '' : path[2]+'/';
var share = user || !path[2] || (link && path.length==3) ? '' : path[2]+'/';
var ud = ['disks','remotes'].includes(path[1]); // unassigned devices
var match = ud||user ? '' : '^(?!\\/mnt\\/user0?\\/).*$';
var name = path.pop()||path.pop();
var match = ud || user ? '' : '^(?!\\/mnt\\/(user0?|rootshare)\\/).*$';
var name = path.pop() || path.pop();
var hdlink = "<?=$var['fuse_directio'] == 1 ? '1' : ''?>";
dfm.window = $("#dfm_dialogWindow");
switch (action) {
@@ -625,10 +625,10 @@ function doActions(action, title) {
if (!access.includes(path[0])) return;
var user = /^(user0?|rootshare)$/.test(path[1]);
var root = '/'+path[0]+(user ? '/'+path[1] : '');
var share = user||!path[2] ? '' : path[2]+'/';
var share = user || !path[2] ? '' : path[2]+'/';
var ud = ['disks','remotes'].includes(path[1]); // unassigned devices
var match = ud||user ? '' : '^(?!.*(user0?|rootshare)).*$';
var name = path.pop()||path.pop();
var match = ud || user ? '' : '^(?!\\/mnt\\/(user0?|rootshare)\\/).*$';
var name = path.pop() || path.pop();
var hdlink = "<?=$var['fuse_directio'] == 1 ? '1' : ''?>";
var u = false;
var d = false;

View File

@@ -121,17 +121,25 @@ $names = [];
$SMBpublic = $NFSpublic= 0;
foreach ($sec as $share => $prop) {
if ( $prop['export'] == "-") continue;
if ( $prop['security'] == "public") $SMBpublic++;
if ( ($var['shareDisk']??"") == "no" && $share !=="flash" ) continue;
if ( $prop['security'] == "public") {
if ( $share == "flash" || (! isset($disks[$share]) || (isset($disks[$share]) && ($var['shareDisk']??"") == "yes" && $share !=="flash") ) )
$SMBpublic++;
}
if ( ($var['shareDisk']??"") !== "yes" && $share !=="flash" ) continue;
if ( ! $started && isset($disks[$share]) && $share !=="flash" ) continue;
if ( ! isset($shares[$share]) && isset($disks[$share]) ) {$shares[$share]=$disks[$share]; $shares[$share]['diskexport'] = true;}
if ( (! isset($shares[$share]) && isset($disks[$share]) && ($var['shareDisk']??"") == "yes" ) || $share == "flash" ) {$shares[$share]=$disks[$share]; $shares[$share]['diskexport'] = true;}
}
foreach ($sec_nfs as $share => $prop) {
if ( $prop['export'] == "-") continue;
if ( $prop['security'] == "public") $NFSpublic++;
if ( ($var['shareDisk']??"") == "no" && $share !=="flash" ) continue;
if ( ! $started && isset($disks[$share]) && $share !=="flash" ) continue;
if ( ! isset($shares[$share]) && isset($disks[$share]) ) {$shares[$share]=$disks[$share]; $shares[$share]['diskexport'] = true;}
if ($var['shareNFSEnabled']=='yes') {
foreach ($sec_nfs as $share => $prop) {
if ( $prop['export'] == "-") continue;
if ( $prop['security'] == "public") {
if ( $share == "flash" || (! isset($disks[$share]) || (isset($disks[$share]) && ($var['shareDisk']??"") == "yes" && $share !== "flash" ) ) )
$NFSpublic++;
}
if ( ($var['shareDisk']??"") == "no" && $share !=="flash" ) continue;
if ( ! $started && isset($disks[$share]) && $share !=="flash" ) continue;
if ( ( ! isset($shares[$share]) && isset($disks[$share]) && ($var['shareDisk']??"") == "yes") || $share == "flash" ) {$shares[$share]=$disks[$share]; $shares[$share]['diskexport'] = true;}
}
}
$passwd = $nopass = 0;

View File

@@ -27,15 +27,15 @@
*/
function path($dir) {
return mb_substr($dir,-1)=='/' ? $dir : $dir.'/';
return mb_substr($dir,-1) == '/' ? $dir : $dir.'/';
}
function is_top($dir) {
global $root;
return mb_strlen($dir)>mb_strlen($root);
return mb_strlen($dir) > mb_strlen($root);
}
function is_low($dir) {
global $root;
return mb_substr($dir,0,mb_strlen($root))==$root;
return mb_substr($dir,0,mb_strlen($root)) == $root;
}
$root = path(realpath($_POST['root']));
@@ -47,36 +47,46 @@ require_once "$docroot/webGui/include/Secure.php";
$rootdir = path(realpath($_POST['dir']));
$filters = (array)$_POST['filter'];
$match = $_POST['match'];
$checkbox = $_POST['multiSelect']=='true' ? "<input type='checkbox'>" : "";
$checkbox = $_POST['multiSelect'] == 'true' ? "<input type='checkbox'>" : "";
/* Excluded folders to not show in the dropdown in the '/mnt/' directory only. */
$excludedFolders = ["RecycleBin", "addons", "rootshare", "user0"];
$excludedFolders = ['RecycleBin', 'addons', 'rootshare'];
$udShares = ['addons','disks','remotes'];
echo "<ul class='jqueryFileTree'>";
if ($_POST['show_parent']=='true' && is_top($rootdir)) echo "<li class='directory collapsed'>$checkbox<a href='#' rel=\"".htmlspecialchars(dirname($rootdir))."\">..</a></li>";
if ($_POST['show_parent'] == 'true' && is_top($rootdir)) {
echo "<li class='directory collapsed'>$checkbox<a href='#' rel=\"".htmlspecialchars(dirname($rootdir))."\">..</a></li>";
}
if (is_low($rootdir) && is_dir($rootdir)) {
$dirs = $files = [];
$names = array_filter(scandir($rootdir, SCANDIR_SORT_NONE), function($n) { return $n != '.' && $n != '..'; });
$names = array_filter(scandir($rootdir, SCANDIR_SORT_NONE), function($n){return $n != '.' && $n != '..';});
if (is_top($rootdir)) {
// add unassigned devices top level shares
foreach ($udShares as $name) if (is_dir($rootdir.$name) && !in_array($rootdir.$name, $names)) $names[] = $rootdir.$name;
}
natcasesort($names);
foreach ($names as $name) {
if (is_dir($rootdir . $name)) {
if (is_dir($rootdir.$name)) {
$dirs[] = $name;
} else {
$files[] = $name;
}
}
foreach ($dirs as $name) {
$htmlRel = htmlspecialchars($rootdir . $name);
$htmlName = htmlspecialchars(mb_strlen($name) <= 33 ? $name : mb_substr($name, 0, 30) . '...');
$htmlRel = htmlspecialchars($rootdir.$name);
$htmlName = htmlspecialchars(mb_strlen($name) <= 33 ? $name : mb_substr($name, 0, 30).'...');
/* Exclude '.Recycle.Bin' from all directories */
if ($name === ".Recycle.Bin") continue;
if ($name === '.Recycle.Bin') continue;
/* Exclude folders only when directory is '/mnt/' */
if (in_array($name, $excludedFolders) && $rootdir === "/mnt/") continue;
if (in_array($name, $excludedFolders) && $rootdir === '/mnt/') continue;
echo "<li class='directory collapsed'>$checkbox<a href='#' rel=\"$htmlRel/\">$htmlName</a></li>";
if (empty($match) || preg_match("/$match/", $rootdir.$name.'/')) {
echo "<li class='directory collapsed'>$checkbox<a href='#' rel=\"$htmlRel/\">$htmlName</a></li>";
}
}
foreach ($files as $name) {
$htmlRel = htmlspecialchars($rootdir . $name);

View File

@@ -183,7 +183,7 @@ function array_offline(&$disk, $pool='') {
global $var, $disks, $display;
$disk['power'] ??= (_var($display,'power') && _var($disk,'transport')=='nvme' ? get_nvme_info(_var($disk,'device'),'power') : 0);
$echo = []; $warning = '';
$status = ['DISK_DSBL','DISK_INVALID','DISK_DSBL_NEW','DISK_WRONG'];
$status = ['DISK_INVALID','DISK_DSBL_NEW','DISK_WRONG'];
$text = "<span class='red-text'><em>"._('All existing data on this device will be OVERWRITTEN when array is Started')."</em></span>";
if (_var($disk,'type')=='Cache') {
if (!str_contains(_var($disks[$pool],'state'),'ERROR:')) {

View File

@@ -34,7 +34,7 @@ if (is_file('/boot/syslinux/syslinux.cfg')) {
$bootenv = '/boot/grub';
}
$folders = ['/boot','/boot/config','/boot/config/plugins',$bootenv,'/var/log','/var/log/plugins','/boot/extra','/var/log/packages','/var/lib/pkgtools/packages','/tmp'];
$folders = ['/boot','/boot/config','/boot/config/plugins','/boot/config/firmware',$bootenv,'/var/log','/var/log/plugins','/boot/extra','/var/log/packages','/var/lib/pkgtools/packages','/tmp'];
// global variables
$path = "/var/local/emhttp";

View File

@@ -35,10 +35,14 @@ TMP=/var/tmp/network.tmp
# run & log functions
. /etc/rc.d/rc.runlog
carrier(){
cat $SYSTEM/$1/carrier 2>/dev/null
}
# determine active port name
[[ -e $SYSTEM/bond0 ]] && PORT=bond0 || PORT=eth0
[[ -e $SYSTEM/br0 ]] && PORT=br0
[[ $(cat $SYSTEM/$PORT/carrier) == 0 && -e $SYSTEM/wlan0 && $(cat $SYSTEM/wlan0/carrier) == 1 ]] && PORT=wlan0
[[ $(carrier $PORT) != 1 && -e $SYSTEM/wlan0 && $(carrier wlan0) == 1 ]] && PORT=wlan0
# Set defaults used by the docker daemon
if [[ -f $DOCKER_CFG ]]; then
@@ -250,7 +254,7 @@ docker_network_start(){
fi
X=${NIC//[^0-9]/}
REF=$(grep -Pom1 "<Network>\K(br|bond|eth|wlan)$X" $XMLFILE)
[[ $X == 0 && $(cat $SYSTEM/$NIC/carrier) == 0 ]] && continue
[[ $X == 0 && $(carrier $NIC) != 1 ]] && continue
[[ $X == 0 && $NIC != wlan0 ]] && MAIN=$NIC
[[ $NIC == wlan0 && -n $MAIN ]] && continue
if [[ -n $REF && $REF != $NIC ]]; then