mirror of
https://github.com/unraid/webgui.git
synced 2026-05-20 05:09:38 -05:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -54,7 +54,6 @@ sftp-config.json
|
||||
|
||||
# =========================
|
||||
# Exclude these dirs commonly found in /usr/local
|
||||
bin/
|
||||
games/
|
||||
info/
|
||||
lib64/
|
||||
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
/usr/libexec/unraid/firefox-119.0.r20231019122658-x86_64.AppImage
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
/usr/libexec/unraid/unraidwold
|
||||
@@ -1801,7 +1801,7 @@
|
||||
}
|
||||
|
||||
function domain_define($xml, $autostart=false) {
|
||||
if (strpos($xml,'<qemu:commandline>')) {
|
||||
if (strpos($xml,'<qemu:commandline>') || strpos($xml,'<qemu:override>')) {
|
||||
$tmp = explode("\n", $xml);
|
||||
for ($i = 0; $i < sizeof($tmp); $i++)
|
||||
if (strpos('.'.$tmp[$i], "<domain type='kvm'") || strpos('.'.$tmp[$i], '<domain type="kvm"'))
|
||||
|
||||
@@ -1330,7 +1330,12 @@ private static $encoding = 'UTF-8';
|
||||
}
|
||||
|
||||
if ($lv->domain_get_boot_devices($res)[0] == "fd") $osbootdev = "Yes" ; else $osbootdev = "No" ;
|
||||
|
||||
$cmdline = null;
|
||||
$QEMUCmdline = getQEMUCmdLine($strDOMXML);
|
||||
$QEMUOverride = getQEMUOverride($strDOMXML);
|
||||
if (isset($QEMUCmdline)) $cmdline = $QEMUCmdline;
|
||||
if (isset($QEMUOverride) && isset($QEMUCmdline)) $cmdline .= "\n".$QEMUOverride;
|
||||
if (isset($QEMUOverride) && !isset($QEMUCmdline)) $cmdline = $QEMUOverride;
|
||||
return [
|
||||
'template' => $arrTemplateValues,
|
||||
'domain' => [
|
||||
@@ -1370,7 +1375,7 @@ private static $encoding = 'UTF-8';
|
||||
'nic' => $arrNICs,
|
||||
'usb' => $arrUSBDevs,
|
||||
'shares' => $lv->domain_get_mount_filesystems($res),
|
||||
'qemucmdline' => getQEMUCmdLine($strDOMXML),
|
||||
'qemucmdline' => $cmdline,
|
||||
'clocks' => getClocks($strDOMXML)
|
||||
];
|
||||
}
|
||||
@@ -1564,6 +1569,18 @@ private static $encoding = 'UTF-8';
|
||||
return substr($xml,$x, ($z + 19) -$x) ;
|
||||
}
|
||||
|
||||
function getQEMUOverride($xml) {
|
||||
$x = strpos($xml,"<qemu:override>", 0) ;
|
||||
if ($x === false) return null ;
|
||||
$y = strpos($xml,"</qemu:override>", 0) ;
|
||||
$z=$y ;
|
||||
while ($y!=false) {
|
||||
$y = strpos($xml,"<qemu:override>", $z +16) ;
|
||||
if ($y != false) $z =$y ;
|
||||
}
|
||||
return substr($xml,$x, ($z + 16) -$x) ;
|
||||
}
|
||||
|
||||
function getchannels($res) {
|
||||
global $lv ;
|
||||
$xml = $lv->domain_get_xml($res) ;
|
||||
|
||||
@@ -1913,8 +1913,8 @@ $(function() {
|
||||
$('.advancedview').change(function () {
|
||||
if ($(this).is(':checked')) {
|
||||
setTimeout(function() {
|
||||
var xmlPanelHeight = window.outerHeight - 550;
|
||||
if (xmlPanelHeight < 0) xmlPanelHeight = null;
|
||||
var xmlPanelHeight = window.outerHeight;
|
||||
if (xmlPanelHeight > 1024) xmlPanelHeight = xmlPanelHeight-550;
|
||||
editor.setSize(null,xmlPanelHeight);
|
||||
editor.refresh();
|
||||
}, 100);
|
||||
|
||||
@@ -624,4 +624,54 @@ done
|
||||
]]>
|
||||
</Script>
|
||||
</Agent>
|
||||
<Agent>
|
||||
<Name>Wxwork</Name>
|
||||
<Variables>
|
||||
<Variable Help="企业微信的企业ID" Desc="CropId" Default="企业ID">CropId</Variable>
|
||||
<Variable Help="企业微信应用ID" Desc="AgentId" Default="应用ID">AgentId</Variable>
|
||||
<Variable Help="企业微信应用的Secret" Desc="Secret" Default="应用Secret">Secret</Variable>
|
||||
<Variable Help="企业微信的代理通知url[b]http://xxx.com/[/b],nginx的反代,主要是为了让出口IP固定" Desc="ProxyUrl" Default="代理地址">ProxyUrl</Variable>
|
||||
<Variable Help="Specify the fields which are included in the title of the notification." Desc="Notification Title" Default="$SUBJECT">TITLE</Variable>
|
||||
<Variable Help="Specify the fields which are included in the message body of the notification." Desc="Notification Message" Default="$DESCRIPTION">MESSAGE</Variable>
|
||||
</Variables>
|
||||
<Script>
|
||||
<![CDATA[
|
||||
#!/bin/bash
|
||||
############
|
||||
{0}
|
||||
############
|
||||
# Markdown newline style for message content
|
||||
TITLE=$(echo -e "$SUBJECT")
|
||||
MESSAGE=$(echo -e "$DESCRIPTION")
|
||||
CORP_ID=$(echo -e "$CropId")
|
||||
APP_SECRET=$(echo -e "$Secret")
|
||||
TO_USER="@all"
|
||||
AGENT_ID=$(echo -e "$AgentId")
|
||||
|
||||
# 获取 access token
|
||||
ACCESS_TOKEN=\$(curl -s -G "$proxy_url/cgi-bin/gettoken" \
|
||||
-d "corpid=\$CORP_ID" \
|
||||
-d "corpsecret=\$APP_SECRET" | jq -r '.access_token')
|
||||
|
||||
# 发送消息
|
||||
send_message() {
|
||||
local message="[Unraid]->[\$TITLE]\\n\$MESSAGE"
|
||||
curl -s -H "Content-Type: application/json" -X POST \
|
||||
"$ProxyUrl/cgi-bin/message/send?access_token=\$ACCESS_TOKEN" \
|
||||
-d "{
|
||||
\"touser\": \"\$TO_USER\",
|
||||
\"msgtype\": \"text\",
|
||||
\"agentid\": \"\$AGENT_ID\",
|
||||
\"text\": {
|
||||
\"content\": \"\$message\"
|
||||
},
|
||||
\"safe\":0
|
||||
}"
|
||||
}
|
||||
|
||||
# 调用发送消息函数
|
||||
send_message
|
||||
]]>
|
||||
</Script>
|
||||
</Agent>
|
||||
</Agents>
|
||||
|
||||
@@ -180,16 +180,22 @@ function http_get_contents(string $url, array $opts = [], array &$getinfo = NULL
|
||||
}
|
||||
}
|
||||
$out = curl_exec($ch);
|
||||
if(isset($getinfo)) {
|
||||
if (curl_errno($ch) == 23) {
|
||||
// error 23 detected, try CURLOPT_ENCODING = null
|
||||
curl_setopt($ch, CURLOPT_ENCODING, null);
|
||||
$out = curl_exec($ch);
|
||||
}
|
||||
if (isset($getinfo)) {
|
||||
$getinfo = curl_getinfo($ch);
|
||||
}
|
||||
if (curl_errno($ch)) {
|
||||
$msg = curl_error($ch) . " {$url}";
|
||||
if ($errno = curl_errno($ch)) {
|
||||
$msg = "Curl error $errno: " . (curl_error($ch) ?: curl_strerror($errno)) . ". Requested url: '$url'";
|
||||
if(isset($getinfo)) {
|
||||
$getinfo['error'] = $msg;
|
||||
}
|
||||
my_logger($msg, "http_get_contents");
|
||||
}
|
||||
curl_close($ch);
|
||||
return $out;
|
||||
}
|
||||
/**
|
||||
|
||||
+1
-1
@@ -100,7 +100,7 @@ if /sbin/blkid -s TYPE $DEVICE | /bin/grep -q "btrfs" ; then
|
||||
/sbin/mount -v -t btrfs -o auto,rw,noatime,nodiratime,degraded,discard=sync $DEVICE /boot || abort "cannot mount $DEVICE"
|
||||
elif /sbin/blkid -s TYPE $DEVICE | /bin/grep -q "xfs" ; then
|
||||
NONVFAT=xfs
|
||||
/sbin/mount -v -t xfs -o auto,rw,noatime,nodiratime,discard,wsync $DEVICE /boot || abort "cannot mount $DEVICE"
|
||||
/sbin/mount -v -t xfs -o auto,rw,noatime,nodiratime,discard $DEVICE /boot || abort "cannot mount $DEVICE"
|
||||
else
|
||||
/bin/echo "Checking $DEVICE ..."
|
||||
/sbin/fsck.fat -a -w $DEVICE 2>/dev/null
|
||||
|
||||
@@ -208,7 +208,6 @@ fi
|
||||
/bin/echo "$NAME" >/etc/HOSTNAME
|
||||
/bin/echo "# Generated" >/etc/hosts
|
||||
/bin/echo "127.0.0.1 $NAME localhost" >>/etc/hosts
|
||||
/bin/echo "54.149.176.35 keys.lime-technology.com" >>/etc/hosts
|
||||
|
||||
# LimeTech - restore the configured timezone
|
||||
if [[ $timeZone == custom ]]; then
|
||||
|
||||
+20
-2
@@ -30,6 +30,8 @@ DAEMON="Avahi mDNS/DNS-SD daemon"
|
||||
CALLER="avahi"
|
||||
AVAHI="/usr/sbin/avahi-daemon"
|
||||
CONF="/etc/avahi/avahi-daemon.conf"
|
||||
HOSTS="/etc/hosts"
|
||||
NAME=$(</etc/HOSTNAME)
|
||||
|
||||
# run & log functions
|
||||
. /etc/rc.d/rc.runlog
|
||||
@@ -49,6 +51,22 @@ disable(){
|
||||
sed -ri "s/^#?(use-$1)=.*/\1=no/" $CONF
|
||||
}
|
||||
|
||||
# when starting avahidaemon, add name.local to the hosts file
|
||||
add_local_to_hosts(){
|
||||
local old new
|
||||
old="^127\.0\.0\.1.*"
|
||||
new="127.0.0.1 $NAME $NAME.local localhost"
|
||||
sed -i "s/$old/$new/gm;t" $HOSTS
|
||||
}
|
||||
|
||||
# when stopping avahidaemon, remove name.local from the hosts file
|
||||
remove_local_from_hosts(){
|
||||
local old new
|
||||
old="^127\.0\.0\.1.*"
|
||||
new="127.0.0.1 $NAME localhost"
|
||||
sed -i "s/$old/$new/gm;t" $HOSTS
|
||||
}
|
||||
|
||||
avahid_running(){
|
||||
sleep 0.1
|
||||
$AVAHI -c
|
||||
@@ -67,7 +85,7 @@ avahid_start(){
|
||||
[[ $IPV4 == no ]] && disable ipv4 || enable ipv4
|
||||
[[ $IPV6 == no ]] && disable ipv6 || enable ipv6
|
||||
run $AVAHI -D
|
||||
if avahid_running; then REPLY="Started"; else REPLY="Failed"; fi
|
||||
if avahid_running; then add_local_to_hosts && REPLY="Started"; else REPLY="Failed"; fi
|
||||
else
|
||||
REPLY="Bind failed"
|
||||
fi
|
||||
@@ -82,7 +100,7 @@ avahid_stop(){
|
||||
REPLY="Already stopped"
|
||||
else
|
||||
run $AVAHI -k
|
||||
if ! avahid_running; then REPLY="Stopped"; else REPLY="Failed"; fi
|
||||
if ! avahid_running; then remove_local_from_hosts && REPLY="Stopped"; else REPLY="Failed"; fi
|
||||
fi
|
||||
log "$DAEMON... $REPLY."
|
||||
}
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ proxy_url_1="${proxy}:${port}"
|
||||
proxy_name_1="Imported from CA"
|
||||
EOF
|
||||
fi
|
||||
mv "${CAProxy}" "${CAProxy}.bak"
|
||||
mv "${CAProxy}" "${CAProxy}~"
|
||||
fi
|
||||
|
||||
# load proxy environment vars so it is used for plugin updates and the go script
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ case "${1:-start}" in
|
||||
exit 1
|
||||
fi
|
||||
# start emhttpd
|
||||
/usr/local/bin/emhttpd
|
||||
/usr/libexec/unraid/emhttpd
|
||||
;;
|
||||
'stop')
|
||||
log "Stopping web services..."
|
||||
|
||||
+2
-2
@@ -67,7 +67,7 @@ start() {
|
||||
for SHAREPATH in /mnt/$(basename "$POOL" .cfg)/*/ ; do
|
||||
SHARE=$(basename "$SHAREPATH")
|
||||
if grep -qs 'shareUseCache="yes"' "/boot/config/shares/${SHARE}.cfg" ; then
|
||||
find "${SHAREPATH%/}" -depth | /usr/local/bin/move $DEBUGGING
|
||||
find "${SHAREPATH%/}" -depth | /usr/libexec/unraid/move $DEBUGGING
|
||||
fi
|
||||
done
|
||||
done
|
||||
@@ -81,7 +81,7 @@ start() {
|
||||
shareCachePool="cache"
|
||||
fi
|
||||
if [[ -d "/mnt/$shareCachePool" ]]; then
|
||||
find "${SHAREPATH%/}" -depth | /usr/local/bin/move $DEBUGGING
|
||||
find "${SHAREPATH%/}" -depth | /usr/libexec/unraid/move $DEBUGGING
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -7,4 +7,4 @@ git checkout main
|
||||
PATH="$PATH:/usr/local/go/bin"
|
||||
go mod tidy
|
||||
go build
|
||||
cp /tmp/unraidwol/unraidwold /usr/local/bin
|
||||
cp /tmp/unraidwol/unraidwold /usr/libexec/unraid
|
||||
|
||||
Reference in New Issue
Block a user