Merge branch 'master' of github.com:limetech/webgui

This commit is contained in:
Tom Mortensen
2022-04-20 19:00:56 -07:00
7 changed files with 173 additions and 70 deletions

View File

@@ -19,7 +19,8 @@ unraid-user-profile {
height: 100%;
}
unraid-launchpad {
unraid-launchpad,
unraid-promo {
position: relative;
z-index: 10001;
}

View File

@@ -1,5 +1,24 @@
<!-- myservers2 -->
<?
// add 'ipaddr' function for 6.9 backwards compatibility
if (!function_exists('ipaddr')) {
function ipaddr($ethX='eth0', $prot=4) {
global $$ethX;
switch ($$ethX['PROTOCOL:0']) {
case 'ipv4':
return $$ethX['IPADDR:0'];
case 'ipv6':
return $$ethX['IPADDR6:0'];
case 'ipv4+ipv6':
switch ($prot) {
case 4: return $$ethX['IPADDR:0'];
case 6: return $$ethX['IPADDR6:0'];
default:return [$$ethX['IPADDR:0'],$$ethX['IPADDR6:0']];}
default:
return $$ethX['IPADDR:0'];
}
}
}
if (file_exists('/boot/config/plugins/dynamix.my.servers/myservers.cfg')) {
@extract(parse_ini_file('/boot/config/plugins/dynamix.my.servers/myservers.cfg',true));
}
@@ -9,11 +28,17 @@
'getStarted' => _('Get Started'),
'signIn' => _('Sign In'),
'signUp' => _('Sign Up'),
'signInUp' => _('Sign In / Up'),
'signOut' => _('Sign Out'),
'error' => _('Error'),
'fixError' => _('Fix Error'),
'closeLaunchpad' => _('Close Launchpad and continue to webGUI'),
'installPlugin' => _('Install Plugin'),
'noThanks' => _('No thanks'),
'closePromo' => _('Close My Servers details and continue to webGUI'),
'promoHeading' => _('Enhance your Unraid experience with these<br> My Servers (BETA) features'),
'learnMore' => _('Learn more'),
'checkoutTheMyServersDocs' => _('Checkout the My Servers docs'),
'popUp' => _('Pop-up'),
'close' => _('Close'),
'backToPopUp' => sprintf(_('Back to %s'), _('Pop-up')),
@@ -37,11 +62,11 @@
'seconds' => _('seconds'),
'ago' => _('ago'),
'basicPlusPro' => [
'heading' => _('Thank you for choosing Unraid OS').'!',
'heading' => _('Thank you for choosing Unraid OS and My Servers').'!',
'message' => [
'registered' => _('Get started by signing in to Unraid.net'),
'upgradeEligible' => _('To support more storage devices as your server grows click Upgrade Key')
]
'registered' => _('Connect to My Servers by signing in to Unraid.net'),
'upgradeEligible' => _('To support more storage devices as your server grows click Upgrade Key'),
],
],
'actions' => [
'purchase' => _('Purchase Key'),
@@ -49,7 +74,9 @@
'recover' => _('Recover Key'),
'replace' => _('Replace Key'),
'extend' => _('Extend Trial'),
'startTrial' => _('Start Trial'),
'signOutUnraidNet' => _('Sign Out of Unraid.net'),
'redeemActivationCode' => _('Redeem Activation Code'),
],
'upc' => [
'avatarAlt' => '{0} '._('Avatar'),
@@ -59,6 +86,15 @@
'pleaseConfirmClosureYouHaveOpenPopUp' => _('Please confirm closure').'. '._('You have an open pop-up').'.',
'trialHasExpiredSeeOptions' => _('Trial has expired see options below'),
'errorCertRequiresSignIn' => _('Sign In before your Unraid.net SSL certificate expires'),
'removeMyServersPlugin' => _('Remove My Servers plugin'),
'continueUsingMyServers' => _('Continue using My Servers'),
'confirmMyServersPluginRemoval' => _('Confirm My Servers plugin removal'),
'removingMyServersPlugin' => _('Removing My Servers plugin…'),
'enhanceYourExperienceWithMyServers' => _('Enhance your experience with My Servers'),
'lanIpCopied' => _('LAN IP Copied'),
'installingMyServers' => _('Installing My Servers (beta)'),
'thankYouForInstallingMyServers' => _('Thank you installing My Servers') . '!',
'connectYourUnraidnetAccountToGetStarted' => _('Connect your Unraid.net account to get started'),
'noRemoteApikeyRegisteredWithPlg' => [
'heading' => _('My Servers Error'),
'msg' => _('Unraid.net re-authentication required'),
@@ -99,6 +135,7 @@
'myServers' => [
'heading' => _('My Servers'),
'beta' => _('beta'),
'restarting' => _('Restarting…'),
'errors' => [
'unraidApi' => [
'heading' => _('Unraid API Error'),
@@ -123,6 +160,11 @@
'remote' => _('Remote access'),
'unavailable' => _('Access unavailable'),
],
'api' => [
'start' => _('Restart unraid-api'),
'startTitle' => _('Executes `unraid-api start`; no terminal needed'),
'stop' => _('Stop unraid-api'),
],
],
'opensNewHttpsWindow' => [
'base' => sprintf(_('Opens new HTTPS window to %s'), '{0}'),
@@ -140,14 +182,8 @@
'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'),
],
'heading' => _("Let's unleash your hardware").'!',
'message' => '<p>'._('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').'.</p><p>'._('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').'.</p><p>'._('Note: USB memory card readers are generally not supported because most do not present unique serial numbers').'.</p><p>'._('**Important**').'</p><ul class="list-disc pl-16px"><li>'._('Please make sure your server time is accurate to within 5 minutes').'</li><li>'._('Please make sure there is a DNS server specified').'</li></ul>',
],
'TRIAL' => [
'humanReadable' => _('Trial'),
@@ -181,6 +217,7 @@
'default' => _('The license key file does not correspond to the USB Flash boot device').'. '._('Please copy the correct key file to the */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 */config* directory on your USB Flash boot device or choose Purchase Key or Replace Key').'.',
'blacklisted' => _('Your Unraid registration key is ineligible for replacement as it is blacklisted') . '.',
],
],
],
@@ -188,7 +225,7 @@
'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 */config* 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').'.',
'message' => _('It appears that your license key file is corrupted or missing').'. '._('The key file should be located in the */config* 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' => [
@@ -269,6 +306,7 @@
'shutDown' => _('Shut Down'),
'haveAccountSignIn' => _('Already have an account').'? '._('Sign In'),
'noAccountSignUp' => _('Do not have an account').'? '._('Sign Up'),
'willConnectYourServerToMyServers' => _('This will connect your server to My Servers <sup>BETA</sup>'),
'serverInfo' => [
'flash' => _('Flash'),
'product' => _('Product'),
@@ -294,6 +332,7 @@
'togglePasswordVisibility' => _('Toggle Password Visibility'),
'message' => _('Message'),
'confirmPassword' => _('Confirm Password'),
'passwordMustMatch' => _('Password confirmation must match'),
'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'),
@@ -308,6 +347,7 @@
'loading' => _('Extending Trial'),
'error' => _('Trial Extension Failed'),
],
'message' => _('Not ready to purchase?').'<br>'._('Receive an additional 15 days for your trial').'.',
],
'forgotPassword' => [
'heading' => _('Forgot Password'),
@@ -321,7 +361,6 @@
'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'),
@@ -336,7 +375,6 @@
],
'signUp' => [
'heading' => _('Create Unraid.net Account'),
'subheading' => _('This will start your free 30-day Trial'),
],
'signOut' => [
'heading' => _('Unraid.net Sign Out'),
@@ -384,7 +422,7 @@
'loading' => sprintf(_('Installing %s Key'), '{0}'),
'error' => sprintf(_('%s Key Install Error'), '{0}'),
'success' => sprintf(_('Installed %s Key'), '{0}'),
'manualInstructions' => _("To manually install the key paste the key file url into the Key file URL field on the webGUI Tools > Registration page and then click Install Key") . '.',
'manualInstructions' => _('To manually install the key paste the key file url into the Key file URL field on the webGUI Tools > Registration page and then click Install Key') . '.',
'copyFail' => _('Unable to copy'),
'copySuccess' => _('Copied key url') . '!',
'copyButton' => _('Copy Key URL'),
@@ -430,7 +468,7 @@
'goBack' => _("Have the code now? Go Back"),
'resend' => _("Resend Code"),
],
'whatIsUnraidNet' => [
'whatIsMyServers' => [
'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:'),
@@ -451,6 +489,10 @@
'heading' => _('Registration key management'),
'copy' => _('Download any registration key linked to your account').'. '._('Upgrade keys to higher editions').'.',
],
'plusMore' => [
'heading' => _('Plus more on the way'),
'copy' => _('All you need is an active internet connection, an Unraid.net account, and the <span>My Servers</span> plugin').'. '._('Get started by installing the plugin') . '.',
],
],
],
'notFound' => [
@@ -465,7 +507,12 @@
'checking' => _('Checking Wan IPs'),
'match' => sprintf(_('Remark: your WAN IPv4 is **%s**'), '{0}'),
'mismatch' => sprintf(_("Remark: Unraid's WAN IPv4 **%1s** does not match your client's WAN IPv4 **%2s**"), '{0}', '{1}').'. '._('This may indicate a complex network that will not work with this Remote Access solution').'. '._('Ignore this message if you are currently connected via Remote Access or VPN').'.',
'resolveError' => _('DNS issue, unable to resolve wanip.unraid.net'),
'resolveError' => _('DNS issue, unable to resolve wanip4.unraid.net'),
],
'upcTrigger' => [
'upgrade' => _('To support more storage devices as your server grows click the *Open Dropdown* button').'.',
'default' => _('Key management is done via the dropdown in the top right of the webGUI on every page').'.',
'open' => _('Open Dropdown'),
],
],
];
@@ -480,19 +527,26 @@
"avatar" => $remote['avatar'],
"config" => [
'valid' => $var['configValid'] === 'yes',
'error' => $var['configValid'] !== 'yes' ? (array_key_exists($var['configValid'], $configErrorEnum) ? $configErrorEnum[$var['configValid']] : 'UNKNOWN_ERROR') : null,
'error' => $var['configValid'] !== 'yes'
? (array_key_exists($var['configValid'], $configErrorEnum) ? $configErrorEnum[$var['configValid']] : 'UNKNOWN_ERROR')
: null,
],
"deviceCount" => $var['deviceCount'],
"email" => $remote['email'] ?? '',
"extraOrigins" => $api['extraOrigins'] ? explode(',', $api['extraOrigins']) : [],
"flashproduct" => $var['flashProduct'],
"flashvendor" => $var['flashVendor'],
"guid" => $var['flashGUID'],
'hasUnraidNetSSL' => file_exists('/boot/config/ssl/certs/certificate_bundle.pem') ? preg_match('/.*\.unraid\.net$/', $_SERVER['SERVER_NAME']) : 0, // required for boolean to check if user has unraid.net Let's Encrypt cert. Using for a less expensive check w/ $_SERVER['SERVER_NAME'] compared to reading cert file contents on every page load
"hasRemoteApikey" => !empty($remote['apikey']),
"internalip" => ipaddr(),
"internalport" => $_SERVER['SERVER_PORT'],
"keyfile" => str_replace(['+','/','='], ['-','_',''], trim(base64_encode(@file_get_contents($var['regFILE'])))),
"osVersion" => $var['version'],
"plgVersion" => 'base-'.$var['version'],
"plgVersion" => $plgversion = file_exists("/var/log/plugins/dynamix.unraid.net.plg")
? trim(@exec('/usr/local/sbin/plugin version /var/log/plugins/dynamix.unraid.net.plg 2>/dev/null'))
: ( file_exists("/var/log/plugins/dynamix.unraid.net.staging.plg")
? trim(@exec('/usr/local/sbin/plugin version /var/log/plugins/dynamix.unraid.net.staging.plg 2>/dev/null'))
: 'base-'.$var['version'] ),
"protocol" => $_SERVER['REQUEST_SCHEME'],
"reggen" => (int)$var['regGen'],
"regGuid" => $var['regGUID'],
@@ -504,9 +558,26 @@
"username" => $remote['username'],
"wanFQDN" => $nginx['NGINX_WANFQDN'] ?? '',
];
/** @TODO - prop refactor needed. The issue is because the prop names share the same name as the vuex store variables
* if we remove the props and deployed a UPC that doesn't rely on props anymore uses that don't have an updated version
* of this file will have a non-working UPC.
* apikey
* apiVersion
* csrf
* expiretime
* hideMyServers
* plgPath
* regWizTime
* sendCrashInfo
* serverdesc
* servermodel
* serverupdate
* uptime
*/
?>
<unraid-user-profile
apikey="<?=@$upc['apikey']?>"
apikey="<?=$upc['apikey'] ?? ''?>"
api-version="<?=$api['version'] ?? ''?>"
banner="<?=$display['banner'] ?? ''?>"
bgcolor="<?=($backgnd) ? '#'.$backgnd : ''?>"
csrf="<?=$var['csrf_token']?>"

