Merge branch 'master' into master

This commit is contained in:
bergware
2025-01-27 20:57:48 +01:00
committed by GitHub
11 changed files with 125 additions and 55 deletions

View File

@@ -447,7 +447,7 @@ if (!empty($TS_no_peers) && !empty($TS_container)) {
}
// Construct WebUI URL on container template page
// Check if webui_url, Tailscale WebUI and MagicDNS are not empty and make sure that MagicDNS is enabled
if (!empty($webui_url) && !empty($xml['TailscaleWebUI']) && (!empty($TS_no_peers['CurrentTailnet']['MagicDNSEnabled']) || $TS_no_peers['CurrentTailnet']['MagicDNSEnabled'])) {
if ( !empty($webui_url) && !empty($xml['TailscaleWebUI']) && (!empty($TS_no_peers['CurrentTailnet']['MagicDNSEnabled']) || ($TS_no_peers['CurrentTailnet']['MagicDNSEnabled']??false))) {
// Check if serve or funnel are enabled by checking for [hostname] and replace string with TS_DNSName
if (!empty($xml['TailscaleWebUI']) && strpos($xml['TailscaleWebUI'], '[hostname]') !== false && isset($TS_DNSName)) {
$TS_webui_url = str_replace("[hostname][magicdns]", rtrim($TS_DNSName, '.'), $xml['TailscaleWebUI']);
@@ -1335,7 +1335,7 @@ _(Tailscale WebUI)_:
<div markdown="1" class="TSroutes noshow">
_(Tailscale Advertise Routes)_:
: <input type="text" pattern="[0-9:., ]*" name="TSroutes" <?php if (!empty($xml['TailscaleRoutes'])) echo 'value="' . $xml['TailscaleRoutes'] . '"'?> placeholder="_(Leave empty if unsure)_">
: <input type="text" pattern="[0-9:., \/]*" name="TSroutes" <?php if (!empty($xml['TailscaleRoutes'])) echo 'value="' . $xml['TailscaleRoutes'] . '"'?> placeholder="_(Leave empty if unsure)_">
:docker_tailscale_advertise_routes_help:

View File

@@ -245,8 +245,8 @@ foreach ($containers as $ct) {
$TS_version = explode('-', $TSstats["Version"])[0];
if (!empty($TS_version)) {
if (!empty($TS_latest_version)) {
if ($TS_version !== $TS_latest_version) {
$TSinfo .= "<div class='ui-tailscale-row'><span class='ui-tailscale-label'>"._("Tailscale").":</span><span class='ui-tailscale-value'>v".$TS_version." &#10132; v".$TS_latest_version." "._("available")."!</span></div>";
if (version_compare($TS_version, $TS_latest_version, '<')) {
$TSinfo .= "<div class='ui-tailscale-row'><span class='ui-tailscale-label'>"._("Tailscale:")."</span><span class='ui-tailscale-value'>v" . $TS_version . " &#10132; v" . $TS_latest_version . " "._("available!")."</span></div>";
} else {
$TSinfo .= "<div class='ui-tailscale-row'><span class='ui-tailscale-label'>"._("Tailscale").":</span><span class='ui-tailscale-value'>v".$TS_version."</span></div>";
}

View File

@@ -406,8 +406,14 @@ function xmlToCommand($xml, $create_paths=false) {
$TS_routes = !empty($xml['TailscaleRoutes']) ? '-e TAILSCALE_ADVERTISE_ROUTES=' . escapeshellarg($xml['TailscaleRoutes']) : '';
$TS_accept_routes = !empty($xml['TailscaleAcceptRoutes']) && $xml['TailscaleAcceptRoutes'] === 'true' ? '-e TAILSCALE_ACCEPT_ROUTES=true' : '';
if (!empty($xml['PostArgs'])) {
$TS_postargs = '-e ORG_POSTARGS=' . escapeshellarg($xml['PostArgs']);
$xml['PostArgs'] = '';
$split_PostArgs = strpos($xml['PostArgs'], ';');
if ($split_PostArgs !== false) {
$TS_postargs = !empty(substr($xml['PostArgs'], 0, $split_PostArgs)) ? '-e ORG_POSTARGS=' . escapeshellarg(substr($xml['PostArgs'], 0, $split_PostArgs)) : '';
$xml['PostArgs'] = ';' . substr($xml['PostArgs'], $split_PostArgs + 1);
} else {
$TS_postargs = '-e ORG_POSTARGS=' . escapeshellarg($xml['PostArgs']);
$xml['PostArgs'] = '';
}
}
}

View File

@@ -113,7 +113,7 @@ foreach ($vms as $vm) {
unset($dom);
if (!isset($domain_cfg["CONSOLE"])) $vmrcconsole = "web" ; else $vmrcconsole = $domain_cfg["CONSOLE"] ;
if (!isset($domain_cfg["RDPOPT"])) $vmrcconsole .= ";no" ; else $vmrcconsole .= ";".$domain_cfg["RDPOPT"] ;
$menu = sprintf("onclick=\"addVMContext('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s', '%s')\"", htmlentities($vm, ENT_QUOTES),addslashes($uuid),addslashes($template),$state,addslashes($vmrcurl),strtoupper($vmrcprotocol),htmlentities($log,ENT_QUOTES),addslashes($fstype), $vmrcconsole,false,addslashes(str_replace('"',"'",$WebUI)));
$menu = sprintf("onclick=\"addVMContext('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s', '%s')\"", addslashes($vm),addslashes($uuid),addslashes($template),$state,addslashes($vmrcurl),strtoupper($vmrcprotocol),addslashes($log),addslashes($fstype), $vmrcconsole,false,addslashes(str_replace('"',"'",$WebUI)));
$kvm[] = "kvm.push({id:'$uuid',state:'$state'});";
switch ($state) {
case 'running':

View File

@@ -866,7 +866,7 @@
_(Boot Order)_:
<input type="number" size="5" maxlength="5" id="disk[<?=$i?>][boot]" class="narrow bootorder" style="width: 50px;" name="disk[<?=$i?>][boot]" title="_(Boot order)_" value="<?=$arrDisk['boot']?>" >
_(Discard)_:
<select name="disk[<?=$i?>][discard]" class="disk_driver narrow" title="_(Set discard option)_">
<select name="disk[<?=$i?>][discard]" class="narrow" title="_(Set discard option)_">
<?mk_dropdown_options($arrValidDiskDiscard, $arrDisk['discard']);?>
</select>
<? if ($arrDisk['bus'] == "virtio" || $arrDisk['bus'] == "usb") $ssddisabled = "hidden "; else $ssddisabled = " ";?>
@@ -1029,7 +1029,7 @@
_(Boot Order)_:
<input type="number" size="5" maxlength="5" id="disk[{{INDEX}}][boot]" class="narrow bootorder" style="width: 50px;" name="disk[{{INDEX}}][boot]" title="_(Boot order)_" value="" >
_(Discard)_:
<select name="disk[{{INDEX}}][discard]" class="disk_driver narrow" title="_(Set discard option)_">
<select name="disk[{{INDEX}}][discard]" class="narrow" title="_(Set discard option)_">
<?mk_dropdown_options($arrValidDiskDiscard, "unmap");?>
</select>
<span id="disk[{{INDEX}}][rotatetext]" hidden>_(SSD)_:</span>

View File

@@ -156,7 +156,7 @@ if ($_POST['vms']) {
if (!isset($domain_cfg["CONSOLE"])) $vmrcconsole = "web"; else $vmrcconsole = $domain_cfg["CONSOLE"];
if (!isset($domain_cfg["RDPOPT"])) $vmrcconsole .= ";no"; else $vmrcconsole .= ";".$domain_cfg["RDPOPT"];
$WebUI = html_entity_decode($arrConfig["template"]["webui"]);
$menu = sprintf("onclick=\"addVMContext('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')\"", htmlentities($vm,ENT_QUOTES), addslashes($uuid), addslashes($template), $state, addslashes($vmrcurl), strtoupper($vmrcprotocol), htmlentities($log,ENT_QUOTES),addslashes($fstype), $vmrcconsole,false,addslashes(str_replace('"',"'",$WebUI)));
$menu = sprintf("onclick=\"addVMContext('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')\"", addslashes($vm), addslashes($uuid), addslashes($template), $state, addslashes($vmrcurl), strtoupper($vmrcprotocol), addslashes($log),addslashes($fstype), $vmrcconsole,false,addslashes(str_replace('"',"'",$WebUI)));
$icon = $lv->domain_get_icon_url($res);
switch ($state) {
case 'running':

View File

@@ -50,7 +50,7 @@ $match = $_POST['match'];
$checkbox = $_POST['multiSelect']=='true' ? "<input type='checkbox'>" : "";
/* Excluded folders to not show in the dropdown in the '/mnt/' directory only. */
$excludedFolders = ["RecycleBin", "addons", "remotes", "rootshare", "user0"];
$excludedFolders = ["RecycleBin", "addons", "rootshare", "user0"];
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>";

View File

@@ -271,7 +271,7 @@ foreach ($shares as $name => $share) {
}
}
echo "<tr><td><a class='view' href=\"/$path/Browse?dir=/mnt/user/", rawurlencode($name), "\"><i class=\"icon-u-tab\" title=\"", _('Browse'), " /mnt/user/" . rawurlencode($name), "\"></i></a>";
echo "<tr><td><a class='view' href=\"/$path/Browse?dir=/mnt/user/", htmlspecialchars($name), "\"><i class=\"icon-u-tab\" title=\"", _('Browse'), " /mnt/user/" . htmlspecialchars($name), "\"></i></a>";
echo "<a class='info nohand' onclick='return false'><i class='fa fa-$orb orb $color-orb'></i><span style='left:18px'>$help</span></a>$luks<a href=\"/$path/Share?name=";
echo rawurlencode($name), "\" onclick=\"$.cookie('one','tab1')\">$name</a></td>";
echo "<td>", htmlspecialchars(_var($share,'comment')), "</td>";

View File

@@ -149,6 +149,8 @@ obsolete "NerdPack" "2021.08.11"
obsolete "upnp-monitor" "2020.01.04c"
# ZFS-Companion Monitor by campusantu, breaks the dashboard
obsolete "ZFS-companion" "2021.08.24"
# Folder View - Latest versions are only compatible with 7.x Older versions have issues
obsolete "folder.view" "2024.10.02"
# If "unraidsafemode" indicated, skip installing extra packages and plugins
if [[ -f /boot/unraidsafemode ]] || grep -wq unraidsafemode /proc/cmdline; then

View File

@@ -72,7 +72,7 @@ start() {
else
# secondary is the unRAID array
if [[ -n $shareCachePool && -d "/mnt/$shareCachePool" ]]; then
for SHAREPATH in /mnt/disk[1-9]/$SHARE/ /mnt/disk[1-9][0-9]/$SHARE/ ; do
for SHAREPATH in /mnt/disk[1-9]/"$SHARE"/ /mnt/disk[1-9][0-9]/"$SHARE"/ ; do
move "$SHAREPATH"
done
fi

View File

@@ -1,6 +1,6 @@
#!/bin/sh
# Copyright 2024, Lime Technology
# Copyright 2024, Christoph Hummer
# Copyright 2024-2025, Lime Technology
# Copyright 2024-2025, Christoph Hummer
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 2,
@@ -18,10 +18,12 @@ exec_entrypoint() {
}
error_handler() {
echo "ERROR: Unraid Docker Hook script throw an error!"
echo " Starting container without Tailscale!"
echo
exec_entrypoint
if [ "${DISABLE_ERROR_HANDLER}" != "true" ]; then
echo "ERROR: Unraid Docker Hook script throw an error!"
echo " Starting container without Tailscale!"
echo
exec_entrypoint
fi
}
echo "======================="
@@ -34,7 +36,14 @@ if [ "$(id -u)" != "0" ]; then
error_handler
fi
if [ ! -f /usr/bin/tailscale ] || [ ! -f /usr/bin/tailscaled ]; then
if [ -f /usr/local/bin/tailscale ] || [ -f /usr/local/bin/tailscaled ]; then
echo "Official Tailscale Sidecar container detected!"
echo
OFFICIAL_TS_SIDECAR="true"
apk update >/dev/null 2>&1
apk add jq >/dev/null 2>&1
elif [ ! -f /usr/bin/tailscale ] || [ ! -f /usr/bin/tailscaled ]; then
OFFICIAL_TS_SIDECAR="false"
if [ ! -z "${TAILSCALE_EXIT_NODE_IP}" ]; then
if [ ! -c /dev/net/tun ]; then
echo "ERROR: Device /dev/net/tun not found!"
@@ -78,7 +87,7 @@ if [ ! -f /usr/bin/tailscale ] || [ ! -f /usr/bin/tailscaled ]; then
if [ ! -z "${PACKAGES_UPDATE}" ]; then
UPDATE_LOG=$(${PACKAGES_UPDATE} 2>&1)
fi
INSTALL_LOG=$(${PACKAGES_INSTALL} jq wget ${INSTALL_IPTABLES}${PACKAGES_TROUBLESHOOTING} 2>&1)
INSTALL_LOG=$(${PACKAGES_INSTALL} jq wget ca-certificates ${INSTALL_IPTABLES}${PACKAGES_TROUBLESHOOTING} 2>&1)
INSTALL_RESULT=$?
if [ "${INSTALL_RESULT}" -eq 0 ]; then
@@ -128,13 +137,22 @@ if [ ! -f /usr/bin/tailscale ] || [ ! -f /usr/bin/tailscaled ]; then
echo "Installation Done!"
else
OFFICIAL_TS_SIDECAR="false"
echo "Tailscale found, continuing..."
fi
unset TSD_PARAMS
unset TS_PARAMS
if [ ! -z "${TAILSCALE_STATE_DIR}" ]; then
if [ "${OFFICIAL_TS_SIDECAR}" = "true" ]; then
if [ -z "${TS_STATE_DIR}" ]; then
echo "No Tailscale State Directory specified, falling back to: /var/lib/tailscale"
export TS_STATE_DIR="/var/lib/tailscale"
else
export TS_STATE_DIR="${TS_STATE_DIR}"
fi
TSD_STATE_DIR="${TS_STATE_DIR}"
elif [ ! -z "${TAILSCALE_STATE_DIR}" ]; then
TSD_STATE_DIR="${TAILSCALE_STATE_DIR}"
elif [ ! -z "${SERVER_DIR}" ]; then
TSD_STATE_DIR="${SERVER_DIR}/.tailscale_state"
@@ -146,8 +164,8 @@ elif [ -d "/config" ]; then
TSD_STATE_DIR="/config/.tailscale_state"
elif [ -d "/data" ]; then
TSD_STATE_DIR="/data/.tailscale_state"
elif [ ! -z "${TAILSCALE_FALLBACK_DIR}" ]; then
TSD_STATE_DIR="${TAILSCALE_FALLBACK_DIR}/.tailscale_state"
elif [ ! -z "${CA_TS_FALLBACK_DIR}" ]; then
TSD_STATE_DIR="${CA_TS_FALLBACK_DIR}/.tailscale_state"
else
echo "ERROR: Couldn't detect persistent Docker directory for .tailscale_state!"
echo " Please enable Tailscale Advanced Settings in the Docker template and set the Tailscale State Directory manually!"
@@ -155,7 +173,7 @@ else
fi
echo "Settings Tailscale state dir to: ${TSD_STATE_DIR}"
if [ ! -d "${TSD_STATE_DIR}" ]; then
if [ ! -z "${TSD_STATE_DIR}" ] && [ ! -d "${TSD_STATE_DIR}" ]; then
mkdir -p ${TSD_STATE_DIR}
fi
@@ -197,12 +215,14 @@ if [ "${TAILSCALE_USE_SSH}" = "true" ]; then
TS_PARAMS="${TS_PARAMS} --ssh"
fi
if [ "${TAILSCALE_LOG}" != "false" ]; then
TSD_PARAMS="${TSD_PARAMS} >>/var/log/tailscaled 2>&1 "
TSD_MSG=" with log file location: /var/log/tailscaled"
else
TSD_PARAMS="${TSD_PARAMS} >/dev/null 2>&1 "
TSD_MSG=" with logging disabled"
if [ "${OFFICIAL_TS_SIDECAR}" != "true" ]; then
if [ "${TAILSCALE_LOG}" != "false" ]; then
TSD_PARAMS="${TSD_PARAMS} >>/var/log/tailscaled 2>&1 "
TSD_MSG=" with log file location: /var/log/tailscaled"
else
TSD_PARAMS="${TSD_PARAMS} >/dev/null 2>&1 "
TSD_MSG=" with logging disabled"
fi
fi
if [ ! -z "${TAILSCALE_HOSTNAME}" ]; then
@@ -211,35 +231,72 @@ if [ ! -z "${TAILSCALE_HOSTNAME}" ]; then
TS_PARAMS="${TS_PARAMS} --hostname=${TAILSCALE_HOSTNAME}"
fi
if [ "${OFFICIAL_TS_SIDECAR}" = "true" ]; then
if [ ! -z "${TAILSCALE_HOSTNAME}" ]; then
export TS_STATE_DIR="${TS_STATE_DIR}/${TAILSCALE_HOSTNAME}"
TSD_STATE_DIR="${TS_STATE_DIR}/${TAILSCALE_HOSTNAME}"
else
export TS_STATE_DIR="${TS_STATE_DIR}/$(hostname)"
TSD_STATE_DIR="${TS_STATE_DIR}/$(hostname)"
fi
fi
if [ "${TAILSCALE_EXIT_NODE}" = "true" ]; then
echo "Configuring container as Exit Node! See https://tailscale.com/kb/1103/exit-nodes"
TS_PARAMS="${TS_PARAMS} --advertise-exit-node"
fi
if [ ! -z "${TAILSCALED_PARAMS}" ]; then
TSD_PARAMS="${TAILSCALED_PARAMS} ${TSD_PARAMS}"
fi
if [ ! -z "${TAILSCALE_PARAMS}" ]; then
TS_PARAMS="${TAILSCALE_PARAMS}${TS_PARAMS}"
fi
echo "Starting tailscaled${TSD_MSG}"
eval tailscaled -statedir=${TSD_STATE_DIR} ${TSD_PARAMS}&
echo "Starting tailscale"
eval tailscale up ${TS_PARAMS} --reset
EXIT_STATUS="$?"
if [ "${EXIT_STATUS}" != "0" ]; then
echo "ERROR: Connecting to Tailscale not successful!"
if [ -f /var/log/tailscaled ]; then
echo "Please check the logs:"
tail -20 /var/log/tailscaled
if [ "${OFFICIAL_TS_SIDECAR}" = "true" ]; then
if [ ! -z "${TAILSCALED_PARAMS}" ]; then
export TS_TAILSCALED_EXTRA_ARGS="${TAILSCALED_PARAMS} ${TSD_PARAMS}"
else
export TS_TAILSCALED_EXTRA_ARGS="${TSD_PARAMS}"
fi
if [ ! -z "${TAILSCALE_PARAMS}" ]; then
export TS_EXTRA_ARGS="${TAILSCALE_PARAMS}${TS_PARAMS}"
else
export TS_EXTRA_ARGS="${TS_PARAMS}"
fi
exec_entrypoint &
TAILSCALE_PID=$!
else
if [ ! -z "${TAILSCALED_PARAMS}" ]; then
TSD_PARAMS="${TAILSCALED_PARAMS} ${TSD_PARAMS}"
fi
if [ ! -z "${TAILSCALE_PARAMS}" ]; then
TS_PARAMS="${TAILSCALE_PARAMS}${TS_PARAMS}"
fi
error_handler
fi
unset EXIT_STATUS
if [ "${OFFICIAL_TS_SIDECAR}" != "true" ]; then
echo "Starting tailscaled${TSD_MSG}"
eval tailscaled -statedir=${TSD_STATE_DIR} ${TSD_PARAMS}&
echo "Starting tailscale"
eval tailscale up ${TS_PARAMS} --reset
EXIT_STATUS="$?"
if [ "${EXIT_STATUS}" != "0" ]; then
echo "ERROR: Connecting to Tailscale not successful!"
if [ -f /var/log/tailscaled ]; then
echo "Please check the logs:"
tail -20 /var/log/tailscaled
fi
error_handler
fi
unset EXIT_STATUS
else
DISABLE_ERROR_HANDLER="true"
sleep 2
fi
while true; do
TAILSCALE_ONLINE=$(tailscale status --json | jq '.Self.Online')
if [ "${TAILSCALE_ONLINE}" = "true" ]; then
break
fi
sleep 2
done
if [ ! -z "${TAILSCALE_SERVE_PORT}" ] && [ "$(tailscale status --json | jq -r '.CurrentTailnet.MagicDNSEnabled')" != "false" ] && [ -z "$(tailscale status --json | jq -r '.Self.Capabilities[] | select(. == "https")')" ]; then
echo "ERROR: Enable MagicDNS and HTTPS on your Tailscale account to use Tailscale Serve/Funnel."
@@ -320,7 +377,7 @@ if [ ! -z "${TAILSCALE_SERVE_PORT}" ]; then
echo "Generating Tailscale certs! This can take some time, please wait..."
timeout 30 tailscale cert --cert-file="${TSD_STATE_DIR}/certs/${TS_DNSNAME}.crt" --key-file="${TSD_STATE_DIR}/certs/${TS_DNSNAME}.key" "${TS_DNSNAME}" >/dev/null 2>&1
EXIT_STATUS="$?"
if [ "${EXIT_STATUS}" != "0" ]; then
if [ "${EXIT_STATUS}" != "0" ] && [ "${OFFICIAL_TS_SIDECAR}" != "true" ]; then
echo "ERROR: Can't generate certificates!"
echo "Please check the logs:"
tail -10 /var/log/tailscaled
@@ -332,4 +389,9 @@ if [ ! -z "${TAILSCALE_SERVE_PORT}" ]; then
fi
fi
exec_entrypoint
if [ "${OFFICIAL_TS_SIDECAR}" != "true" ]; then
exec_entrypoint
else
trap "kill -SIGTERM ${TAILSCALE_PID}; exit 0" SIGTERM
wait "${TAILSCALE_PID}"
fi