diff --git a/function/scf.php b/function/scf.php index 9c4c996..f344ed8 100644 --- a/function/scf.php +++ b/function/scf.php @@ -54,16 +54,20 @@ function GetPathSetting($event, $context) function getConfig($str, $disktag = '') { global $InnerEnv; + global $Base64Env; if ($disktag=='') $disktag = $_SERVER['disktag']; if (in_array($str, $InnerEnv)) { - return json_decode(getenv($disktag), true)[$str]; + if (in_array($str, $Base64Env)) return base64_decode(equal_replace(json_decode(getenv($disktag), true)[$str],1)); + else return json_decode(getenv($disktag), true)[$str]; } - return getenv($str); + if (in_array($str, $Base64Env)) return base64_decode(equal_replace(getenv($str),1)); + else return getenv($str); } function setConfig($arr, $disktag = '') { global $InnerEnv; + global $Base64Env; if ($disktag=='') $disktag = $_SERVER['disktag']; $disktags = explode("|",getConfig('disktag')); $diskconfig = json_decode(getenv($disktag), true); @@ -72,7 +76,8 @@ function setConfig($arr, $disktag = '') $oparetdisk = 0; foreach ($arr as $k => $v) { if (in_array($k, $InnerEnv)) { - $diskconfig[$k] = $v; + if (in_array($k, $Base64Env)) $diskconfig[$k] = equal_replace(base64_encode($v)); + else $diskconfig[$k] = $v; $indisk = 1; } elseif ($k=='disktag_add') { array_push($disktags, $v); @@ -82,7 +87,8 @@ function setConfig($arr, $disktag = '') $tmp[$v] = ''; $oparetdisk = 1; } else { - $tmp[$k] = $v; + if (in_array($k, $Base64Env)) $tmp[$k] = equal_replace(base64_encode($v)); + else $tmp[$k] = $v; } } if ($indisk) { @@ -180,8 +186,7 @@ function get_refresh_token() $tmp['Onedrive_ver'] = $_POST['Onedrive_ver']; if ($_POST['Onedrive_ver']=='MSC') { $tmp['client_id'] = $_POST['client_id']; - $tmp['client_secret'] = equal_replace(base64_encode($_POST['client_secret'])); - //$_POST['client_secret']; + $tmp['client_secret'] = $_POST['client_secret']; } $response = json_decode( setConfig($tmp, $_COOKIE['disktag']), true )['Response']; $title = getconstStr('MayinEnv'); @@ -276,7 +281,6 @@ namespace:' . $_SERVER['namespace'] . '
$trynum = 0; while( json_decode(getfunctioninfo($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey),true)['Response']['Status']!='Active' ) echo ' '.++$trynum; - //$response = json_decode( updateEnvironment($tmp, $_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey), true)['Response']; if (needUpdate()) { updateProgram($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey); return message('update to github version, reinstall.', 'Program updating', 201);