From 0a5f561b28866a22dc5878e733ad044a09178f8e Mon Sep 17 00:00:00 2001 From: Zack Spear Date: Tue, 19 Jan 2021 16:48:22 -0800 Subject: [PATCH] refactor: start of dynamix.cfg to myservers.cfg --- dynamix.unraid.net.plg | 43 ++++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/dynamix.unraid.net.plg b/dynamix.unraid.net.plg index 9f7654728..40816e0cb 100644 --- a/dynamix.unraid.net.plg +++ b/dynamix.unraid.net.plg @@ -36,6 +36,7 @@ if [ -e /etc/rc.d/rc.unraid-api ]; then rm -rf /boot/config/plugins/Unraid.net/wc rm -f /boot/config/plugins/Unraid.net/unraid-api.tgz rm -f /boot/config/plugins/Unraid.net/.gitignore + rm -f /boot/config/plugins/Unraid.net/myservers.cfg rm -rf /usr/local/emhttp/plugins/dynamix.unraid.net rm -f /usr/local/emhttp/webGui/javascript/vue.js rm -f /usr/local/emhttp/webGui/javascript/vue.min.js @@ -46,6 +47,23 @@ fi ]]> + + + + + + @@ -73,9 +91,8 @@ 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/dynamix/dynamix.cfg')) { - extract(parse_ini_file('/boot/config/plugins/dynamix/dynamix.cfg',true)); +if (file_exists('/boot/config/plugins/Unraid.net/myservers.cfg')) { + extract(parse_ini_file('/boot/config/plugins/Unraid.net/myservers.cfg',true)); } $arr = []; @@ -622,7 +639,7 @@ Tag="globe" ?> "", @@ -1153,8 +1170,8 @@ $cli = php_sapi_name()=='cli'; $docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp'; -if (file_exists('/boot/config/plugins/dynamix/dynamix.cfg')) { - extract(parse_ini_file('/boot/config/plugins/dynamix/dynamix.cfg',true)); +if (file_exists('/boot/config/plugins/Unraid.net/myservers.cfg')) { + extract(parse_ini_file('/boot/config/plugins/Unraid.net/myservers.cfg',true)); } if (empty($remote)) { $remote = [ @@ -1592,7 +1609,7 @@ function handleMessage(e) { case "REG_WIZARD": if (data.apikey) { var postargs = { - '#file': 'dynamix/dynamix.cfg', + '#file': 'Unraid.net/myservers.cfg', '#section': 'remote', apikey: data.apikey, regWizTime: `${Date.now()}_${data.guid}`, // set when signing in the first time and never unset for the sake of displaying Sign In/Up in the UPC without needing to validate guid every time @@ -1607,7 +1624,7 @@ function handleMessage(e) { postargs['avatar'] = data.avatar; } $.post('/update.php', postargs, function() { - console.log('dynamix/dynamix.cfg: Updated apikey under [remote] section'); + console.log('Unraid.net/myservers.cfg: Updated apikey under [remote] section'); // send a ping back to the regwiz const payload = { event: 'ACCOUNT_PINGBACK', success: true, type: 'signIn', webGuiPathname: window.location.pathname }; e.source.postMessage(JSON.stringify(payload), e.origin); @@ -1642,15 +1659,17 @@ function handleMessage(e) { }); break; case "MYSERVERS_UNREGISTER": + $.post('/update.php', { - '#file': 'dynamix/dynamix.cfg', + '#file': 'Unraid.net/myservers.cfg', '#section': 'remote', apikey: '', avatar: '', email: '', username: '', }, function() { - console.log('dynamix/dynamix.cfg: Unregistered myservers, cleared apikey under [remote] section'); + + console.log('Unraid.net/myservers.cfg: Unregistered myservers, cleared apikey under [remote] section'); // send a ping back to the regwiz const payload = { event: 'ACCOUNT_PINGBACK', success: true, type: 'signOut', webGuiPathname: window.location.pathname }; e.source.postMessage(JSON.stringify(payload), e.origin);