diff --git a/function/scf.php b/function/scf.php index fb98be5..978eaac 100644 --- a/function/scf.php +++ b/function/scf.php @@ -112,7 +112,9 @@ function setConfig($arr, $disktag = '') } // echo '正式设置:'.json_encode($tmp,JSON_PRETTY_PRINT).' //'; - return updateEnvironment($tmp, $_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey')); + $response = updateEnvironment($tmp, $_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey')); + WaitSCFStat(); + return $response; } function WaitSCFStat() @@ -125,9 +127,17 @@ function WaitSCFStat() function install() { global $constStr; + if ($_GET['install2']) { + $tmp['admin'] = $_POST['admin']; + setConfig($tmp); + if (needUpdate()) { + updateProgram($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey); + return message('update to github version, reinstall.', 'Program updating', 201); + } + return output('Jump', 302); + } if ($_GET['install1']) { - if ($_POST['admin']!='') { - $tmp['admin'] = $_POST['admin']; + //if ($_POST['admin']!='') { $tmp['language'] = $_POST['language']; $SecretId = getConfig('SecretId'); if ($SecretId=='') { @@ -145,18 +155,27 @@ function install() $html .= '
'; $title = 'Error'; + return message($html, $title, 201); } else { - $trynum = 0; - while( json_decode(getfunctioninfo($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey),true)['Response']['Status']!='Active' ) echo ' -'.++$trynum; - if (needUpdate()) { - updateProgram($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey); - return message('update to github version, reinstall.', 'Program updating', 201); - } - return output('Jump', 302); + $html .= ' +
+
+ +
+ '; + $title = getconstStr('SetAdminPassword'); + return message($html, $title, 201); + } + //} } if ($_GET['install0']) { $html .= ' @@ -171,8 +190,6 @@ language:
';

'; $html .= ' -
'; - $html .= '