add setup=auth
parent
8c270bb7eb
commit
05531b5fe1
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
// https://cloud.tencent.com/document/product/583/33846
|
||||
// https://cloud.tencent.com/document/product/583/18581
|
||||
// https://cloud.tencent.com/document/product/583/18580
|
||||
|
||||
function printInput($event, $context)
|
||||
{
|
||||
|
@ -178,29 +181,31 @@ function install()
|
|||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie=\'language=; path=/; \'+expires;
|
||||
</script>
|
||||
<meta http-equiv="refresh" content="3;URL=' . $url . '">', 'Program updating', 201);
|
||||
<meta http-equiv="refresh" content="3;URL=' . $url . '">', 'Program updating', 201, 1);
|
||||
}
|
||||
return output('Jump
|
||||
return message(getconstStr('Success') . '
|
||||
<script>
|
||||
var expd = new Date();
|
||||
expd.setTime(expd.getTime()+(2*60*60*1000));
|
||||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie=\'language=; path=/; \'+expires;
|
||||
</script>
|
||||
<meta http-equiv="refresh" content="3;URL=' . path_format($_SERVER['base_path'] . '/') . '">', 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);
|
||||
</script>', 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;
|
||||
}
|
||||
$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') . '<br><a href="' . $_SERVER['base_path'] . '">' . getconstStr('Home') . '</a>';
|
||||
$title = 'Reinstall';
|
||||
return message($html, $title, 201);
|
||||
return message($html, $title, 201, 1);
|
||||
}
|
||||
$html .= '
|
||||
<form action="?install2" method="post" onsubmit="return notnull(this);">
|
||||
|
@ -229,7 +234,7 @@ function install()
|
|||
}
|
||||
</script>';
|
||||
$title = getconstStr('SetAdminPassword');
|
||||
return message($html, $title, 201);
|
||||
return message($html, $title, 201, 1);
|
||||
}
|
||||
}
|
||||
if ($_GET['install0']) {
|
||||
|
@ -240,10 +245,11 @@ language:<br>';
|
|||
$html .= '
|
||||
<label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
|
||||
}
|
||||
if (getConfig('SecretId')==''||getConfig('SecretKey')=='') $html .= '
|
||||
//if (getConfig('SecretId')==''||getConfig('SecretKey')=='')
|
||||
$html .= '
|
||||
<a href="https://console.cloud.tencent.com/cam/capi" target="_blank">'.getconstStr('Create').' SecretId & SecretKey</a><br>
|
||||
<label>SecretId:<input name="SecretId" type="text" placeholder="" size=""></label><br>
|
||||
<label>SecretKey:<input name="SecretKey" type="text" placeholder="" size=""></label><br>';
|
||||
<label>SecretKey:<input name="SecretKey" type="password" placeholder="" size=""></label><br>';
|
||||
$html .= '
|
||||
<label><input type="radio" name="ONEMANAGER_CONFIG_SAVE" value="" ' . ('file'==getenv('ONEMANAGER_CONFIG_SAVE')?'':'checked') . '>' . getconstStr('ONEMANAGER_CONFIG_SAVE_ENV') . '</label><br>
|
||||
<label><input type="radio" name="ONEMANAGER_CONFIG_SAVE" value="file" ' . ('file'==getenv('ONEMANAGER_CONFIG_SAVE')?'checked':'') . '>' . getconstStr('ONEMANAGER_CONFIG_SAVE_FILE') . '</label><br>';
|
||||
|
@ -267,7 +273,8 @@ language:<br>';
|
|||
}
|
||||
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') . '
|
||||
<script>
|
||||
var status = "' . $response['DplStatus'] . '";
|
||||
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);
|
||||
</script>';
|
||||
return message($html, $title, 201, 1);
|
||||
}
|
||||
}
|
||||
$html = '
|
||||
<form action="" method="post" onsubmit="return notnull(this);">
|
||||
<a href="https://console.cloud.tencent.com/cam/capi" target="_blank">' . getconstStr('Create') . ' SecretId & SecretKey</a><br>
|
||||
<label>SecretId:<input name="SecretId" type="text" placeholder="" size=""></label><br>
|
||||
<label>SecretKey:<input name="SecretKey" type="password" placeholder="" size=""></label><br>
|
||||
<input type="submit" value="' . getconstStr('Submit') . '">
|
||||
</form>
|
||||
<script>
|
||||
function notnull(t)
|
||||
{
|
||||
if (t.SecretId.value==\'\') {
|
||||
alert(\'input SecretId\');
|
||||
return false;
|
||||
}
|
||||
if (t.SecretKey.value==\'\') {
|
||||
alert(\'input SecretKey\');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
</script>';
|
||||
return message($html, 'Change platform Auth token or key', 200);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue