diff --git a/platform/TencentSCF.php b/platform/TencentSCF.php index 14b592b..8336994 100644 --- a/platform/TencentSCF.php +++ b/platform/TencentSCF.php @@ -33,20 +33,15 @@ function GetPathSetting($event, $context) $_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($event['headers']['accept-language'],';')[0],',')[0]); $_SERVER['function_name'] = $context['function_name']; $_SERVER['namespace'] = $context['namespace']; + $_SERVER['Region'] = getenv('TENCENTCLOUD_REGION'); $host_name = $event['headers']['host']; $_SERVER['HTTP_HOST'] = $host_name; $serviceId = $event['requestContext']['serviceId']; if ( $serviceId === substr($host_name,0,strlen($serviceId)) ) { $_SERVER['base_path'] = '/'.$event['requestContext']['stage'].'/'.$_SERVER['function_name'].'/'; - $_SERVER['Region'] = getenv('Region'); - if ($_SERVER['Region'] == '') { - $_SERVER['Region'] = substr($host_name, strpos($host_name, '.')+1); - $_SERVER['Region'] = substr($_SERVER['Region'], 0, strpos($_SERVER['Region'], '.')); - } $path = substr($event['path'], strlen('/'.$_SERVER['function_name'].'/')); } else { $_SERVER['base_path'] = $event['requestContext']['path']; - $_SERVER['Region'] = getenv('Region'); $path = substr($event['path'], strlen($event['requestContext']['path'])); } if (substr($path,-1)=='/') $path=substr($path,0,-1); @@ -154,27 +149,24 @@ function install() ', 302); } if ($_GET['install1']) { - //if ($_POST['admin']!='') { - //$tmp['language'] = $_POST['language']; - $tmp['Region'] = $_POST['Region']; - $tmp['timezone'] = $_COOKIE['timezone']; - $SecretId = getConfig('SecretId'); - if ($SecretId=='') { - $SecretId = $_POST['SecretId']; - $tmp['SecretId'] = $SecretId; - } - $SecretKey = getConfig('SecretKey'); - if ($SecretKey=='') { - $SecretKey = $_POST['SecretKey']; - $tmp['SecretKey'] = $SecretKey; - } - $response = json_decode(SetbaseConfig($tmp, $_SERVER['function_name'], $_POST['Region'], $_SERVER['namespace'], $SecretId, $SecretKey), true)['Response']; - if (api_error($response)) { - $html = api_error_msg($response); - $title = 'Error'; - return message($html, $title, 201); - } else { - $html .= ' + $tmp['timezone'] = $_COOKIE['timezone']; + $SecretId = getConfig('SecretId'); + if ($SecretId=='') { + $SecretId = $_POST['SecretId']; + $tmp['SecretId'] = $SecretId; + } + $SecretKey = getConfig('SecretKey'); + if ($SecretKey=='') { + $SecretKey = $_POST['SecretKey']; + $tmp['SecretKey'] = $SecretKey; + } + $response = json_decode(SetbaseConfig($tmp, $_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey), true)['Response']; + if (api_error($response)) { + $html = api_error_msg($response); + $title = 'Error'; + return message($html, $title, 201); + } else { + $html .= '