View File

@@ -1236,6 +1236,57 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
lodash
MIT
Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
Based on Underscore.js, copyright Jeremy Ashkenas,
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
This software consists of voluntary contributions made by many
individuals. For exact contribution history, see the revision history
available at https://github.com/lodash/lodash
The following license applies to all parts of this software except as
documented below:
====
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
====
Copyright and related rights for sample code are waived via CC0. Sample
code is defined as all source code displayed within the prose of the
documentation.
CC0: http://creativecommons.org/publicdomain/zero/1.0/
====
Files located in the node_modules and vendor directories are externally
maintained libraries used by this software which have their own
licenses; we recommend you read them, as their terms may differ from the
terms above.
node-libs-browser
MIT
(The MIT License)

File diff suppressed because one or more lines are too long

View File

@@ -47,7 +47,6 @@ $addr = ipaddr($ethX);
$rebindip4 = "192.168.42.42";
$keyfile = @file_get_contents($var['regFILE']);
if ($keyfile !== false) $keyfile = base64_encode($keyfile);
$isRegistered = !empty($remote['username']); // signed in to unraid.net or not
$certFile = "/boot/config/ssl/certs/certificate_bundle.pem";
$certPresent = file_exists("$certFile");
@@ -76,10 +75,10 @@ if ($certPresent) {
}
$provisionlabel = $isLEcert ? _('Renew') : _('Provision');
$disabled_provision = !$isRegistered || $keyfile===false || ($isLEcert && $retval_expired===0) ? 'disabled' : '';
$disabled_updatedns = $isRegistered && $keyfile!==false && $isLEcert ? '' : 'disabled';
$disabled_provision = $keyfile===false || ($isLEcert && $retval_expired===0) ? 'disabled' : '';
$disabled_updatedns = $keyfile!==false && $isLEcert ? '' : 'disabled';
$disabled_delete = $certPresent && $var['USE_SSL']!='auto' ? '' : 'disabled';
$disabled_auto = $isRegistered && $isLEcert && !$dnsRebindingProtection && $dnsValid ? '' : 'disabled';
$disabled_auto = $isLEcert && !$dnsRebindingProtection && $dnsValid ? '' : 'disabled';
$upgradelabel = _('Upgrade Cert');
// Get ports in use
@@ -95,20 +94,12 @@ foreach ($output as $line) {
}
?>
<script>
var isRegistered = <?= $isRegistered ? 1 : 0 ?>;
var notRegisteredMsg = '<?= _('Sign In to Unraid.net required') ?>';
function provisionHandler(event, form) { // provisions and renewals require being Signed In to Unraid.net
if (event.submitter.value === 'Delete') return true; // always allow deletes regardless of isRegistered value
if (event.submitter.value === 'Renew') return true; // always allow renewals regardless of isRegistered value
if (!isRegistered) {
event.preventDefault();
return alert(notRegisteredMsg);
}
if (event.submitter.value === 'Delete') return true; // always allow deletes
if (event.submitter.value === 'Renew') return true; // always allow renewals
};
function updateDNS(button) {
if (!isRegistered) return alert(notRegisteredMsg);
$(button).prop("disabled", true).html("<i class='fa fa-circle-o-notch fa-spin fa-fw'></i>_(Update DNS)_");
var failure = function(data) {
var status = data.status;
@@ -302,11 +293,6 @@ _(Certificate expiration)_:
_(CA-signed certificate file)_:
: _(Not present)_
<?if (!$isRegistered):?>
&nbsp;
: <i class="fa fa-warning icon warning"></i> <em>_(You must be signed in to Unraid.net in order to generate an Unraid.net SSL certificate)_</em>
<?endif;?>
<?endif;?>
&nbsp;
: <button type="submit" name="changePorts" value="Provision" <?=$disabled_provision?>><?=$provisionlabel?></button><button type="submit" name="changePorts" value="Delete" <?=$disabled_delete?> >_(Delete)_</button><!-- <button type="button" onclick="updateDNS(this)" <?=$disabled_updatedns?>>_(Update DNS)_</button> -->

View File

@@ -41,7 +41,6 @@ extract(parse_ini_file('/var/local/emhttp/network.ini',true));
if (file_exists('/boot/config/plugins/dynamix.my.servers/myservers.cfg')) {
@extract(parse_ini_file('/boot/config/plugins/dynamix.my.servers/myservers.cfg',true));
}
$isRegistered = !empty($remote) && !empty($remote['username']);
$certPresent = file_exists($certPath);
if ($certPresent) {
@@ -59,11 +58,6 @@ if ($certPresent) {
// assume custom cert
response_complete(406, '{"error":"'._('Cannot renew a custom cert at').' '.$certPath.'"}');
}
} else {
// provision new cert
if (!$isRegistered) {
response_complete(406, '{"error":"'._('Must be signed in to Unraid.net to provision cert').'"}');
}
}
$endpoint = ($certPresent && $isLegacyCert) ? "provisioncert" : "provisionwildcard";

View File

@@ -85,7 +85,7 @@ function verbose_output($httpcode, $result) {
global $remoteaccess;
global $icon_warn, $icon_ok;
if (!$cli || !$verbose) return;
if ($anon) echo "(Output is anonymized, use '-vv' to see full details)".PHP_EOL;
echo "Unraid OS {$var['version']}".((strpos($plgversion, "base-") === false) ? " with My Servers plugin version {$plgversion}" : '').PHP_EOL;
echo ($isRegistered) ? "{$icon_ok}Signed in to Unraid.net as {$remote['username']}".PHP_EOL : "{$icon_warn}Not signed in to Unraid.net".PHP_EOL ;