pull/216/head
BingoKingo 2020-04-04 09:40:26 +08:00 committed by GitHub
parent 331dfdaaad
commit b9102cee57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -2,6 +2,7 @@
function getpath() function getpath()
{ {
$_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($_SERVER['HTTP_ACCEPT_LANGUAGE'],';')[0],',')[0]);
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR']; $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
$_SERVER['base_path'] = path_format(substr($_SERVER['SCRIPT_NAME'], 0, -10) . '/'); $_SERVER['base_path'] = path_format(substr($_SERVER['SCRIPT_NAME'], 0, -10) . '/');
$p = strpos($_SERVER['REQUEST_URI'],'?'); $p = strpos($_SERVER['REQUEST_URI'],'?');
@ -219,9 +220,9 @@ function setHerokuConfig($env, $function_name, $apikey)
return HerokuAPI('PATCH', 'https://api.heroku.com/apps/' . $function_name . '/config-vars', $data, $apikey); return HerokuAPI('PATCH', 'https://api.heroku.com/apps/' . $function_name . '/config-vars', $data, $apikey);
} }
function updateHerokuapp($function_name, $apikey) function updateHerokuapp($function_name, $apikey, $source)
{ {
$tmp['source_blob']['url'] = 'https://github.com/BingoKingo/Tfo/tarball/master/'; $tmp['source_blob']['url'] = $source;
$data = json_encode($tmp); $data = json_encode($tmp);
return HerokuAPI('POST', 'https://api.heroku.com/apps/' . $function_name . '/builds', $data, $apikey); return HerokuAPI('POST', 'https://api.heroku.com/apps/' . $function_name . '/builds', $data, $apikey);
} }
@ -239,9 +240,11 @@ function_name:' . $_SERVER['function_name'] . '<br>
<button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>'; <button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>';
} }
function OnekeyUpate() function OnekeyUpate($auth = 'BingoKingo', $project = 'Tfo', $branch = 'master')
{ {
return json_decode(updateHerokuapp(getConfig('function_name'), getConfig('APIKey'))['body'], true); //'https://github.com/qkqpttgf/OneManager-php/tarball/master/';
$source = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . $branch . '/';
return json_decode(updateHerokuapp(getConfig('function_name'), getConfig('APIKey'), $source)['body'], true);
} }
function setConfigResponse($response) function setConfigResponse($response)