if (file_exists('/boot/config/plugins/dynamix.my.servers/myservers.cfg')) { // context needed for the UPC ENV local check for signed out users @extract(parse_ini_file('/boot/config/plugins/dynamix.my.servers/myservers.cfg',true)); } $ALLOWED_UPC_ENV_VALS = [ 'production', 'staging', 'development', 'local', ]; $UPC_ENV_CK = in_array($_COOKIE['UPC_ENV'], $ALLOWED_UPC_ENV_VALS) ? $_COOKIE['UPC_ENV'] : null; // Determine what source we should use for web components if (!file_exists('/usr/local/sbin/unraid-api')) { // When NOT using the plugin we should load the UPC from the file system unless $UPC_ENV_CK exists. $UPC_ENV = $UPC_ENV_CK ?? 'local'; } else { // When PLG exists load from local when not signed in but when signed in load UPC from production. $UPC_ENV = $UPC_ENV_CK ?? ((empty($remote['username']) || empty($var['regFILE'])) ? 'local' : 'production'); } $upcLocalSrc = '/plugins/dynamix.my.servers/webComps/unraid.min.js'; // @NOTE - that using autov(); would render the file name below the body tag. So dont use it :( switch ($UPC_ENV) { case 'production': $upcSrc = 'https://registration.unraid.net/webComps/unraid.min.js'; break; case 'staging': $upcSrc = 'https://registration-dev.unraid.net/webComps/unraid.min.js'; break; case 'development': $upcSrc = 'https://launchpad.unraid.test:6969/webComps/unraid.js'; break; default: // load from webGUI filesystem. $upcSrc = $upcLocalSrc; break; } // add the intended web component source to the DOM echo ''; ?>