diff --git a/.htaccess b/.htaccess index f75587a..3cb9db5 100644 --- a/.htaccess +++ b/.htaccess @@ -6,7 +6,7 @@ RewriteRule ^(.*) index.php?/$1 [L] #----------------------------------- # nginx -# rewrite ^(.*) index.php?/$1 last; +# rewrite ^(.*) /index.php?/$1 last; # # caddy (not sure) # rewrite { diff --git a/conststr.php b/conststr.php index 65a3dea..8d1b596 100644 --- a/conststr.php +++ b/conststr.php @@ -688,7 +688,18 @@ $constStr = [ 'ko-kr' => '다시 쓰기 (의사 정적) 기능이 활성화되어 있는지 확인하십시오.', 'fa' => 'لطفاً مطمئن شوید که RewriteEngine روشن است.', ], - + 'CopyUrl' => [ + 'en-us' => 'Copy URL', + 'zh-cn' => '复制链接', + ], + 'Success' => [ + 'en-us' => 'Success', + 'zh-cn' => '成功', + ], + 'SetAdminPassword' => [ + 'en-us' => 'Set Admin Password', + 'zh-cn' => '设置管理密码', + ], 'Refresh' => [ 'en-us' => 'Refresh', 'zh-cn' => '刷新', diff --git a/function/common.php b/function/common.php index 837fbcb..badfb6f 100644 --- a/function/common.php +++ b/function/common.php @@ -608,7 +608,12 @@ function main($path) $data = '{"name":"' . $_GET['filemd5'] . $ext . '"}'; //echo $oldname .'
'. $data; $tmp = MSAPI('PATCH',$oldname,$data,$_SERVER['access_token']); - if ($tmp['stat']==409) MSAPI('DELETE',$oldname,'',$_SERVER['access_token'])['body']; + if ($tmp['stat']==409) { + MSAPI('DELETE',$oldname,'',$_SERVER['access_token']); + $tmpbody = json_decode($tmp['body'], true); + $tmpbody['name'] = $_GET['filemd5'] . $ext; + $tmp['body'] = json_encode($tmpbody); + } $path1 = path_format($_SERVER['list_path'] . path_format($path)); savecache('path_' . $path1, json_decode('{}',true), 1); return output($tmp['body'],$tmp['stat']); diff --git a/function/heroku.php b/function/heroku.php index 24619cf..eda00e3 100644 --- a/function/heroku.php +++ b/function/heroku.php @@ -93,6 +93,7 @@ function setConfig($arr, $disktag = '') if ($disktag_s!='') $tmp['disktag'] = substr($disktag_s, 0, -1); else $tmp['disktag'] = ''; } + foreach ($tmp as $key => $val) if ($val=='') $tmp[$key]=null; // echo '正式设置:'.json_encode($tmp,JSON_PRETTY_PRINT).' //'; return setHerokuConfig($tmp, getConfig('function_name'), getConfig('APIKey')); diff --git a/function/scf.php b/function/scf.php index 85e4695..e8b6a5e 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 .= '