Merge remote-tracking branch 'upstream/master'

This commit is contained in:
bergware
2021-05-07 20:25:38 +02:00
32 changed files with 1385 additions and 549 deletions

View File

@@ -113,14 +113,13 @@ if (isset($_POST['contName'])) {
goto END;
}
}
$startContainer = filter_var($_POST['contStart'],FILTER_VALIDATE_BOOLEAN);
$startContainer = true;
// Remove existing container
if ($DockerClient->doesContainerExist($Name)) {
// attempt graceful stop of container first
$oldContainerInfo = $DockerClient->getContainerDetails($Name);
if (!empty($oldContainerInfo) && !empty($oldContainerInfo['State']) && !empty($oldContainerInfo['State']['Running'])) {
// attempt graceful stop of container first
$startContainer = true;
stopContainer($Name);
}
// force kill container if still running after 10 seconds
@@ -417,9 +416,7 @@ function addConfigPopup() {
if (!Opts.Name){
Opts.Name = makeName(Opts.Type);
}
if (!Opts.Description) {
Opts.Description = "_(Container)_ "+Opts.Type+": "+Opts.Target;
}
if (Opts.Required == "true") {
Opts.Buttons = "<span class='advanced'><button type='button' onclick='editConfigPopup("+confNum+",false)'>_(Edit)_</button>";
Opts.Buttons += "<button type='button' onclick='removeConfig("+confNum+")'>_(Remove)_</button></span>";
@@ -499,9 +496,7 @@ function editConfigPopup(num,disabled) {
if (!Opts.Name){
Opts.Name = makeName(Opts.Type);
}
if (!Opts.Description) {
Opts.Description = "Container "+Opts.Type+": "+Opts.Target;
}
Opts.Number = num;
newConf = makeConfig(Opts);
if (config.hasClass("config_"+Opts.Display)) {
@@ -887,16 +882,10 @@ _(Privileged)_:
&nbsp;
: <a href="javascript:addConfigPopup()"><i class="fa fa-fw fa-plus"></i> _(Add another Path, Port, Variable, Label or Device)_</a>
<?if ($xmlType != "edit"):?>
&nbsp;
: <input type='checkbox' name='contStart' checked> <span class='orange-text'>_(Start Container After Install)_</span>
<?endif;?>
&nbsp;
: <input type="submit" value="<?=$xmlType=='edit' ? "_(Apply)_" : " _(Apply)_ "?>"><input type="button" value="_(Done)_" onclick="done()">
<?if ($authoringMode):?><button type="submit" name="dryRun" value="true" onclick="$('*[required]').prop('required', null);">_(Save)_</button><?endif;?>
</form>
</div>
@@ -995,7 +984,7 @@ _(Password Mask)_:
<input type="hidden" name="confRequired[]" value="{7}">
<input type="hidden" name="confMask[]" value="{8}">
<span class="{11}">{0}:</span>
: <span class="boxed"><input type="text" name="confValue[]" default="{2}" value="{9}" autocomplete="off" {11}>{10}<br><span class="orange-text">{4}</span></span>
: <span class="boxed"><input type="text" name="confValue[]" default="{2}" value="{9}" autocomplete="off" {11}>{10}<br><span class='orange-text'>{12}: {1}</span><br><span class="orange-text">{4}</span><br>
</div>
<div markdown="1" id="templateAllocations" style="display:none">
@@ -1059,7 +1048,7 @@ function load_contOverview() {
// Handle code block being created by authors indenting (manually editing the xml and spacing)
new_overview = new_overview.replaceAll(" ","&nbsp;&nbsp;&nbsp;&nbsp;");
new_overview = marked(new_overview);
} else
} else
new_overview = new_overview.replaceAll("\n","");
$("#contDescription").html(new_overview);
}

View File

@@ -592,10 +592,13 @@ class DockerUpdate{
$rvalue = $this->xml_decode($value);
$value = $this->xml_decode($local_element[$key]);
// Values changed, updating.
// Leave pre-existing value if description is simply Container {type}: xxx
if ($value != $rvalue && in_array($key, $validAttributes)) {
//$this->debug("Updating $type '$target' attribute '$key' from [$value] to [$rvalue]");
$local_element[$key] = $this->xml_encode($rvalue);
$changed = true;
if ( ! ($key == "Description" && preg_match("/^(Container Path:|Container Port:|Container Label:|Container Variable:|Container Device:)/",$rvalue) ) ) {
//$this->debug("Updating $type '$target' attribute '$key' from [$value] to [$rvalue]");
$local_element[$key] = $this->xml_encode($rvalue);
$changed = true;
}
}
}
// New Config element, add it to the local template

View File

@@ -100,7 +100,7 @@ switch ($action) {
$pid = exec("pgrep -a ttyd|awk '/\\/$name\\.sock/{print \$1}'");
if ($pid) exec("kill $pid");
@unlink("/var/tmp/$name.sock");
exec("exec ttyd -o -d0 -i '/var/tmp/$name.sock' docker exec -it '$name' $shell &>/dev/null &");
exec("ttyd-exec -o -i '/var/tmp/$name.sock' docker exec -it '$name' $shell");
break;
default:
$arrResponse = ['error' => _('Unknown action')." '$action'"];

View File

@@ -166,7 +166,7 @@ function xmlToVar($xml) {
'Default' => xml_decode($port->HostPort),
'Value' => xml_decode($port->HostPort),
'Mode' => xml_decode($port->Protocol) ? xml_decode($port->Protocol) : "tcp",
'Description' => ($out['Network'] == 'bridge') ? 'Container Port: '.xml_decode($port->ContainerPort) : 'n/a',
'Description' => '',
'Type' => 'Port',
'Display' => 'always',
'Required' => 'true',
@@ -185,7 +185,7 @@ function xmlToVar($xml) {
'Default' => xml_decode($vol->HostDir),
'Value' => xml_decode($vol->HostDir),
'Mode' => xml_decode($vol->Mode) ? xml_decode($vol->Mode) : "rw",
'Description' => 'Container Path: '.xml_decode($vol->ContainerDir),
'Description' => '',
'Type' => 'Path',
'Display' => 'always',
'Required' => 'true',
@@ -204,7 +204,7 @@ function xmlToVar($xml) {
'Default' => xml_decode($varitem->Value),
'Value' => xml_decode($varitem->Value),
'Mode' => '',
'Description' => 'Container Variable: '.xml_decode($varitem->Name),
'Description' => '',
'Type' => 'Variable',
'Display' => 'always',
'Required' => 'false',
@@ -223,7 +223,7 @@ function xmlToVar($xml) {
'Default' => xml_decode($varitem->Value),
'Value' => xml_decode($varitem->Value),
'Mode' => '',
'Description' => 'Container Label: '.xml_decode($varitem->Name),
'Description' => '',
'Type' => 'Label',
'Display' => 'always',
'Required' => 'false',

View File

@@ -0,0 +1,31 @@
<?PHP
function startsWith($haystack, $needle) {
if ( !is_string($haystack) || ! is_string($needle) ) return false;
return $needle === "" || strripos($haystack, $needle, -strlen($haystack)) !== FALSE;
}
$xmlFiles = glob("/boot/config/plugins/dockerMan/templates-user/*.xml");
foreach ($xmlFiles as $file) {
unset($changeFlag);
$xml = simplexml_load_file($file);
if ( ! $xml ) {
continue;
}
foreach ($xml->Config as $id => $config) {
if ( startsWith((string)$config->attributes()->Description,"Container ".(string)$config->attributes()->Type) ) {
$config->attributes()->Description = "";
$changeFlag = true;
}
}
if ( $changeFlag ) {
copy($file,"$file.bak");
$dom = new DOMDocument('1.0');
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
$dom->loadXML($xml->asXML());
file_put_contents($file,$dom->saveXML());
}
}
?>

View File

@@ -0,0 +1,259 @@
Menu="About"
Type="xmenu"
Title="Registration"
Icon="icon-registration"
Tag="pencil"
---
<?PHP
/* Copyright 2005-2020, Lime Technology
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
?>
<?
function my_time_any($time) {
return $time ? _(my_time($time),0) : _('Anytime');
}
function my_time_now($time) {
return $time ? _(my_time($time),0) : _('Unknown');
}
?>
<style>
span.thanks{padding-left:12px;color:#6FA239;font-weight:bold;}
span.thanks.red{color:#F0000C;}
div.device{padding:0 12px;font-weight:normal;font-style:italic;}
div.remark{padding:0 12px;text-align:justify;}
</style>
<?if ( (strstr($var['regTy'], "unregistered")) or ($var['regTy']=="Trial") or (strstr($var['regTy'], "no connection")) or (strstr($var['regTy'], "withdrawn")) or (strstr($var['regTy'], "expired")) ):?>
<span class="thanks">_(Thank you for trying Unraid OS)_!</span>
<?elseif ( ($var['regTy']=="Basic") or ($var['regTy']=="Plus") or ($var['regTy']=="Pro") ):?>
<span class="thanks">_(Thank you for choosing Unraid OS)_!</span>
<?endif;?>
<?if (strstr($var['regTy'], "unregistered")):?>
<div markdown="1" class="remark">
:registration_1_plug:
Your server will not be usable until you purchase a Registration key or install a free 30-day *Trial* key. A *Trial*
key provides all the functionality of a *Pro* Registration key.
Registration keys are bound to your USB Flash boot device serial number (GUID). Please use a high quality name brand device
at least 1GB in size.
Note: USB memory card readers are generally **not** supported because most do not present unique serial numbers.
:end
<span class="red-text">_(Important)_:</span>
:registration_2_plug:
+ Please make sure your [server time](DateTime) is accurate to within 5 minutes.
+ Please make sure there is a [DNS server](NetworkSettings) specified.
:end
</div>
<?endif;?>
<?if ($var['regTy']=="Trial"):?>
<div markdown="1" class="remark">
:registration_3_plug:
Your *Trial* key includes all the functionality and device support of a *Pro* Registration key.
After your *Trial* key has reached expiration, your server **still functions normally** until the next time you **Stop** the array.
At that point, you may either purchase a Registration key, or request a *Trial* extension.
:end
</div>
<?endif;?>
<?if (strstr($var['regTy'], "no connection")):?>
<div markdown="1" class="remark">
<span class='red-text'>_(Cannot connect to key-server)_!</span>
_(Your *Trial* key requires an internet connection)_. _(Please check your)_ [_(Network Settings)_](NetworkSettings).
</div>
<?endif;?>
<?if (strstr($var['regTy'], "withdrawn")):?>
<div markdown="1" class="remark">
<span class='red-text'>_(Release has been withdrawn)_!</span>
_(This release has been withdrawn for use with *Trial* keys)_.
</div>
<?endif;?>
<?if (strstr($var['regTy'], "expired")):?>
<div markdown="1" class="remark">
<span class='red-text'>_(Your *Trial* key has expired)_.</span>
:registration_4_plug:
To continue using Unraid OS you may purchase a Registration key. Alternately, you may request a *Trial* extension key.
Most *Trial* extension requests are processed immediately but please allow up to one business day to receive your *Trial* extension key.
:end
</div>
<?endif;?>
<?if (strstr($var['regTy'], "invalid installation")):?>
<span class='thanks red'>_(Invalid *Trial* Installation)_</span>
<div markdown="1" class="remark">
:registration_5_plug:
It is not possible to use a *Trial* key with an existing Unraid OS installation.
You may purchase a Registration key corresponding to this USB Flash device to continue using this installation.
For more information, please [Contact Support](https://lime-technology.com/contact).
:end
</div>
<?endif;?>
<?if (strstr($var['regTy'], "missing")):?>
<span class='thanks red'>_(Missing Key File)_</span>
<div markdown="1" class="remark">
:registration_6_plug:
It appears that your Registration key file is corrupted or missing. The key file should be located in the
[config](/Registration/Browse?dir&#61;/boot/config) directory on your USB Flash boot device.
If you do not have a backup copy of your Registration key file, [Contact Support](https://lime-technology.com/contact).
If this was a *Trial* installation, you may purchase a Registration key.
:end
</div>
<?endif;?>
<?if (strstr($var['regTy'], "invalid key")):?>
<span class='thanks red'>_(The registered GUID does not match the USB Flash boot device GUID)_</span>
<?if (strstr($var['regTy'], "Trial")):?>
<div markdown="1" class="remark">
:registration_7_plug:
*Trial* installations are only valid with the originally registered USB Flash device.
To continue using this installation with this USB Flash device, you may purchase a Registration key.
:end
</div>
<?else:?>
<div markdown="1" class="remark">
:registration_8_plug:
The Registration key file does not correspond to the USB Flash boot device.
Please copy the correct key file to the [config](/Registration/Browse?dir&#61;/boot/config) directory
on your USB Flash boot device. If you do not have a backup copy of your key file, [Contact Support](https://lime-technology.com/contact).
If you want to replace your Registration key with a new key bound to this USB Flash device, click Replace Key below. An original key may be
replaced anytime. Thereafter, a replacement key may be replaced again after one year has passed. If you require
another replacement key sooner, [Contact Support](https://lime-technology.com/contact).
**Note:** Replacing a Registration key results in permanently *blacklisting* the previous USB Flash GUID.
:end
</div>
<?endif;?>
<?endif;?>
<?if (strstr($var['regTy'], "blacklisted")):?>
<span class='thanks red'>_(Blacklisted USB Flash GUID)_</span>
<div markdown="1" class="remark">
:registration_9_plug:
This USB Flash boot device has been *blacklisted*. This can occur as a result of transfering your Registration key to
a replacement USB Flash device, and you are currently booted from your old USB Flash device.
A USB Flash device may also be *blacklisted* if there is no serial number, or if we discover the serial number
is not unique (this is common with USB card readers).
For more information, please [Contact Support](https://lime-technology.com/contact).
:end
</div>
<?endif;?>
<?if ( ( !(strstr($var['regTy'], "invalid key")) and ((strstr($var['regTy'], "Trial"))) ) || (strstr($var['regTy'], "no connection")) || (strstr($var['regTy'], "withdrawn")) ):?>
_(***Trial*** key expires on)_:
: <?=my_time_now($var['regTm2'])?>
<?endif;?>
<?if ( strstr($var['regTy'], "invalid installation") || ( (strstr($var['regTy'], "invalid key")) && (strstr($var['regTy'], "Trial")) )):?>
_(Expiration)_:
: <?=my_time_now($var['regTm2'])?>
<?endif;?>
<?if ( (strstr($var['regTy'], "invalid installation")) || (strstr($var['regTy'], "invalid key")) || ($var['regTy']=="Basic") || ($var['regTy']=="Plus") || ($var['regTy']=="Pro") ):?>
_(Registered to)_:
: <?=htmlspecialchars($var['regTo'])?>
_(Registered on)_:
: <?=my_time_now($var['regTm'])?>
<?endif;?>
<?if ( (strstr($var['regTy'], "invalid installation")) or ( (strstr($var['regTy'], "invalid key")) and (!(strstr($var['regTy'], "Trial")))) ):?>
_(Registered GUID)_:
: <?=$var['regGUID']?>
<?endif;?>
<?if (strstr($var['regTy'], "flash device error")):?>
<span class='thanks red'>_(Error accessing your physical USB Flash boot device)_</span>
<div markdown="1" class="remark">
_(There is a physical problem accessing your USB Flash boot device)_. _(Please)_ [Contact Support](https://lime-technology.com/contact).
_(Flash GUID)_:
: _(Error code)_: <?=$var['regCheck']?>
<?else:?>
_(Flash GUID)_:
: <?=$var['flashGUID']?>
<?endif;?>
_(Flash Vendor)_:
: <?=$var['flashVendor']?>
_(Flash Product)_:
: <?=$var['flashProduct']?>
<?if ( ((strstr($var['regTy'], "invalid key")) and !(strstr($var['regTy'], "Trial"))) || ($var['regTy']=="Basic") || ($var['regTy']=="Plus") || ($var['regTy']=="Pro") ):?>
_(Replaceable)_:
: <?=my_time_any($var['regTm2'])?>
<?endif;?>
<?if ( !(strstr($var['regTy'], "flash device error")) || !(strstr($var['regTy'], "blacklisted")) ):?>
<div class="device"><?=sprintf(_("This server has %s attached storage device".($var['deviceCount']==1?'.':'s.')),$var['deviceCount'])?></div>
<?endif;?>
<unraid-upc-trigger></unraid-upc-trigger>

View File

@@ -0,0 +1,52 @@
Menu="ManagementAccess:100"
Title="Unraid.net"
Icon="icon-u-globe"
Tag="globe"
---
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
?>
<script>
$('body').on('change keyup', '#UnraidNetSettings', function(data) {
$(this).find('.applyBtn').removeAttr('disabled');
});
function applyCrashInfoSetting(button) {
$(button).prop("disabled", true).html("_(Applying)_ <i class=\"fa fa-spinner fa-spin\" aria-hidden=\"true\"></i>");
var oldlabel = $.trim($(button).text());
$.post( "ajax/test.html", function( data ) {
$( ".result" ).html( data );
});
$.post('/webGui/include/Dispatcher.php',{
"#cfg": "/boot/config/plugins/Unraid.net/myservers.cfg",
"remote_sendCrashInfo": $('#sendCrashInfo').val(),
}, function() {
$(button).html(oldlabel);
}).fail(function() {
$(button).prop("disabled", false).html(oldlabel).after( "<p>_(Sorry, an error occurred)_</p>" );
});
}
</script>
<form id="UnraidNetSettings" markdown="1" name="UnraidNetSettings" method="POST" action="/update.htm" target="progressFrame">
_(Unraid.net Status)_:
: <unraid-authed prop-registered="<? echo $isRegistered ?>"></unraid-authed>
_(Send crash information to Unraid developers)_:
: <select id="sendCrashInfo" size="1">
<?=mk_option($remote['sendCrashInfo'], "no", _("No"))?>
<?=mk_option($remote['sendCrashInfo'], "yes", _("Yes"))?>
</select>
&nbsp;
: <button class="applyBtn" type="button" onclick="applyCrashInfoSetting(this)" disabled="disabled">_(Apply)_</button>
</form>

View File

@@ -0,0 +1,90 @@
<?PHP
/* Copyright 2005-2021, Lime Technology
* Copyright 2012-2021, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
function update($url, $payload) {
$ch = curl_init($url);
curl_setopt($ch,CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
}
$dyn_cfg = '/boot/config/plugins/dynamix/dynamix.cfg';
$mys_cfg = '/boot/config/plugins/Unraid.net/myservers.cfg';
if (file_exists($dyn_cfg) && !file_exists($mys_cfg)) {
$orig = parse_ini_file($dyn_cfg,true);
$var = (array)parse_ini_file('/usr/local/emhttp/state/var.ini',true);
$url = "http://localhost:".$var['PORT']."/update.php";
// write [remote] section to myservers.cfg
if(!empty($orig['remote'])) {
$fields_mys_remote = [
'csrf_token' => $var['csrf_token'],
'#file' => $mys_cfg,
'#section' => 'remote'
];
foreach($orig['remote'] as $key => $value) {
$fields_mys_remote[$key] = $value;
}
update($url, http_build_query($fields_mys_remote));
}
/*
// write [wizard] section to myservers.cfg
if(!empty($orig['wizard'])) {
$fields_mys_wizard = [
'csrf_token' => $var['csrf_token'],
'#file' => $mys_cfg,
'#section' => 'wizard'
];
foreach($orig['wizard'] as $key => $value) {
$fields_mys_wizard[$key] = $value;
}
update($url, http_build_query($fields_mys_wizard));
}
*/
// remove [remote] section from dynamix.cfg
if(!empty($orig['remote'])) {
$fields_dyn_remote = [
'csrf_token' => $var['csrf_token'],
'#file' => $dyn_cfg,
'#section' => 'remote',
'#cleanup' => 'true'
];
foreach($orig['remote'] as $key => $value) {
$fields_dyn_remote[$key] = '';
}
update($url, http_build_query($fields_dyn_remote));
}
// remove [wizard] section from dynamix.cfg
if(!empty($orig['wizard'])) {
$fields_dyn_wizard = [
'csrf_token' => $var['csrf_token'],
'#file' => $dyn_cfg,
'#section' => 'wizard',
'#cleanup' => 'true'
];
foreach($orig['wizard'] as $key => $value) {
$fields_dyn_wizard[$key] = '';
}
update($url, http_build_query($fields_dyn_wizard));
}
// remove [remote] and [wizard] section headings from dyn_cfg file
$oldtext = file_get_contents($dyn_cfg);
$newtext = preg_replace ('/\[(remote|wizard)\]\n/', '', $oldtext);
if (strcmp($oldtext, $newtext) !== 0) {
file_put_contents($dyn_cfg, $newtext);
}
}
if (!file_exists($mys_cfg)) touch($mys_cfg);
?>

View File

@@ -0,0 +1,59 @@
<?PHP
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Helpers.php";
/* add translations */
$_SERVER['REQUEST_URI'] = '';
require_once "$docroot/webGui/include/Translations.php";
$var = (array)parse_ini_file('state/var.ini');
$license_state = strtoupper(empty($var['regCheck']) ? $var['regTy'] : $var['regCheck']);
$key_contents = str_replace(['+','/','='], ['-','_',''], trim(base64_encode(@file_get_contents($var['regFILE']))));
if (file_exists('/boot/config/plugins/Unraid.net/myservers.cfg')) {
extract(parse_ini_file('/boot/config/plugins/Unraid.net/myservers.cfg',true));
}
$arr = [];
if (empty($remote['apikey']) || empty($var['regFILE']) || empty($remote['username']) || empty($remote['avatar'])) {
$arr['registered'] = 0;
$arr['username'] = '';
$arr['avatar'] = '';
$arr['apikey'] = '';
$arr['sendCrashInfo'] = 0;
} else {
$arr['registered'] = 1;
$arr['username'] = $remote['username'];
$arr['avatar'] = $remote['avatar'];
$arr['apikey'] = $remote['apikey'];
$arr['sendCrashInfo'] = $remote['sendCrashInfo'] || 'no';
}
$arr['event'] = 'STATE';
$arr['ts'] = time();
$arr['deviceCount'] = $var['deviceCount'];
$arr['guid'] = $var['flashGUID'];
$arr['state'] = $license_state;
$arr['keyfile'] = $key_contents;
$arr['reggen'] = $var['regGen'];
$arr['flashproduct'] = $var['flashProduct'];
$arr['flashvendor'] = $var['flashVendor'];
$arr['servername'] = $var['NAME'];
$arr['serverip'] = $_SERVER['SERVER_ADDR'];
$arr['internalip'] = $_SERVER['SERVER_ADDR'];
$arr['internalport'] = $_SERVER['SERVER_PORT'];
$arr['protocol'] = $_SERVER['REQUEST_SCHEME'];
$arr['locale'] = $_SESSION['locale'] ? $_SESSION['locale'] : 'en_US';
echo json_encode($arr);
?>

View File

@@ -0,0 +1,7 @@
{
"ts": 1617914524974,
"unraid.min.js": "unraid.min.js",
"unraid.min.js.map": "unraid.min.js.map",
"unraid.js": "unraid.js",
"unraid.js.map": "unraid.js.map"
}

View File

@@ -0,0 +1,7 @@
<!DOCTYPE html><html class="text-16px xxl:text-18px leading-tight w-full h-full bg-gradient-to-r from-red to-orange dark:bg-gradient-to-b dark:from-black dark:to-black"><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta http-equiv=X-UA-Compatible content="ie=edge"><title>Registration Wizard | Unraid</title><link rel="shortcut icon" href=/assets/favicon.svg><meta name=msapplication-TileColor content=#1c1b1b><meta name=theme-color content=#1c1b1b><meta name=color-scheme content="dark light"><link rel=stylesheet href=https://use.typekit.net/ymm4lqb.css><style>html,
body {
background-image: linear-gradient(rgb(28, 27, 27), rgb(28, 27, 27));
@media (prefers-color-scheme: light) {
background-image: linear-gradient(to right, rgb(226, 40, 40), rgb(255, 140, 47));
}
}</style><link href=/css/Registration.94625577.css rel=prefetch><link href=/js/ExtendTrial.10985023.js rel=prefetch><link href=/js/ForgotPassword.10985023.js rel=prefetch><link href=/js/NotAllowed.10985023.js rel=prefetch><link href=/js/NotFound.10985023.js rel=prefetch><link href=/js/Registration.10985023.js rel=prefetch><link href=/js/SignIn.10985023.js rel=prefetch><link href=/js/SignIn~SignUp~Troubleshoot~VerifyEmail~VerifyEmailResend.10985023.js rel=prefetch><link href=/js/SignOut.10985023.js rel=prefetch><link href=/js/SignUp.10985023.js rel=prefetch><link href=/js/Success.10985023.js rel=prefetch><link href=/js/Troubleshoot.10985023.js rel=prefetch><link href=/js/VerifyEmail.10985023.js rel=prefetch><link href=/js/VerifyEmailResend.10985023.js rel=prefetch><link href=/js/WhatIsUnraidNet.10985023.js rel=prefetch><link href=/css/chunk-vendors.4bc1a94c.css rel=preload as=style><link href=/css/index.55817df3.css rel=preload as=style><link href=/js/chunk-vendors.10985023.js rel=preload as=script><link href=/js/index.10985023.js rel=preload as=script><link href=/css/chunk-vendors.4bc1a94c.css rel=stylesheet><link href=/css/index.55817df3.css rel=stylesheet><link rel=manifest href=/manifest.json><meta name=theme-color content=#ff8c2f><meta name=apple-mobile-web-app-capable content=no><meta name=apple-mobile-web-app-status-bar-style content=default><meta name=apple-mobile-web-app-title content="Unraid Registration Wizard"><meta name=msapplication-TileColor content=#ff8c2f></head><body class="font-sans relative leading-tight flex w-full h-full m-0 bg-gradient-to-r from-red to-orange dark:bg-gradient-to-b dark:from-black dark:to-black"><noscript><strong>Unraid's Registration Wizard</strong> doesn't work properly without JavaScript enabled. Please enable it to continue.</noscript><div id=app></div><script src=/js/chunk-vendors.10985023.js></script><script src=/js/index.10985023.js></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1019,6 +1019,8 @@
<?
echo mk_option($arrNic['model'], 'virtio-net', 'virtio-net');
echo mk_option($arrNic['model'], 'virtio', 'virtio');
echo mk_option($arrNic['model'], 'e1000', 'e1000');
echo mk_option($arrNic['model'], 'vmxnet3', 'vmxnet3');
?>
</select>
</td>
@@ -1074,6 +1076,8 @@
<?
echo mk_option(1, 'virtio-net', 'virtio-net');
echo mk_option(1, 'virtio', 'virtio');
echo mk_option($arrNic['model'], 'e1000', 'e1000');
echo mk_option($arrNic['model'], 'vmxnet3', 'vmxnet3');
?>
</select>
</td>

View File

@@ -43,6 +43,6 @@ foreach (glob("$plugins/lang-*.xml", GLOB_NOSORT) as $link) {
$author = language('Author', $xml_file);
$credits[] = "<li><p><i>$lang ($local)</i> translation by $author</p></li>";
}
if (count($credits)) echo '<br><b>Language Translations</b> Copyright &copy; 2020, <a href="http://lime-technology.com">Lime Technology, Inc.</a><br><ul>'.implode('',$credits).'</ul>';
if (count($credits)) echo '<br><b>Language Translations</b> Copyright &copy; 2020-2021, <a href="http://lime-technology.com">Lime Technology, Inc.</a><br><ul>'.implode('',$credits).'</ul>';
?>
<br><input type="button" value="_(Done)_" onclick="done()">

View File

@@ -248,6 +248,15 @@ _(Header custom background color)_:
:display_custom_background_color_help:
_(Header show description)_:
: <select name="headerdescription">
<?=mk_option($display['headerdescription'], "yes",_('Yes'))?>
<?=mk_option($display['headerdescription'], "no",_('No'))?>
</select>
_(Header custom meta text color)_:
: <input type="text" class="narrow" name="headermetacolor" value="<?=$display['headermetacolor']?>" maxlength="6" pattern="([0-9a-fA-F]{3}){1,2}" title="HTML color code of 3 or 6 hexadecimal digits">
_(Show banner)_:
: <select name="banner" onchange="presetBanner(this.form)">
<?=mk_option($display['banner'], "",_('No'))?>
@@ -291,8 +300,8 @@ _(Used / Free columns)_:
<?=mk_option($display['text'], "2",_('Bar (color)'))?>
<?=mk_option($display['text'], "10",_('Text - Bar (gray)'))?>
<?=mk_option($display['text'], "20",_('Text - Bar (color)'))?>
<?=mk_option($display['text'], "11",_('Bar (gray) - Text'))?>
<?=mk_option($display['text'], "21",_('Bar (color) - Text'))?>
<?=mk_option($display['text'], "11",_('Bar (gray) - Text)'))?>
<?=mk_option($display['text'], "21",_('Bar (color) - Text)'))?>
</select>
_(Temperature unit)_:

View File

@@ -5,8 +5,8 @@ Icon="icon-key"
Tag="expeditedssl"
---
<?PHP
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
/* Copyright 2005-2021, Lime Technology
* Copyright 2012-2021, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -47,9 +47,25 @@ $disabled_provision = $keyfile===false || ($isLEcert && $retval_expired===0) ||
$disabled_updatedns = $keyfile!==false && $isLEcert ? '' : 'disabled';
$internalip = $eth0['IPADDR:0'];
$tasks = find_tasks();
// Get ports in use
$portsInUse = [];
exec("lsof -Pni4|awk '/LISTEN/{print \$9}'", $output);
$bind = $var['BIND_MGT']=='yes';
$list = ['*', $internalip];
foreach ($output as $line) {
[$ip, $port] = explode(':', $line);
if (!in_array($port, $portsInUse) && (!$bind || in_array($ip, $list))) $portsInUse[] = $port;
}
?>
<script>
function provisionSSL(button) {
var frm = $('form[name="SSLSettings"]');
if ( ! checkPorts(frm,true) ) {
return;
}
var oldlabel = $.trim($(button).text());
$(button).prop("disabled", true).html("<i class='fa fa-circle-o-notch fa-spin fa-fw'></i>"+oldlabel);
var msg = "_(Your Let's Encrypt SSL Certificate has been provisioned and a DNS record for local IP address)_ <?=$internalip?> _(has been created on unraid.net)_.";
@@ -98,23 +114,70 @@ function updateDNS(button) {
};
$.post("/webGui/include/UpdateDNS.php",success).fail(failure);
}
function checkPorts(form) {
var check = [{'key':'PORTTELNET','port':'23','text':'TELNET'},{'key':'PORTSSH','port':'22','text':'SSH'},{'key':'PORT','port':'80','text':'HTTP'},{'key':'PORTSSL','port':'443','text':'HTTPS'}];
function jsprintf() {
var text = arguments[0];
for (var i=1,arg; arg=arguments[i]; i++) text = text.replace('%s',arg);
return text;
}
function validatePorts(form) {
if (checkPorts(form,false)) {
form.submit();
}
}
function checkPorts(form,provision) {
var portsInUse = JSON.parse('<?=json_encode($portsInUse)?>');
if (provision) // SSL is already set to auto
var check = [{'key':'PORTSSL','port':'<?=$var['PORTSSL']?>','default':'443',name:'_(HTTPS port)_'}];
else
var check = [
{'key':'PORTTELNET','port':'<?=($var['USE_TELNET'] == 'no') ? "0" : $var['PORTTELNET']?>','default':'23',name:'_(TELNET port)_'},
{'key':'PORTSSH','port':'<?=($var['USE_SSH'] == 'no') ? "0" : $var['PORTSSH']?>','default':'22',name:'_(SSH port)_'},
{'key':'PORT','port':'<?=$var['PORT']?>','default':'80',name:'_(HTTP Port)_'},
{'key':'PORTSSL','port':'<?=($var['USE_SSL'] == 'no') ? "0" : $var['PORTSSL']?>','default':'443',name:'_(HTTPS port)_'}
];
var list = [];
var dupeCheck = [];
var range = [];
for (var i=0; i < check.length; i++) {
var key = check[i]['key'];
var port = check[i]['port'];
var text = check[i]['text'];
var portdefault = check[i]['default'];
var name = check[i]['name'];
var item = $(form).find('input[name="'+key+'"]');
if (!item.val()) item.val(port);
if (item.val() < 1024 && item.val() != port && item.prop('disabled')==false) list.push(text+' ('+item.val()+')');
item.prop('disabled',false);
if (!item.val()) item.val(portdefault);
item.val(parseInt(item.val()));
if ($(item).is(':disabled')) continue;
if (provision)
var userPort = '<?=$var['PORTSSL']?>';
else {
var userPort = item.val();
if ( userPort < 1 || userPort > 65535 )
range.push(userPort+" ("+name+")");
}
dupeCheck.push(userPort);
if ( userPort !== port || provision) {
if ( portsInUse.includes(userPort) )
list.push(userPort+" ("+name+")");
}
}
if (list.length > 0) {
swal({title:"_(Non-recommended port)_"+(list.length>1?'s':''),text:list.join(', ')+'<br>_(may conflict with well-known services)_',html:true,type:'warning',showCancelButton:true,confirmButtonText:"_(Proceed)_",cancelButtonText:"_(Cancel)_"},function(){form.submit();});
} else {
form.submit();
var duplicates = dupeCheck.reduce(function(acc, el, i, arr) {
if (arr.indexOf(el) !== i && acc.indexOf(el) < 0) acc.push(el); return acc;
}, []);
if ( range.length > 0 ) {
swal({title:'_(Port out of range)_',text:jsprintf('_(Port %s is out of range (minimum 1 maximum 65535))_',range.join(', ')),type:'error',showCancelButton:false,confirmButtonText:"_(OK)_"});
return false;
}
if ( list.length > 0 ) {
swal({title:'_(Port already in use)_',text:jsprintf('_(Port %s is already in use by other services)_',list.join(', ')),type:'error',showCancelButton:false,confirmButtonText:"_(OK)_"});
return false;
}
if ( duplicates.length > 0 ) {
swal({title:'_(Duplicate port entered)_',text:jsprintf('_(Port %s is duplicated)_',duplicates.join(', ')),type:'error',showCancelButton:false,confirmButtonText:"_(OK)_"});
return false;
}
return true;
}
function updateTELNET(form) {
form.PORTTELNET.disabled = form.USE_TELNET.value=="_(no)_";
@@ -212,7 +275,7 @@ _(Local TLD)_:
:mgmt_local_tld_help:
&nbsp;
: <input type="button" value="_(Apply)_" onclick="checkPorts(this.form)" disabled><input type="button" value="_(Done)_" onclick="done()">
: <input type="button" value="_(Apply)_" onclick="validatePorts(this.form)" disabled><input type="button" value="_(Done)_" onclick="done()">
</form>
<div style="height:24px"></div>

View File

@@ -3,8 +3,8 @@ Title="Notification Agents"
Tag="rss-square"
---
<?PHP
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
/* Copyright 2005-2021, Lime Technology
* Copyright 2012-2021, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -76,6 +76,8 @@ function testService(name) {
form.append('<input type="hidden" name="#env[]" value="SUBJECT='+name+' test.">');
form.append('<input type="hidden" name="#env[]" value="DESCRIPTION='+name+' test.">');
form.append('<input type="hidden" name="#env[]" value="IMPORTANCE=normal">');
// host is normally added to link by the notify script. add it here since calling the agent directly.
form.append('<input type="hidden" name="#env[]" value="LINK='+window.location.origin+'/Settings/Notifications">');
form.submit();
}
function initDropdown() {
@@ -88,7 +90,7 @@ function initDropdown() {
<input type="hidden" name="#arg[2]" value="">
</form>
<?
$fields = ['Event','Subject','Timestamp','Description','Importance','Content'];
$fields = ['Event','Subject','Timestamp','Description','Importance','Content','Link'];
$xml_file = "webGui/include/NotificationAgents.xml";
$xml = @simplexml_load_file($xml_file) or die(_("Failed to open")." $xml_file");
foreach ($xml->Agent as $agent) {

View File

@@ -1,450 +0,0 @@
Menu="About"
Type="xmenu"
Title="Registration"
Icon="icon-registration"
Tag="pencil"
---
<?PHP
/* Copyright 2005-2020, Lime Technology
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
?>
<?
function my_time_any($time) {
return $time ? _(my_time($time),0) : _('Anytime');
}
function my_time_now($time) {
return $time ? _(my_time($time),0) : _('Unknown');
}
$attached_devices=sprintf(_("This server has %s attached storage device".($var['deviceCount']==1?'.':'s.')),$var['deviceCount']);
?>
<style>
span.thanks{padding-left:10px;color:#6FA239;font-weight:bold;}
span.thanks.red{color:#F0000C;}
span.device{font-weight:normal;font-style:italic;}
div.remark{padding:0 10px;text-align:justify;}
</style>
<?if (strstr($var['regTy'], "unregistered")):?>
<form markdown="1" method="GET" action="https://lime-technology.com/getkey" target="_blank">
<input type="hidden" name="TrialGUID" value="<?=$var['flashGUID']?>">
<input type="hidden" name="deviceCount" value="<?=$var['deviceCount']?>">
<span class="thanks">_(Thank you for trying Unraid OS)_!</span>
<div markdown="1" class="remark">
:registration_1_plug:
Your server will not be usable until you purchase a Registration key or install a free 30-day *Trial* key. A *Trial*
key provides all the functionality of a *Pro* Registration key.
Registration keys are bound to your USB Flash boot device serial number (GUID). Please use a high quality name brand device
at least 1GB in size.
Note: USB memory card readers are generally **not** supported because most do not present unique serial numbers.
:end
<span class="red-text">_(Important)_:</span>
:registration_2_plug:
+ Please make sure your [server time](DateTime) is accurate to within 5 minutes.
+ Please make sure there is a [DNS server](NetworkSettings) specified.
:end
</div>
_(Flash Vendor)_:
: <?=$var['flashVendor']?>
_(Flash Product)_:
: <?=$var['flashProduct']?>
_(Flash GUID)_:
: <?=$var['flashGUID']?>
<span class="device"><?=$attached_devices?></span>
: <input type="submit" value="_(Purchase Key)_"><input type="button" value="_(Get Trial Key)_" onclick="openBox('/webGui/include/TrialRequest.php','<?=_('Get Trial Key')?>',300,600);">
</form>
<?endif;?>
<?if ($var['regTy']=="Trial"):?>
<form markdown="1" method="GET" action="https://lime-technology.com/getkey" target="_blank">
<input type="hidden" name="TrialGUID" value="<?=$var['flashGUID']?>">
<input type="hidden" name="deviceCount" value="<?=$var['deviceCount']?>">
<span class="thanks">_(Thank you for trying Unraid OS)_!</span>
<div markdown="1" class="remark">
:registration_3_plug:
Your *Trial* key includes all the functionality and device support of a *Pro* Registration key.
After your *Trial* key has reached expiration, your server **still functions normally** until the next time you **Stop** the array.
At that point, you may either purchase a Registration key, or request a *Trial* extension.
:end
</div>
_(***Trial*** key expires on)_:
: <?=my_time_now($var['regTm2'])?>
_(Flash Vendor)_:
: <?=$var['flashVendor']?>
_(Flash Product)_:
: <?=$var['flashProduct']?>
_(Flash GUID)_:
: <?=$var['flashGUID']?>
<span class="device"><?=$attached_devices?></span>
: <input type="submit" value="_(Purchase Key)_"><input type="button" value="_(Request Extension)_" disabled>
</form>
<?endif;?>
<?if (strstr($var['regTy'], "no connection")):?>
<form markdown="1" method="GET" action="https://lime-technology.com/getkey" target="_blank">
<input type="hidden" name="TrialGUID" value="<?=$var['flashGUID']?>">
<input type="hidden" name="deviceCount" value="<?=$var['deviceCount']?>">
<span class="thanks">_(Thank you for trying Unraid OS)_!</span>
<div markdown="1" class="remark">
<span class='red-text'>_(Cannot connect to key-server)_!</span>
_(Your *Trial* key requires an internet connection)_. _(Please check your)_ [_(Network Settings)_](NetworkSettings).
</div>
_(***Trial*** key expires on)_:
: <?=my_time_now($var['regTm2'])?>
_(Flash Vendor)_:
: <?=$var['flashVendor']?>
_(Flash Product)_:
: <?=$var['flashProduct']?>
_(Flash GUID)_:
: <?=$var['flashGUID']?>
<span class="device"><?=$attached_devices?></span>
: <input type="submit" value="_(Purchase Key)_"><input type="button" value="_(Request Extension)_" disabled>
</form>
<?endif;?>
<?if (strstr($var['regTy'], "withdrawn")):?>
<form markdown="1" method="GET" action="https://lime-technology.com/getkey" target="_blank">
<input type="hidden" name="TrialGUID" value="<?=$var['flashGUID']?>">
<input type="hidden" name="deviceCount" value="<?=$var['deviceCount']?>">
<span class="thanks">_(Thank you for trying Unraid OS)_!</span>
<div markdown="1" class="remark">
<span class='red-text'>_(Release has been withdrawn)_!</span>
_(This release has been withdrawn for use with *Trial* keys)_.
</div>
_(***Trial*** key expires on)_:
: <?=my_time_now($var['regTm2'])?>
_(Flash Vendor)_:
: <?=$var['flashVendor']?>
_(Flash Product)_:
: <?=$var['flashProduct']?>
_(Flash GUID)_:
: <?=$var['flashGUID']?>
<span class="device"><?=$attached_devices?></span>
: <input type="submit" value="_(Purchase Key)_"><input type="button" value="_(Request Extension)_" disabled>
</form>
<?endif;?>
<?if (strstr($var['regTy'], "expired")):?>
<form markdown="1" method="GET" action="https://lime-technology.com/getkey" target="_blank">
<input type="hidden" name="TrialGUID" value="<?=$var['flashGUID']?>">
<input type="hidden" name="deviceCount" value="<?=$var['deviceCount']?>">
<span class="thanks">_(Thank you for trying Unraid OS)_!</span>
<div markdown="1" class="remark">
<span class='red-text'>_(Your *Trial* key has expired)_.</span>
:registration_4_plug:
To continue using Unraid OS you may purchase a Registration key. Alternately, you may request a *Trial* extension key.
Most *Trial* extension requests are processed immediately but please allow up to one business day to receive your *Trial* extension key.
:end
</div>
_(Flash Vendor)_:
: <?=$var['flashVendor']?>
_(Flash Product)_:
: <?=$var['flashProduct']?>
_(Flash GUID)_:
: <?=$var['flashGUID']?>
<span class="device"><?=$attached_devices?></span>
: <input type="submit" value="_(Purchase Key)_"><input type="button" value="_(Request Extension)_" onclick="openBox('/webGui/include/TrialRequest.php','<?=_('Request Trial Extension')?>',300,600);">
</form>
<?endif;?>
<?if (strstr($var['regTy'], "invalid installation")):?>
<form markdown="1" method="GET" action="https://lime-technology.com/getkey" target="_blank">
<input type="hidden" name="TrialGUID" value="<?=$var['flashGUID'];?>">
<input type="hidden" name="deviceCount" value="<?=$var['deviceCount']?>">
<span class='thanks red'>_(Invalid *Trial* Installation)_</span>
<div markdown="1" class="remark">
:registration_5_plug:
It is not possible to use a *Trial* key with an existing Unraid OS installation.
You may purchase a Registration key corresponding to this USB Flash device to continue using this installation.
For more information, please [Contact Support](https://lime-technology.com/contact).
:end
</div>
_(Flash Vendor)_:
: <?=$var['flashVendor']?>
_(Flash Product)_:
: <?=$var['flashProduct']?>
_(Flash GUID)_:
: <?=$var['flashGUID']?>
_(Registered GUID)_:
: <?=$var['regGUID'];?>
_(Registered to)_:
: <?=htmlspecialchars($var['regTo'])?>
_(Registered on)_:
: <?=my_time_now($var['regTm'])?>
_(Expiration)_:
: <?=my_time_now($var['regTm2'])?>
<span class="device"><?=$attached_devices?></span>
: <input type="submit" value="_(Purchase Key)_">
</form>
<?endif;?>
<?if ($var['regTy']=="Basic"):?>
<span class="thanks">_(Thank you for choosing Unraid OS)_!</span>
<div markdown="1" class="remark">
_(To support more storage devices as your server grows, click Upgrade Key below)_.
</div>
_(Registered to)_:
: <?=htmlspecialchars($var['regTo'])?>
_(Registered on)_:
: <?=my_time_now($var['regTm'])?>
_(Replaceable)_:
: <?=my_time_any($var['regTm2'])?>
<form markdown="1" method="GET" action="https://lime-technology.com/getkey" target="_blank">
<input type="hidden" name="BasicGUID" value="<?=$var['flashGUID']?>">
<input type="hidden" name="deviceCount" value="<?=$var['deviceCount']?>">
_(Flash GUID)_:
: <?=$var['flashGUID']?>
<span class="device"><?=$attached_devices?></span>
: <input type="submit" value="_(Upgrade Key)_">
</form>
<?endif;?>
<?if ($var['regTy']=="Plus"):?>
<span class="thanks">_(Thank you for choosing Unraid OS)_!</span>
<div markdown="1" class="remark">
_(To support more storage devices as your server grows, click Upgrade Key below)_.
</div>
_(Registered to)_:
: <?=htmlspecialchars($var['regTo'])?>
_(Registered on)_:
: <?=my_time_now($var['regTm'])?>
_(Replaceable)_:
: <?=my_time_any($var['regTm2'])?>
<form markdown="1" method="GET" action="https://lime-technology.com/getkey" target="_blank">
<input type="hidden" name="PlusGUID" value="<?=$var['flashGUID']?>">
<input type="hidden" name="deviceCount" value="<?=$var['deviceCount']?>">
_(Flash GUID)_:
: <?=$var['flashGUID']?>
<span class="device"><?=$attached_devices?></span>
: <input type="submit" value="_(Upgrade Key)_">
</form>
<?endif;?>
<?if ($var['regTy']=="Pro"):?>
<span class="thanks">_(Thank you for choosing Unraid OS)_!</span>
_(Registered to)_:
: <?=htmlspecialchars($var['regTo'])?>
_(Registered on)_:
: <?=my_time_now($var['regTm'])?>
_(Replaceable)_:
: <?=my_time_any($var['regTm2'])?>
_(Flash GUID)_:
: <?=$var['flashGUID']?>
<span class="device"><?=$attached_devices?></span>
: <button type="button" onclick="done()">_(Done)_</button>
<?endif;?>
<?if (strstr($var['regTy'], "missing")):?>
<form markdown="1" method="GET" action="https://lime-technology.com/getkey" target="_blank">
<input type="hidden" name="TrialGUID" value="<?=$var['flashGUID']?>">
<input type="hidden" name="deviceCount" value="<?=$var['deviceCount']?>">
<span class='thanks red'>_(Missing Key File)_</span>
<div markdown="1" class="remark">
:registration_6_plug:
It appears that your Registration key file is corrupted or missing. The key file should be located in the
[config](/Registration/Browse?dir&#61;/boot/config) directory on your USB Flash boot device.
If you do not have a backup copy of your Registration key file, [Contact Support](https://lime-technology.com/contact).
If this was a *Trial* installation, you may purchase a Registration key.
:end
</div>
_(Flash Vendor)_:
: <?=$var['flashVendor']?>
_(Flash Product)_:
: <?=$var['flashProduct']?>
_(Flash GUID)_:
: <?=$var['flashGUID']?>
<span class="device"><?=$attached_devices?></span>
: <input type="submit" value="_(Purchase Key)_">
</form>
<?endif;?>
<?if (strstr($var['regTy'], "invalid key")):?>
<form markdown="1" method="GET" action="https://lime-technology.com/getkey" target="_blank">
<input type="hidden" name="TrialGUID" value="<?=$var['flashGUID']?>">
<input type="hidden" name="deviceCount" value="<?=$var['deviceCount']?>">
<span class='thanks red'>_(The registered GUID does not match the USB Flash boot device GUID)_</span>
<?if (strstr($var['regTy'], "Trial")):?>
<div markdown="1" class="remark">
:registration_7_plug:
*Trial* installations are only valid with the originally registered USB Flash device.
To continue using this installation with this USB Flash device, you may purchase a Registration key.
:end
</div>
<?else:?>
<div markdown="1" class="remark">
:registration_8_plug:
The Registration key file does not correspond to the USB Flash boot device.
Please copy the correct key file to the [config](/Registration/Browse?dir&#61;/boot/config) directory
on your USB Flash boot device. If you do not have a backup copy of your key file, [Contact Support](https://lime-technology.com/contact).
If you want to replace your Registration key with a new key bound to this USB Flash device, click Replace Key below. An original key may be
replaced anytime. Thereafter, a replacement key may be replaced again after one year has passed. If you require
another replacement key sooner, [Contact Support](https://lime-technology.com/contact).
**Note:** Replacing a Registration key results in permanently *blacklisting* the previous USB Flash GUID.
:end
</div>
<?endif;?>
_(Flash Vendor)_:
: <?=$var['flashVendor']?>
_(Flash Product)_:
: <?=$var['flashProduct']?>
_(Flash GUID)_:
: <?=$var['flashGUID']?>
_(Registered GUID)_:
: <?=$var['regGUID']?>
_(Registered to)_:
: <?=htmlspecialchars($var['regTo'])?>
_(Registered on)_:
: <?=my_time_now($var['regTm'])?>
<?if (strstr($var['regTy'], "Trial")):?>
_(Expiration):
: <?=my_time_now($var['regTm2'])?>
<span class="device"><?=$attached_devices?></span>
: <input type="submit" value="Purchase Key">
<?else:?>
_(Replaceable)_:
: <?=my_time_any($var['regTm2'])?>
<?if ($var['regTm2']==0 || $var['regTm2']<time()):?>
<span class="device"><?=$attached_devices?></span>
: <input type="submit" value="_(Purchase Key)_"><input type="button" value="_(Replace Key)_" onclick="openBox('/webGui/include/ReplaceKey.php','Replace Key',600,900);">
<?else:?>
<span class="device"><?=$attached_devices?></span>
: <input type="submit" value="_(Purchase Key)_"><input type="button" value="_(Replace Key)_" disabled>
<?endif;?>
<?endif;?>
</form>
<?endif;?>
<?if (strstr($var['regTy'], "blacklisted")):?>
<span class='thanks red'>_(Blacklisted USB Flash GUID)_</span>
<div markdown="1" class="remark">
:registration_9_plug:
This USB Flash boot device has been *blacklisted*. This can occur as a result of transfering your Registration key to
a replacement USB Flash device, and you are currently booted from your old USB Flash device.
A USB Flash device may also be *blacklisted* if there is no serial number, or if we discover the serial number
is not unique (this is common with USB card readers).
For more information, please [Contact Support](https://lime-technology.com/contact).
:end
</div>
_(Flash Vendor)_:
: <?=$var['flashVendor']?>
_(Flash Product)_:
: <?=$var['flashProduct']?>
_(Flash GUID)_:
: <?=$var['flashGUID']?>
<?endif;?>
<?if (strstr($var['regTy'], "flash device error")):?>
<span class='thanks red'>_(Error accessing your physical USB Flash boot device)_</span>
<div markdown="1" class="remark">
_(There is a physical problem accessing your USB Flash boot device)_. _(Please)_ [Contact Support](https://lime-technology.com/contact).
</div>
_(Flash GUID)_:
: _(Error code)_: <?=$var['regCheck']?>
<?endif;?>

View File

@@ -58,7 +58,7 @@ _(Enable WSD)_:
:smb_enable_wsd_help:
_(WSD options [experimental])_:
: <input type="text" name="WSD_OPT" maxlength="80" class="narrow" value="<?=htmlspecialchars($var['WSD_OPT'])?>" <?if ($var['fsState']=="Started"):?>disabled<?endif;?>>
: <input type="text" name="WSD2_OPT" maxlength="80" class="narrow" value="<?=htmlspecialchars($var['WSD2_OPT'])?>" <?if ($var['fsState']=="Started"):?>disabled<?endif;?>>
:smb_wsd_options_help:
@@ -70,9 +70,9 @@ _(WSD options [experimental])_:
function checkWSDSettings() {
form=document.SMBEnable;
if (form.USE_WSD.value=="yes") {
form.WSD_OPT.disabled=false;
form.WSD2_OPT.disabled=false;
} else {
form.WSD_OPT.disabled=true;
form.WSD2_OPT.disabled=true;
}
}
$(checkWSDSettings);

View File

@@ -4,8 +4,8 @@ Icon="icon-eula"
Tag="file-text-o"
---
<?PHP
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
/* Copyright 2005-2021, Lime Technology
* Copyright 2012-2021, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -17,6 +17,18 @@ Tag="file-text-o"
?>
<?
$syslog = @(array)parse_ini_file('/boot/config/rsyslog.cfg');
// Get ports in use
$portsInUse = [];
exec("lsof -Pni4|awk '/LISTEN/{print \$9}'", $output);
$bind = $var['BIND_MGT']=='yes';
$list = ['*', $eth0['IPADDR:0']];
foreach ($output as $line) {
[$ip, $port] = explode(':', $line);
if (!in_array($port, $portsInUse) && (!$bind || in_array($ip, $list))) $portsInUse[] = $port;
}
?>
<style>
span.span{display:inline-block;width:224px}
@@ -33,6 +45,43 @@ $(function(){
localFolder(document.syslog.local_server.value);
logOptions(document.syslog.log_rotation.value);
});
function jsprintf() {
var text = arguments[0];
for (var i=1,arg; arg=arguments[i]; i++) text = text.replace('%s',arg);
return text;
}
function validatePort(form) {
var portsInUse = JSON.parse('<?=json_encode($portsInUse)?>');
var currentPort = "<?=($syslog['local_server'] && $syslog['server_protocol'] != "udp") ? $syslog['server_port'] : "0"?>";
var port = $(form).find('input[name="server_port"]');
var remotePort = $(form).find('input[name="remote_port"]');
var protocol = $(form).find('select[name="server_protocol"]').val();
if ( !port.val() ) port.val("514");
port.val(parseInt(port.val()));
remotePort.val(parseInt(remotePort.val()));
var newport = port.val();
if (newport != currentPort && protocol != "udp" && $(form).find('select[name="local_server"]').val() ) {
if (portsInUse.includes(newport) ) {
swal({title:'_(Port already in use)_',text:jsprintf('_(Port %s is already in use by other services)_',newport),type:'error',showCancelButton:false,confirmButtonText:"_(OK)_"});
return;
}
}
var list = [];
if ( newport < 1 || newport > 65535 ) {
list.push("_(Local syslog port)_");
}
var remote = remotePort.val();
if ( ! remote ) remote = 514;
if ( remote < 1 || remote > 65535 ) {
list.push("_(Remote syslog port)_");
}
if ( list.length > 0 ) {
swal({title:'_(Port out of range)_',text:jsprintf('_(%s is out of range (minimum 1 maximum 65535))_',list.join(", ")),type:'error',showCancelButton:false,confirmButtonText:"_(OK)_"});
return;
}
form.submit();
}
</script>
<form markdown="1" name="syslog" method="POST" action="/update.php" target="progressFrame">
@@ -105,7 +154,7 @@ _(Remote syslog server)_:
<?=mk_option($syslog['remote_protocol'], "udp", _("UDP"))?>
<?=mk_option($syslog['remote_protocol'], "tcp", _("TCP"))?>
</select>
<input type="text" name="remote_port" class="trim" value="<?=$syslog['remote_port']?>" maxlength="4" placeholder="514">
<input type="number" name="remote_port" class="trim" value="<?=$syslog['remote_port']?>" maxlength="5" placeholder="514" pattern="([0-9]{1,5})">
:syslog_remote_server_help:
@@ -118,5 +167,5 @@ _(Mirror syslog to flash)_:
:syslog_mirror_flash_help:
&nbsp;
: <input type="submit" value="_(Apply)_" disabled><input type="button" value="_(Done)_" onclick="done()">
: <input type="button" value="_(Apply)_" onclick='validatePort(this.form)' disabled><input type="button" value="_(Done)_" onclick="done()">
</form>

View File

@@ -113,7 +113,7 @@ $(function(){
url:'/webGui/include/FileUpload.php',
data:{path:path,"csrf_token":"<?=$var['csrf_token']?>"},
beforeEach:function(file) {
if (!file.type.match(/^image\/.*/)) {
if (!file.type.match(/^image\/png/)) {
swal({title:"Warning",text:"Only PNG images are allowed!",type:"warning",html:true,confirmButtonText:"_(Ok)_"});
return false;
}
@@ -169,7 +169,7 @@ _(Description)_:
:user_add_description_help:
_(Custom image)_:
: <span id="dropbox"><?=$void?></span><em>_(Drag-n-drop a PNG file or click the image at the left)_</em><input type="file" id="drop" accept="image/*" style="display:none">
: <span id="dropbox"><?=$void?></span><em>_(Drag-n-drop a PNG file or click the image at the left)_</em><input type="file" id="drop" accept="image/png" style="display:none">
:user_add_custom_image_help:

View File

@@ -119,7 +119,7 @@ $(function(){
url:'/webGui/include/FileUpload.php',
data:{"csrf_token":"<?=$var['csrf_token']?>"},
beforeEach:function(file) {
if (!file.type.match(/^image\/.*/)) {
if (!file.type.match(/^image\/png/)) {
swal({title:"Warning",text:"_(Only PNG images are allowed)_!",type:"warning",html:true,confirmButtonText:"_(Ok)_"});
return false;
}
@@ -180,7 +180,7 @@ _(Custom image)_:
<?else:?>
<?=$void?>
<?endif;?>
</span><em>_(Drag-n-drop a PNG file or click the image at the left)_</em><input type="file" id="drop" accept="image/*" style="display:none">
</span><em>_(Drag-n-drop a PNG file or click the image at the left)_</em><input type="file" id="drop" accept="image/png" style="display:none">
:user_edit_custom_image_help:

View File

@@ -14,7 +14,7 @@
// Color coding for syslog and disk log
$match =
[['class' => 'text',
'text' => ['to the standard error','non[ -]fatal error','correct gpt errors','error handler\b','(kernel|logger): [|+ #-.]','logger: (naming|log)','tainted: (host-cpu|high-privileges)','root: (>f|cd)\+\+\+\+','root: \.d\.\.t\.','(move: ){2}]
'text' => ['to the standard error','non[ -]fatal error','correct gpt errors','error handler\b','(kernel|logger): [|+ #-.]','logger: (naming|log)','tainted: (host-cpu|high-privileges)','root: (>f|cd)\+\+\+\+','root: \.d\.\.t\.','(move: ){2}']
],
['class' => 'login',
'text' => ['(accepted|failed) password','sshd\[\d+\]:',' login user ']

View File

@@ -37,7 +37,6 @@ $themes2 = in_array($theme,['gray','azure']);
<link type="text/css" rel="stylesheet" href="<?autov("/webGui/styles/jquery.sweetalert.css")?>">
<link type="text/css" rel="stylesheet" href="<?autov("/webGui/styles/default-{$display['theme']}.css")?>">
<link type="text/css" rel="stylesheet" href="<?autov("/webGui/styles/dynamix-{$display['theme']}.css")?>">
<style>
<?if ($display['font']):?>
html{font-size:<?=$display['font']?>}
@@ -352,10 +351,8 @@ function openNotifier(filter) {
group: notify.importance,
header: notify.event+': '+notify.timestamp,
theme: notify.file,
click: function(e,m,o) { if (notify.link) location=notify.link;},
beforeOpen: function(e,m,o){if ($('div.jGrowl-notification').hasClass(notify.file)) return(false);},
beforeClose: function(e,m,o){$.post('/webGui/include/Notify.php',{cmd:'archive',file:notify.file});},
afterOpen: function(e,m,o){if (notify.link) $(e).css("cursor","pointer");}
beforeClose: function(e,m,o){$.post('/webGui/include/Notify.php',{cmd:'archive',file:notify.file});}
});
}
});
@@ -412,7 +409,93 @@ $(function() {
}
<?endforeach;?>
});
// check for flash offline / corrupted. docker.cfg is guaranteed to always exist
<? if ( ! @parse_ini_file("/boot/config/docker.cfg") || ! @parse_ini_file("/boot/config/disk.cfg") || ! @parse_ini_file("/boot/config/domain.cfg") || ! @parse_ini_file("/boot/config/ident.cfg") ):?>
$(function() {
addBannerWarning("<?=_('Your flash drive is corrupted or offline. Post your diagnostics in the forum for help.')?> <a target='_blank' href='https://wiki.unraid.net/Manual/Changing_The_Flash_Device'><?=_('See also here')?>");
});
<?endif;?>
</script>
<!-- RegWiz-->
<style>
#header {
z-index: 102 !important;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
vue-userprofile,
unraid-user-profile {
font-size: 16px;
margin-left: auto;
height: 100%;
}
unraid-launchpad {
position: relative;
z-index: 10001;
}
</style>
<script type="text/javascript">
function upcEnv(str) { // allows unraid devs to easily swap envs for the UPC
const ckName = 'UPC_ENV';
const ckDate = new Date();
const ckDays = 30;
ckDate.setTime(ckDate.getTime()+(ckDays*24*60*60*1000));
console.log(`✨ ${ckName} set…reloading ✨ `);
setTimeout(() => {
window.location.reload();
}, 2000);
return document.cookie = `${ckName}=${str}; expires=${ckDate.toGMTString()}; path=/`;
};
const upcEnvCookie = '<?echo $_COOKIE['UPC_ENV'] ?>';
if (upcEnvCookie) console.debug('[UPC_ENV] ✨', upcEnvCookie);
setTimeout(() => { // If the UPC isn't defined after 2secs inject UPC via
if (!window.customElements.get('unraid-user-profile')) {
console.log('[UPC] Fallback to filesystem src 😖');
const el = document.createElement('script');
el.type = 'text/javascript';
el.src = '<?autov('/plugins/dynamix.unraid.net/webComps/' . $upcBase) ?>';
return document.head.appendChild(el);
}
return false;
}, 2000);
</script>
<?
// Determine what source we should use for web components
if (file_exists('/boot/config/plugins/Unraid.net/myservers.cfg')) { // context needed for the UPC ENV local check for signed out users
extract(parse_ini_file('/boot/config/plugins/Unraid.net/myservers.cfg',true));
}
// When signed out and there's no cookie, UPC ENV should be 'local' to avoid use of external resource. Otherwise default of 'production'.
$UPC_ENV = $_COOKIE['UPC_ENV'] ?? ((empty($remote['apikey']) || empty($var['regFILE'])) ? 'local' : 'production');
$upcBase = file_exists('/usr/local/emhttp/plugins/dynamix.unraid.net/webComps/unraid.min.js') ? 'unraid.min.js' : 'unraid.js'; // needed for the server to be agnostic of min or non min versions of the web components
$upcSrc = 'https://registration.unraid.net/webComps/unraid.min.js'; // by default prod is loaded from hosted sources
switch ($UPC_ENV) {
case 'staging': // min version of staging
$upcSrc = 'https://registration-dev.unraid.net/webComps/unraid.min.js';
break;
case 'staging-debug': // non-min version of staging
$upcSrc = 'https://registration-dev.unraid.net/webComps/unraid.js';
break;
case 'local': // forces load from webGUI filesystem.
$upcSrc = '/plugins/dynamix.unraid.net/webComps/' . $upcBase; // @NOTE - that using autov(); would render the file name below the body tag. So dont use it :(
break;
case 'development': // dev server for RegWiz development
$upcSrc = 'https://launchpad.unraid.test:6969/webComps/unraid.js';
break;
}
// add the intended web component source to the DOM
echo '<script id="unraid-wc" defer src="' . $upcSrc . '"></script>';
?>
<!-- /RegWiz -->
</head>
<body>
<div id="template">
@@ -422,12 +505,482 @@ $(function() {
<a href="https://unraid.net" target="_blank"><?readfile("$docroot/webGui/images/UN-logotype-gradient.svg")?></a>
<?=_('Version')?>: <?=$var['version']?><?=$notes?>
</div>
<div class="block">
<span class="text-left"><?=_('Server')?><br><?=_('Description')?><br><?=_('Registration')?><br><?=_('Uptime')?></span>
<span class="text-right"><?=$var['NAME']." &bullet; ".$eth0['IPADDR:0']?><br/><?=$var['COMMENT']?><br/>
<a href="/Tools/Registration" title="<?=_('Go to Registration page')?>"><?=_('Unraid OS')?> <span id="licensetype"><?=_($var['regTy'])?></span><span id="licenseexpire"></span></a><br/>
<span class="uptime"></span></span>
</div>
<!-- RegWiz -->
<?
if (file_exists('/boot/config/plugins/Unraid.net/myservers.cfg')) {
extract(parse_ini_file('/boot/config/plugins/Unraid.net/myservers.cfg',true));
}
$serverstate = [
"avatar" => $remote['avatar'],
"deviceCount" => $var['deviceCount'],
"email" => ($remote['email']) ? $remote['email'] : '',
"flashproduct" => $var['flashProduct'],
"flashvendor" => $var['flashVendor'],
"guid" => $var['flashGUID'],
"internalip" => $_SERVER['SERVER_ADDR'],
"internalport" => $_SERVER['SERVER_PORT'],
"keyfile" => str_replace(['+','/','='], ['-','_',''], trim(base64_encode(@file_get_contents($var['regFILE'])))),
"protocol" => $_SERVER['REQUEST_SCHEME'],
"reggen" => (int)$var['regGen'],
"registered" => empty($remote['apikey']) || empty($var['regFILE']) ? 0 : 1,
"sendCrashInfo" => $remote['sendCrashInfo'] || 'no',
"serverip" => $_SERVER['SERVER_ADDR'],
"servername" => $var['NAME'],
"site" => $_SERVER['REQUEST_SCHEME']."://".$_SERVER['HTTP_HOST'],
"state" => strtoupper(empty($var['regCheck']) ? $var['regTy'] : $var['regCheck']),
"ts" => time(),
"username" => $remote['username'],
];
// upc translations
$upc_translations = [
($_SESSION['locale']) ? $_SESSION['locale'] : 'en_US' => [
'getStarted' => _('Get Started'),
'signIn' => _('Sign In'),
'signUp' => _('Sign Up'),
'signOut' => _('Sign Out'),
'error' => _('Error'),
'fixError' => _('Fix Error'),
'closeLaunchpad' => _('Close Launchpad and continue to webGUI'),
'learnMore' => _('Learn more'),
'popUp' => _('Pop-up'),
'close' => _('Close'),
'backToPopUp' => sprintf(_('Back to %s'), _('Pop-up')),
'closePopUp' => sprintf(_('Close %s'), _('Pop-up')),
'contactSupport' => _('Contact Support'),
'lanIp' => sprintf(_('LAN IP %s'), '{0}'),
'continueToUnraid' => _('Continue to Unraid'),
'year' => _('year'),
'years' => _('years'),
'month' => _('month'),
'months' => _('months'),
'day' => _('day'),
'days' => _('days'),
'hour' => _('hour'),
'hours' => _('hours'),
'minute' => _('minute'),
'minutes' => _('minutes'),
'second' => _('second'),
'seconds' => _('seconds'),
'ago' => _('ago'),
'basicPlusPro' => [
'heading' => _('Thank you for choosing Unraid OS'),
'message' => [
'registered' => _('Get started by signing in to Unraid.net'),
'upgradeEligible' => _('To support more storage devices as your server grows click Upgrade Key')
]
],
'actions' => [
'purchase' => _('Purchase Key'),
'upgrade' => _('Upgrade Key'),
'recover' => _('Recover Key'),
'replace' => _('Replace Key'),
'extend' => _('Extend Trial'),
],
'upc' => [
'avatarAlt' => _("{0} Avatar"),
'confirmClosure' => _('Confirm closure then continue to webGUI'),
'closeDropdown' => _('Close dropdown'),
'openDropdown' => _('Open dropdown'),
'pleaseConfirmClosureYouHaveOpenPopUp' => _('Please confirm closure. You have an open pop-up.'),
'trialHasExpiredSeeOptions' => _('Trial has expired see options below'),
'extraLinks' => [
'newTab' => sprintf(_('Opens %s in new tab'), '{0}'),
'myServers' => _('My Servers Dashboard'),
'forums' => _('Unraid Forums'),
'settings' => [
'text' => _('Settings'),
'title' => _('Settings > Management Access • Unraid.net'),
],
],
'meta' => [
'trial' => [
'active' => [
'date' => sprintf(_('Trial key expires at %s'), '{date}'),
'timeDiff' => sprintf(_('Trial expires in %s'), '{timeDiff}'),
],
'expired' => [
'date' => sprintf(_('Trial key expired at %s'), '{date}'),
'timeDiff' => sprintf(_('Trial expired %s'), '{timeDiff}'),
],
],
'uptime' => [
'date' => sprintf(_('Server up since %s'), '{date}'),
'readable' => sprintf(_('Uptime %s'), '{timeDiff}'),
],
],
'myServers' => [
'heading' => _('My Servers'),
'beta' => _('beta'),
'errors' => [
'unraidApi' => [
'heading' => _('Unraid API Error'),
'message' => _('Failed to connect to Unraid API'),
],
'myServers' => [
'heading' => _('My Servers Error'),
'message' => _('Please wait a moment and reload the page'),
],
],
'closeDetails' => _('Close Details'),
'loading' => _('Loading My Servers data'),
'displayingLastKnown' => _('Displaying last known server data'),
'mothership' => [
'connected' => _('Connected to Mothership'),
'notConnected' => _('Not Connected to Mothership'),
],
'accessLabels' => [
'current' => _('Current server'),
'local' => _('Local access'),
'offline' => _('Server Offline'),
'remote' => _('Remote access'),
'unavailable' => _('Access unavailable'),
],
],
'opensNewHttpsWindow' => [
'base' => sprintf(_('Opens new HTTPS window to %s'), '{0}'),
'signIn' => sprintf(_('Opens new HTTPS window to %s'), _('Sign In')),
'signIn' => sprintf(_('Opens new HTTPS window to %s'), _('Sign Out')),
'purchase' => sprintf(_('Opens new HTTPS window to %s'), _('Purchase Key')),
'upgrade' => sprintf(_('Opens new HTTPS window to %s'), _('Upgrade Key')),
],
'signInActions' => [
'resolve' => _('Sign In to resolve'),
'purchaseKey' => _('Sign In to Purchase Key'),
'purchaseKeyOrExtendTrial' => _('@:upc.signInActions.purchaseKey or @:actions.extend'),
],
],
'stateData' => [
'ENOKEYFILE' => [
'humanReadable' => _('No Keyfile'),
'heading' => [
'registered' => _('Thanks for supporting Unraid'),
'notRegistered' => _("Let's unleash your hardware!"),
],
'message' => [
'registered' => _('You are all set 👍'),
'notRegistered' => _('Sign in or sign up to get started'),
],
],
'TRIAL' => [
'humanReadable' => _('Trial'),
'heading' => _('Thank you for choosing Unraid OS'),
'message' => _('Your Trial key includes all the functionality and device support of a Pro key.') . ' ' . _('After your Trial has reached expiration your server still functions normally until the next time you Stop the array or reboot your server.') . ' ' . _('At that point you may either purchase a license key or request a Trial extension.'),
'_extraMsg' => sprintf(_('You have %s remaining on your Trial key'), '{parsedExpireTime}'),
],
'EEXPIRED' => [
'humanReadable' => _('Trial Expired'),
'heading' => _('Your Trial has expired'),
'message' => [
'base' => _('To continue using Unraid OS you may purchase a license key'),
'extensionNotEligible' => _('You have used all your Trial extensions') .' @:stateData.EEXPIRED.message.base',
'extensionEligible' => '@:stateData.EEXPIRED.message.base ' . _('Alternately, you may request a Trial extension'),
],
],
'BASIC' => [
'humanReadable' => _('Basic'),
],
'PLUS' => [
'humanReadable' => _('Plus'),
],
'PRO' => [
'humanReadable' => _('Pro'),
],
'EGUID' => [
'humanReadable' => _('GUID Error'),
'error' => [
'heading' => _('Registration key / GUID mismatch'),
'message' => [
'default' => _('The license key file does not correspond to the USB Flash boot device. Please copy the correct key file to the /boot/config directory on your USB Flash boot device or choose Purchase Key.'),
'replacementIneligible' => _('Your Unraid registration key is ineligible for replacement as it has been replaced within the last 12 months.'),
'replacementEligible' => _('The license key file does not correspond to the USB Flash boot device. Please copy the correct key file to the /boot/config directory on your USB Flash boot device or choose Purchase Key or Replace Key.'),
],
],
],
'ENOKEYFILE2' => [
'humanReadable' => _('Missing key file'),
'error' => [
'heading' => _('@:stateData.ENOKEYFILE2.humanReadable'),
'message' => _('It appears that your license key file is corrupted or missing. The key file should be located in the bootconfig directory on your USB Flash boot device. If you do not have a backup copy of your license key file you may attempt to recover your key. If this was a Trial installation, you may purchase a license key.'),
],
],
'ETRIAL' => [
'humanReadable' => _('Invalid installation'),
'error' => [
'heading' => _('@:stateData.ETRIAL.humanReadable'),
'message' => _('It is not possible to use a Trial key with an existing Unraid OS installation. You may purchase a license key corresponding to this USB Flash device to continue using this installation.'),
],
],
'ENOKEYFILE1' => [
'humanReadable' => _('No Keyfile'),
'error' => [
'heading' => _('No USB flash configuration data'),
'message' => _('There is a problem with your USB Flash device'),
],
],
'ENOFLASH' => [
'humanReadable' => _('No Flash'),
'error' => [
'heading' => _('Cannot access your USB Flash boot device'),
'message' => _('There is a physical problem accessing your USB Flash boot device'),
],
],
'EGUID1' => [
'humanReadable' => _('Multiple License Keys Present'),
'error' => [
'heading' => _('@:stateData.EGUID1.humanReadable'),
'message' => _('There are multiple license key files present on your USB flash device and none of them correspond to the USB Flash boot device. Please remove all key files except the one you want to replace from the bootconfig directory on your USB Flash boot device. Alternately you may purchase a license key for this USB flash device. If you want to replace one of your license keys with a new key bound to this USB Flash device please first remove all other key files first.'),
],
],
'EBLACKLISTED' => [
'humanReadable' => _('BLACKLISTED'),
'error' => [
'heading' => _('Blacklisted USB Flash GUID'),
'message' => _('This USB Flash boot device has been blacklisted. This can occur as a result of transferring your license key to a replacement USB Flash device, and you are currently booted from your old USB Flash device. A USB Flash device may also be blacklisted if we discover the serial number is not unique this is common with USB card readers.'),
],
],
'EBLACKLISTED1' => [
'humanReadable' => _('@:stateData.EBLACKLISTED.humanReadable'),
'error' => [
'heading' => _('USB Flash device error'),
'message' => _('This USB Flash device has an invalid GUID. Please try a different USB Flash device.'),
],
],
'EBLACKLISTED2' => [
'humanReadable' => _('@:stateData.EBLACKLISTED.humanReadable'),
'error' => [
'heading' => _('USB Flash has no serial number'),
'message' => _('@:stateData.EBLACKLISTED.error.message'),
],
],
'ENOCONN' => [
'humanReadable' => _('Trial Requires Internet Connection'),
'error' => [
'heading' => _('Cannot validate Unraid Trial key'),
'message' => _('Your Trial key requires an internet connection. Please check Settings > Network.'),
],
],
'STALE' => [
'humanReadable' => _('Stale'),
'error' => [
'heading' => _('Stale Server'),
'message' => _('Please refresh the page to ensure you load your latest configuration'),
],
],
],
'regWizPopUp' => [
'regWiz' => _('Registration Wizard'),
'toHome' => _('To Registration Wizard Home'),
'continueTrial' => _('Continue Trial'),
'serverInfoToggle' => _('Toggle server info visibility'),
'youCanSafelyCloseThisWindow' => _('You can safely close this window'),
'automaticallyClosingIn' => sprintf(_('Auto closing in %s'), '{0}'),
'byeBye' => _('bye bye 👋'),
'browserWillSelfDestructIn' => sprintf(_('Browser will self destruct in %s'), '{0}'),
'closingPopUpMayLeadToErrors' => _('Closing this pop-up window while actions are being preformed may lead to unintended errors'),
'goBack' => _('Go Back'),
'shutDown' => _('Shut Down'),
'haveAccountSignIn' => _('Already have an account? Sign In'),
'noAccountSignUp' => _("Don't have an account? Sign Up"),
'serverInfo' => [
'flash' => _('Flash'),
'product' => _('Product'),
'GUID' => _('GUID'),
'name' => _('Name'),
'ip' => _('IP'),
],
'forms' => [
'displayName' => _('Display Name'),
'emailAddress' => _('Email Address'),
'displayNameOrEmailAddress' => _('Display Name or Email Address'),
'displayNameRootMessage' => _('Use your Unraid.net credentials, not your local server credentials'),
'honeyPotCopy' => _('If you fill this field out then your email will not be sent'),
'fieldRequired' => _('This field is required'),
'submit' => _('Submit'),
'submitting' => _('Submitting'),
'notValid' => _('Form not valid'),
'cancel' => _('Cancel'),
'confirm' => _('Confirm'),
'createMyAccount' => _('Create My Account'),
'subject' => _('Subject'),
'password' => _('Password'),
'togglePasswordVisibility' => _('Toggle Password Visibility'),
'message' => _('Message'),
'confirmPassword' => _('Confirm Password'),
'passwordMinimum' => _('8 or more characters'),
'comments' => _('comments'),
'newsletterCopy' => _('Sign me up for the monthly Unraid newsletter: a digest of recent blog posts, community videos, popular forum threads, product announcements, and more'),
'terms' => [
'iAgree' => _('I agree to the'),
'text' => _('Terms of Use'),
],
],
'routes' => [
'extendTrial' => [
'heading' => [
'loading' => _('Extending Trial'),
'error' => _('Trial Extension Failed'),
],
],
'forgotPassword' => [
'heading' => _('Forgot Password'),
'subheading' => _("After resetting your password come back to the Registration Wizard pop-up window to Sign In and complete your server's registration"),
'resetPasswordNow' => _('Reset Password Now'),
'backToSignIn' => _('Back to Sign In'),
],
'signIn' => [
'heading' => [
'signIn' => _('Unraid.net Sign In'),
'recover' => _('Unraid.net Sign In to Recover Key'),
'replace' => _('Unraid.net Sign In to Replace Key'),
],
'subheading' => _('Please sign in with your Unraid.net forum account'),
'form' => [
'replacementConditions' => [
'name' => _('Acknowledge Replacement Conditions'),
'label' => _('I acknowledge that replacing a license key results in permanently blacklisting the previous USB Flash GUID'),
],
'label' => [
'password' => [
'replace' => _('Unraid.net account password'),
],
],
],
],
'signUp' => [
'heading' => _('Sign Up for Unraid.net'),
'subheading' => _('This setup will help you get your server up and running'),
],
'signOut' => [
'heading' => _('Unraid.net Sign Out'),
],
'success' => [
'heading' => [
'username' => sprintf(_('Hi %s'), '{0}'),
'default' => _('Success'),
],
'subheading' => [
'extention' => _('Your trial will expire in 15 days'),
'newTrial' => _('Your trial will expire in 30 days'),
],
'signIn' => [
'tileTitle' => [
'actionFail' => sprintf(_('%s was not signed in to your Unraid.net account'), '{0}'),
'actionSuccess' => sprintf(_('%s is signed in to your Unraid.net account'), '{0}'),
'loading' => sprintf(_('Signing in %s to Unraid.net account'), '{0}'),
],
],
'signOut' => [
'tileTitle' => [
'actionFail' => sprintf(_('%s was not signed out of your Unraid.net account'), '{0}'),
'actionSuccess' => sprintf(_('%s was signed out of your Unraid.net account'), '{0}'),
'loading' => sprintf(_('Signing out %s from Unraid.net account'), '{0}'),
],
],
'keys' => [
'trial' => _('Trial'),
'basic' => _('Basic'),
'plus' => _('Plus'),
'pro' => _('Pro'),
],
'extended' => sprintf(_('%s Key Extended'), '{0}'),
'recovered' => sprintf(_('%s Key Recovered'), '{0}'),
'replaced' => sprintf(_('%s Key Replaced'), '{0}'),
'created' => sprintf(_('%s Key Created'), '{0}'),
'install' => [
'loading' => sprintf(_('Installing %s Key'), '{0}'),
'error' => sprintf(_('%s Key Install Error'), '{0}'),
'success' => sprintf(_('Installed %s Key'), '{0}'),
],
'timeout' => sprintf(_('Communication with %s has timed out'), '{0}'),
'loading1' => _('Please keep this window open'),
'loading2' => _('Were working our magic'),
'countdown' => [
'success' => [
'prefix' => sprintf(_('Auto closing in %s'), '{0}'),
'text' => _('You can safely close this window'),
],
'error' => [
'prefix' => sprintf(_('Auto redirecting in %s'), '{0}'),
'text' => _('Back to Registration Home'),
'complete' => _('Back in a flash ⚡️'),
],
],
],
'troubleshoot' => [
'heading' => [
'default' => _('Troubleshoot'),
'success' => _('Thank you for contacting Unraid'),
],
'subheading' => [
'default' => _("Forgot what Unraid.net account you used? Have a USB flash device that already has an account associated with it? Just give us the details about what happened and we'll do our best to get you up and running again."),
'success' => _('We have received your e-mail and will respond in the order it was received. While we strive to respond to all requests as quickly as possible please allow for up to 3 business days for a response.'),
],
'relevantServerData' => _('Your USB Flash GUID and other relevant server data will also be sent'),
],
'verifyEmail' => [
'heading' => _('Verify Email'),
'form' => [
'verificationCode' => _('verification code'),
'verifyCode' => _('Paste or Enter code'),
],
'noCode' => _("Didn't get code?"),
],
'whatIsUnraidNet' => [
'heading' => _('What is Unraid.net?'),
'subheading' => _('Expand your servers capabilities'),
'copy' => _('With an Unraid.net account you can start using My Servers (beta) which gives you access to the following features:'),
'features' => [
'secureRemoteAccess' => [
'heading' => _('Secure remote access'),
'copy' => _("Whether you need to add a share container or virtual machine do it all from the webGui from anytime and anywhere using HTTPS. Best of all all SSL certificates are verified by Let's Encrypt so no browser security warnings."),
],
'realTimeMonitoring' => [
'heading' => _('Real-time Monitoring'),
'copy' => _('Get quick real-time info on the status of your servers such as storage container and VM usage. And not just for one server but all the servers in your Unraid fleet'),
],
'usbFlashBackup' => [
'heading' => _('USB Flash Backup'),
'copy' => _('Click a button and your flash is automatically backed up to Unraid.net enabling easy recovery in the event of a device failure. Never self-managehost your flash backups again'),
],
'regKeyManagement' => [
'heading' => _('Registration key management'),
'copy' => _('Download any registration key linked to your account. Upgrade keys to higher editions.'),
],
],
],
'notFound' => [
'subheading' => _('Page Not Found'),
],
'notAllowed' => [
'subheading' => _('Page Not Allowed'),
],
],
],
],
];
?>
<unraid-user-profile
apikey="<?=($remote['apikey']) ? $remote['apikey'] : ''?>"
banner="<?=($display['banner']) ? $display['banner'] : ''?>"
bgcolor="<?=($backgnd) ? '#'.$backgnd : ''?>"
csrf="<?=$var['csrf_token']?>"
displaydesc="<?=($display['headerdescription']!='no') ? 'true' : ''?>"
expiretime="<?=1000*($var['regTy']=='Trial'||strstr($var['regTy'],'expired')?$var['regTm2']:0)?>"
hide-my-servers="<?=(file_exists('/usr/local/sbin/unraid-api')) ? '' : 'yes' ?>"
locale="<?=($_SESSION['locale']) ? $_SESSION['locale'] : 'en_US'?>"
locale-messages="<?=rawurlencode(json_encode($upc_translations, JSON_UNESCAPED_SLASHES, JSON_UNESCAPED_UNICODE))?>"
metacolor="<?=($display['headermetacolor']) ? '#'.$display['headermetacolor'] : ''?>"
prop-state-endpoint="/plugins/dynamix.unraid.net/include/state.php"
reg-wiz-time="<?=($remote['regWizTime']) ? $remote['regWizTime'] : ''?>"
send-crash-info="<?=$remote['sendCrashInfo']?>"
serverdesc="<?=$var['COMMENT']?>"
servermodel="<?=$var['SYS_MODEL']?>"
serverstate="<?=rawurlencode(json_encode($serverstate, JSON_UNESCAPED_SLASHES))?>"
textcolor="<?=($header) ? '#'.$header : ''?>"
theme="<?=$display['theme']?>"
uptime="<?=1000*(time() - round(strtok(exec("cat /proc/uptime"),' ')))?>"
></unraid-user-profile>
</div>
<a href="#" class="back_to_top" title="<?=_('Back To Top')?>"><i class="fa fa-arrow-circle-up"></i></a>
<?

View File

@@ -44,9 +44,9 @@
# Quick test with default values:
# bash /boot/config/plugins/dynamix/notifications/agents/Discord.sh
# Quick test with values set through environment (all vars are optional)
# EVENT="My Event" SUBJECT="My Subject" DESCRIPTION="My Description" CONTENT="My Message" IMPORTANCE="alert" bash /boot/config/plugins/dynamix/notifications/agents/Discord.sh
# EVENT="My Event" SUBJECT="My Subject" DESCRIPTION="My Description" CONTENT="My Message" IMPORTANCE="alert" LINK="/Dashboard" bash /boot/config/plugins/dynamix/notifications/agents/Discord.sh
# Full test of notification system (at least one param is required)
# /usr/local/emhttp/webGui/scripts/notify -e "My Event" -s "My Subject" -d "My Description" -m "My Message" -i "alert"
# /usr/local/emhttp/webGui/scripts/notify -e "My Event" -s "My Subject" -d "My Description" -m "My Message" -i "alert" -l "/Dashboard"
#
# If a notification does not go through, check the /var/log/notify_Discord file for hints
############
@@ -61,6 +61,7 @@
# SUBJECT (notify -s)
# DESCRIPTION (notify -d)
# CONTENT (notify -m)
# LINK (notify -l)
# TIMESTAMP (seconds from epoch)
SCRIPTNAME=$(basename "$0")
@@ -72,6 +73,7 @@ LOG="/var/log/notify_${SCRIPTNAME%.*}"
[[ -z "${DESCRIPTION}" ]] && DESCRIPTION='No description'
[[ -z "${IMPORTANCE}" ]] && IMPORTANCE='normal'
[[ -z "${TIMESTAMP}" ]] && TIMESTAMP=$(date +%s)
[[ -n "${LINK}" ]] && [[ ${LINK} != http* ]] && LINK=$(</var/run/nginx.origin)${LINK}
# note: there is no default for CONTENT
# send DESCRIPTION and/or CONTENT. Ignore the default DESCRIPTION.
@@ -147,6 +149,10 @@ esac
# if SERVER_ICON is defined, use it
[[ -n "${SERVER_ICON}" && "${SERVER_ICON:0:8}" == "https://" ]] && ICON_URL="\"icon_url\": \"${SERVER_ICON}\","
# https://birdie0.github.io/discord-webhooks-guide/structure/embed/url.html
# if LINK is defined, use it
[[ -n "${LINK}" ]] && LINK_URL="\"url\": \"${LINK}\","
DATA=$(
cat <<EOF
{
@@ -155,6 +161,7 @@ DATA=$(
{
"title": "${EVENT:0:256}",
"description": "${SUBJECT:0:2043}",
${LINK_URL}
"timestamp": ${FORMATTED_TIMESTAMP},
"color": "${COLOR}",
"author": {

View File

@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
/* Copyright 2005-2021, Lime Technology
* Copyright 2012-2021, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -36,7 +36,7 @@ function PsEnded($pid) {
function PsKill($pid) {
exec("kill -9 $pid");
}
if (PsExecute("$docroot/webGui/scripts/notify -s 'Unraid SMTP Test' -d 'Test message received!' -i 'alert' -t")) {
if (PsExecute("$docroot/webGui/scripts/notify -s 'Unraid SMTP Test' -d 'Test message received!' -i 'alert' -l '/Settings/Notifications' -t")) {
$result = exec("tail -3 /var/log/syslog|awk '/sSMTP/ {getline;print}'|cut -d']' -f2|cut -d'(' -f1");
$color = strpos($result, 'Sent mail') ? 'green' : 'red';
echo _("Test result")."<span class='$color'>$result</span>";

View File

@@ -79,6 +79,10 @@ div.case-name{margin-top:8px;font-family:clear-sans!important}
<script src="<?autov('/webGui/javascript/dynamix.js')?>"></script>
<script>
function importFile(file) {
if (file.name.split(".").pop().toLowerCase() !== "png") {
alert("<?=_("Only png images are allowed!")?>");
return;
}
var reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = function(e){$.post('/webGui/include/SelectCase.php',{mode:'file',file:'<?=$file?>',data:e.target.result,csrf_token:'<?=$_GET['csrf']?>'},function(){top.Shadowbox.close();})};

View File

@@ -46,29 +46,32 @@ function exert($cmd, &$save=null) {
}
function shareDisks($share) {
return exec("shopt -s dotglob; getfattr --no-dereference --absolute-names --only-values -n system.LOCATIONS ".escapeshellarg("/usr/local/emhttp/mnt/user/$share")." 2>/dev/null") ?: "no drives";
return exec("shopt -s dotglob; getfattr --no-dereference --absolute-names --only-values -n system.LOCATIONS ".escapeshellarg("/usr/local/emhttp/mnt/user/$share")." 2>/dev/null") ?: "";
}
function anonymize($text,$select) {
global $all;
global $all, $customShares;
if ($all) return $text;
switch ($select) {
case 1:
$rows = explode("\n", $text);
$regex = "/\b((disk|cache|parity|cpu|eth|dev)[0-9]+)|(smart|flash|flashbackup|cache|parity|cpu$customShares)\b/";
foreach ($rows as &$row) {
if (!preg_match("/\b(disk|cache|parity|flash)\d*\b/", $row)) {
if (!preg_match($regex, $row)) {
$row = preg_replace("/^(\s*\[\S).*(\S\])( => Array)$/","$1..$2$3",$row);
$row = preg_replace("/^(\s*\[(name|nameOrig|comment|flashGUID|regGUID|regTo|readList|writeList|csrf_token)\] => \S).*(\S)$/","$1..$3",$row);
$row = preg_replace("/^(\s*\[(cachePool|name|nameOrig|comment|flashGUID|regGUID|regTo|readList|writeList|csrf_token)\] => \S).*(\S)$/","$1..$3",$row);
}
}
return implode("\n", $rows);
case 2:
$name = basename($text,'.cfg');
$len = strlen($name);
if ($len>2) {
$dash = str_repeat('-',$len-2);
$name = preg_replace("/^(\S).*(\S)/","$1$dash$2",$name);
$i = 1;
while (file_exists(dirname($text)."/$name.cfg")) {$name = substr($name,0,$len)." ($i)"; $i++;}
if ($name !== "cache") {
$len = strlen($name);
if ($len>2) {
$dash = str_repeat('-',$len-2);
$name = preg_replace("/^(\S).*(\S)/","$1$dash$2",$name);
$i = 1;
while (file_exists(dirname($text)."/$name.cfg")) {$name = substr($name,0,$len)." ($i)"; $i++;}
}
}
return dirname($text)."/$name.cfg";
}
@@ -100,6 +103,22 @@ if ($cli) {
$split = explode('-', $diag);
$date = "{$split[2]}-{$split[3]}";
}
// don't anonymize system share names
$vardomain = (array)@parse_ini_file('/boot/config/domain.cfg');
$vardocker = (array)@parse_ini_file('/boot/config/docker.cfg');
$showshares = [];
$showshares[] = current(array_slice(explode('/',$vardomain['IMAGE_FILE']), 3, 1)).'.cfg';
$showshares[] = current(array_slice(explode('/',$vardomain['DOMAINDIR']), 3, 1)).'.cfg';
$showshares[] = current(array_slice(explode('/',$vardomain['MEDIADIR']), 3, 1)).'.cfg';
$showshares[] = current(array_slice(explode('/',$vardomain['DISKDIR']), 3, 1)).'.cfg';
$showshares[] = current(array_slice(explode('/',$vardocker['DOCKER_IMAGE_FILE']), 3, 1)).'.cfg';
$showshares[] = current(array_slice(explode('/',$vardocker['DOCKER_APP_CONFIG_PATH']), 3, 1)).'.cfg';
$showshares[] = current(array_slice(explode('/',$vardocker['DOCKER_HOME']), 3, 1)).'.cfg';
foreach ($showshares as $show) {
$showme = str_replace(".cfg","",$show);
if ($showme)
$customShares .= "|$showme";
}
// create folder structure
exert("mkdir -p ".escapeshellarg("/$diag/system")." ".escapeshellarg("/$diag/config")." ".escapeshellarg("/$diag/logs")." ".escapeshellarg("/$diag/shares")." ".escapeshellarg("/$diag/smart")." ".escapeshellarg("/$diag/qemu")." ".escapeshellarg("/$diag/xml"));
// get utilization of running processes
@@ -162,21 +181,11 @@ foreach ($folders as $folder) {
// copy configuration files (suppress errors)
exert("cp /boot/config/*.{cfg,conf,dat} ".escapeshellarg("/$diag/config")." 2>/dev/null");
exert("cp /boot/config/go ".escapeshellarg("/$diag/config/go.txt")." 2>/dev/null");
if (!$all)
exert("sed -i -e '/password/c ***line removed***' -e '/user/c ***line removed***' -e '/pass/c ***line removed***' ".escapeshellarg("/$diag/config/go.txt"));
// anonymize configuration files
if (!$all) exert("sed -ri 's/^((disk|flash)(Read|Write)List.*=\")[^\"]+/\\1.../' ".escapeshellarg("/$diag/config/*.cfg")." 2>/dev/null");
// don't anonymize system share names
$vardomain = (array)@parse_ini_file('/boot/config/domain.cfg');
$vardocker = (array)@parse_ini_file('/boot/config/docker.cfg');
$showshares = [];
$showshares[] = current(array_slice(explode('/',$vardomain['IMAGE_FILE']), 3, 1)).'.cfg';
$showshares[] = current(array_slice(explode('/',$vardomain['DOMAINDIR']), 3, 1)).'.cfg';
$showshares[] = current(array_slice(explode('/',$vardomain['MEDIADIR']), 3, 1)).'.cfg';
$showshares[] = current(array_slice(explode('/',$vardomain['DISKDIR']), 3, 1)).'.cfg';
$showshares[] = current(array_slice(explode('/',$vardocker['DOCKER_IMAGE_FILE']), 3, 1)).'.cfg';
$showshares[] = current(array_slice(explode('/',$vardocker['DOCKER_APP_CONFIG_PATH']), 3, 1)).'.cfg';
$showshares[] = current(array_slice(explode('/',$vardocker['DOCKER_HOME']), 3, 1)).'.cfg';
// copy share information (anonymize if applicable)
$files = glob("/boot/config/shares/*.cfg");
foreach ($files as $file) {
@@ -187,7 +196,23 @@ foreach ($files as $file) {
@copy($file, $dest);
if (!$all) exert("sed -ri 's/^(share(Comment|ReadList|WriteList)=\")[^\"]+/\\1.../' ".escapeshellarg($dest)." 2>/dev/null");
$share = pathinfo(basename($file),PATHINFO_FILENAME);
file_put_contents($dest,"# Share exists on ".shareDisks($share)."\r\n",FILE_APPEND);
$shareExists = explode(",",shareDisks($share));
unset($exists);
foreach ($shareExists as $anon) {
if ( !$all )
if (!preg_match("/\b((disk)[0-9]+)|(cache)\b/", $anon)) {
$len = strlen($anon);
if ($len>2) {
$dash = str_repeat('-',$len-2);
$exists[] = substr($anon,0,1).$dash.substr($anon,-1);
}
}
else
$exists[] = $anon;
}
$exists = $exists ?: ["no drives"];
file_put_contents($dest,"# Share exists on ".implode(", ",$exists)."\r\n",FILE_APPEND);
}
// create default user shares information
$shares = (array)@parse_ini_file("$get/shares.ini", true);

View File

@@ -1,7 +1,7 @@
#!/usr/bin/php -q
<?PHP
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
/* Copyright 2005-2021, Lime Technology
* Copyright 2012-2021, Bergware International.
* Copyright 2012, Andrew Hamer-Adams, http://www.pixeleyes.co.nz.
*
* This program is free software; you can redistribute it and/or
@@ -49,7 +49,7 @@ EOT;
return 1;
}
function generate_email($event, $subject, $description, $importance, $message, $recipients) {
function generate_email($event, $subject, $description, $importance, $message, $recipients, $fqdnlink) {
global $ssmtp;
$rcpt = $ssmtp['RcptTo'];
@@ -74,6 +74,11 @@ function generate_email($event, $subject, $description, $importance, $message, $
$headers[] = "";
$body = [];
if (!empty($fqdnlink)) {
$body[] = "Link: $fqdnlink";
$body[] = " (Note: if clicking link requires reauthentication, copy/paste instead)";
$body[] = "";
}
$body[] = "Event: $event";
$body[] = "Subject: $subject";
$body[] = "Description: $description";
@@ -167,6 +172,7 @@ case 'add':
$ticket = $timestamp;
$mailtest = false;
$overrule = false;
$host = rtrim(file_get_contents("/var/run/nginx.origin"));
$options = getopt("l:e:s:d:i:m:r:xtb");
foreach ($options as $option => $value) {
@@ -201,18 +207,19 @@ case 'add':
break;
case 'l':
$link = $value;
$fqdnlink = (strpos($link,"http") === 0) ? $link : $host.$link;
break;
}
}
$unread = "{$unread}/".safe_filename("{$event}-{$ticket}.notify");
$archive = "{$archive}/".safe_filename("{$event}-{$ticket}.notify");
if (file_exists($archive)) break;
$entity = $overrule===false ? $notify[$importance] : $overrule;
if (!$mailtest) file_put_contents($archive,"timestamp=$timestamp\nevent=$event\nsubject=$subject\ndescription=$description\nimportance=$importance\n".($message ? "message=".str_replace('\n','<br>',$message)."\n" : ""));
if (($entity & 1)==1 && !$mailtest && !$noBrowser) file_put_contents($unread,"timestamp=$timestamp\nevent=$event\nsubject=$subject\ndescription=$description\nimportance=$importance\nlink=$link\n");
if (($entity & 2)==2 || $mailtest) if (!generate_email($event, $subject, str_replace('<br>','. ',$description), $importance, $message, $recipients)) exit(1);
if (($entity & 4)==4 && !$mailtest) { if (is_array($agents)) {foreach ($agents as $agent) {exec("TIMESTAMP='$timestamp' EVENT=".escapeshellarg($event)." SUBJECT=".escapeshellarg($subject)." DESCRIPTION=".escapeshellarg($description)." IMPORTANCE=".escapeshellarg($importance)." CONTENT=".escapeshellarg($message)." bash ".$agent);};}};
if (($entity & 2)==2 || $mailtest) if (!generate_email($event, $subject, str_replace('<br>','. ',$description), $importance, $message, $recipients, $fqdnlink)) exit(1);
if (($entity & 4)==4 && !$mailtest) { if (is_array($agents)) {foreach ($agents as $agent) {exec("TIMESTAMP='$timestamp' EVENT=".escapeshellarg($event)." SUBJECT=".escapeshellarg($subject)." DESCRIPTION=".escapeshellarg($description)." IMPORTANCE=".escapeshellarg($importance)." CONTENT=".escapeshellarg($message)." LINK=".escapeshellarg($fqdnlink)." bash ".$agent);};}};
break;
case 'get':