Merge pull request #951 from zackspear/master

feat(upc): error for too many disks for key
This commit is contained in:
tom mortensen
2021-09-16 07:56:01 -07:00
committed by GitHub
5 changed files with 36 additions and 13 deletions

View File

@@ -287,10 +287,6 @@
'iAgree' => _('I agree to the'),
'text' => _('Terms of Use'),
],
'anonMode' => [
'name' => _('Anonymous Mode'),
'label' => _('Keep server details anonymous'),
],
],
'routes' => [
'extendTrial' => [
@@ -445,9 +441,14 @@
],
],
];
$configErrorEnum = [ // used to map $var['configValid'] value to mimic unraid-api's `configError` ENUM
"error" => 'UNKNOWN_ERROR',
"invalid" => 'INVALID',
"nokeyserver" => 'NO_KEY_SERVER',
"withdrawn" => 'WITHDRAWN',
];
// feeds server vars to Vuex store in a slightly different array than state.php
$serverstate = [
"anonMode" => $remote['anonMode'] === 'true',
"avatar" => $remote['avatar'],
"deviceCount" => $var['deviceCount'],
"email" => ($remote['email']) ? $remote['email'] : '',
@@ -467,6 +468,10 @@
"state" => strtoupper(empty($var['regCheck']) ? $var['regTy'] : $var['regCheck']),
"ts" => time(),
"username" => $remote['username'],
'configValid' => $var['configValid'] === 'yes',
'configError' => $var['configValid'] !== 'yes'
? (array_key_exists($var['configValid'], $configErrorEnum) ? $configErrorEnum[$var['configValid']] : 'UNKNOWN_ERROR')
: null,
];
?>
<unraid-user-profile

View File

@@ -24,6 +24,12 @@ $key_contents = str_replace(['+','/','='], ['-','_',''], trim(base64_encode(@fil
if (file_exists('/boot/config/plugins/dynamix.my.servers/myservers.cfg')) {
@extract(parse_ini_file('/boot/config/plugins/dynamix.my.servers/myservers.cfg',true));
}
$configErrorEnum = [ // used to map $var['configValid'] value to mimic unraid-api's `configError` ENUM
"error" => 'UNKNOWN_ERROR',
"invalid" => 'INVALID',
"nokeyserver" => 'NO_KEY_SERVER',
"withdrawn" => 'WITHDRAWN',
];
$arr = [];
if (empty($remote['username'])) {
@@ -48,6 +54,7 @@ $arr['reggen'] = $var['regGen'];
$arr['flashproduct'] = $var['flashProduct'];
$arr['flashvendor'] = $var['flashVendor'];
$arr['servername'] = $var['NAME'];
$arr['serverdesc'] = $var['COMMENT'];
$arr['internalip'] = $_SERVER['SERVER_ADDR'];
$arr['internalport'] = $_SERVER['SERVER_PORT'];
$arr['plgVersion'] = 'base-'.$var['version'];
@@ -55,8 +62,10 @@ $arr['protocol'] = $_SERVER['REQUEST_SCHEME'];
$arr['locale'] = $_SESSION['locale'] ? $_SESSION['locale'] : 'en_US';
$arr['expiretime']=1000*($var['regTy']=='Trial'||strstr($var['regTy'],'expired')?$var['regTm2']:0);
$arr['uptime']=1000*(time() - round(strtok(exec("cat /proc/uptime"),' ')));
$arr['serverdesc'] = $_SERVER['COMMENT'];
$arr['anonMode'] = $remote['anonMode'] === 'true';
$arr['configValid'] = $var['configValid'] === 'yes';
$arr['configError'] = !$arr['configValid']
? (array_key_exists($var['configValid'], $configErrorEnum) ? $configErrorEnum[$var['configValid']] : 'UNKNOWN_ERROR')
: null;
echo json_encode($arr);
?>

File diff suppressed because one or more lines are too long

View File

@@ -18,8 +18,13 @@ Tag="download"
function installPlugin(name) {
var file = name.trim();
var plugin = file.replace(/^.*(\\|\/|\:)/,'').replace('.plg','')+':install';
if (file) openBox("/plugins/dynamix.plugin.manager/scripts/plugin&arg1=install&arg2="+file,"_(Install Plugin)_",600,900,true,'loadlist',plugin);
var func = plugin.includes('dynamix.unraid.net') ? 'reloadToList' : 'loadlist'; // conditionally reload on closure of shadboxbox for My Servers plugin
if (file) openBox("/plugins/dynamix.plugin.manager/scripts/plugin&arg1=install&arg2="+file,"_(Install Plugin)_",600,900,true,func,plugin);
}
function reloadToList() {
$.removeCookie('tab',{path:'/'});
window.location.href = '/Plugins';
};
</script>
**_(Enter URL of remote plugin file or local plugin file)_**

View File

@@ -42,9 +42,10 @@ $isRegistered = !empty($remote) && !empty($remote['username']);
$certpath = '/boot/config/ssl/certs/certificate_bundle.pem';
$certhostname = file_exists($certpath) ? trim(exec("/usr/bin/openssl x509 -subject -noout -in $certpath | awk -F' = ' '{print $2}'")) : '';
$isCertUnraidNet = preg_match('/.*\.unraid\.net$/', $certhostname);
// only proceed when a hash.unraid.net SSL certificate is active or when signed in
if (!$isRegistered && !preg_match('/.*\.unraid\.net$/', $certhostname)) {
if (!$isRegistered && !$isCertUnraidNet) {
response_complete(406, '{"error":"'._('Nothing to do').'"}');
}
@@ -66,10 +67,11 @@ $post = [
'plgversion' => 'base-'.$var['version'],
'keyfile' => $keyfile
];
if (preg_match('/.*\.unraid\.net$/', $certhostname)) {
if ($isCertUnraidNet) {
$post['internalip'] = is_array($internalip) ? $internalip[0] : $internalip;
}
if ($isRegistered) {
$post['servername'] = $var['NAME'];
$post['servercomment'] = $var['COMMENT'];
}