From 05531b5fe1a9e37d9a72d8aca1a2f885e0cbea8e Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Wed, 1 Dec 2021 14:51:43 +0800 Subject: [PATCH] add setup=auth --- platform/TencentSCF_file.php | 95 ++++++++++++++++++++++++++++-------- 1 file changed, 76 insertions(+), 19 deletions(-) diff --git a/platform/TencentSCF_file.php b/platform/TencentSCF_file.php index 78e8600..9f53d92 100644 --- a/platform/TencentSCF_file.php +++ b/platform/TencentSCF_file.php @@ -1,4 +1,7 @@ - ', 'Program updating', 201); + ', 'Program updating', 201, 1); } - return output('Jump + return message(getconstStr('Success') . ' - ', 302); + var i = 0; + var uploadList = setInterval(function(){ + if (document.getElementById("dis").style.display=="none") { + console.log(i++); + } else { + clearInterval(uploadList); + location.href = "' . path_format($_SERVER['base_path'] . '/') . '"; + } + }, 1000); + ', 201, 1); } if ($_GET['install1']) { $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; - } + $SecretId = $_POST['SecretId']; + $tmp['SecretId'] = $SecretId; + $SecretKey = $_POST['SecretKey']; + $tmp['SecretKey'] = $SecretKey; $tmp['ONEMANAGER_CONFIG_SAVE'] = $_POST['ONEMANAGER_CONFIG_SAVE']; $response = json_decode(SetbaseConfig($tmp, $_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey), true)['Response']; if (api_error($response)) { @@ -211,7 +216,7 @@ function install() if ($tmp['ONEMANAGER_CONFIG_SAVE'] != 'file') { $html = getconstStr('ONEMANAGER_CONFIG_SAVE_ENV') . '
' . getconstStr('Home') . ''; $title = 'Reinstall'; - return message($html, $title, 201); + return message($html, $title, 201, 1); } $html .= '
@@ -229,7 +234,7 @@ function install() } '; $title = getconstStr('SetAdminPassword'); - return message($html, $title, 201); + return message($html, $title, 201, 1); } } if ($_GET['install0']) { @@ -240,10 +245,11 @@ language:
'; $html .= '
'; } - if (getConfig('SecretId')==''||getConfig('SecretKey')=='') $html .= ' + //if (getConfig('SecretId')==''||getConfig('SecretKey')=='') + $html .= ' '.getconstStr('Create').' SecretId & SecretKey

-
'; +
'; $html .= '

'; @@ -267,7 +273,8 @@ language:
'; } function notnull(t) {'; - if (getConfig('SecretId')==''||getConfig('SecretKey')=='') $html .= ' + //if (getConfig('SecretId')==''||getConfig('SecretKey')=='') + $html .= ' if (t.SecretId.value==\'\') { alert(\'input SecretId\'); return false; @@ -649,3 +656,53 @@ function WaitFunction() { if ( json_decode(getfunctioninfo($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey')),true)['Response']['Status']=='Active' ) return true; else return false; } + +function changeAuthKey() { + if ($_POST['SecretId']!=''&&$_POST['SecretId']!='') { + $tmp['SecretId'] = $_POST['SecretId']; + $tmp['SecretKey'] = $_POST['SecretKey']; + $response = setConfigResponse( SetbaseConfig($tmp, $_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $tmp['SecretId'], $tmp['SecretKey']) ); + if (api_error($response)) { + $html = api_error_msg($response); + $title = 'Error'; + return message($html, $title, 400); + } else { + $html = getconstStr('Success') . ' + '; + return message($html, $title, 201, 1); + } + } + $html = ' + + ' . getconstStr('Create') . ' SecretId & SecretKey
+
+
+ +
+ '; + return message($html, 'Change platform Auth token or key', 200); +}