Skip to content
This repository has been archived by the owner on Jan 12, 2025. It is now read-only.

Commit

Permalink
refresh and update
Browse files Browse the repository at this point in the history
  • Loading branch information
Anonymous committed Jan 13, 2024
1 parent 400d531 commit 15286a4
Show file tree
Hide file tree
Showing 40 changed files with 23,609 additions and 375 deletions.
14 changes: 7 additions & 7 deletions app.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "OneManager",
"description": "Deploy OneManager to heroku",
"website": "https://github.com/qkqpttgf/OneManager-php",
"repository": "https://github.com/qkqpttgf/OneManager-php",
"success_url": "/"
}
{
"name": "Tfo",
"description": "Deploy Tfo to heroku",
"website": "https://github.com/BingoKingo/Tfo",
"repository": "https://github.com/BingoKingo/Tfo",
"success_url": "/"
}
60 changes: 44 additions & 16 deletions common.php
Original file line number Diff line number Diff line change
Expand Up @@ -1366,7 +1366,8 @@ function EnvOpt($needUpdate = 0) {
//foreach ($EnvConfigs as $env => $v) if (isCommonEnv($env)) $envs .= '\'' . $env . '\', ';
$envs = substr(json_encode(array_keys($EnvConfigs)), 1, -1);

$html = '<title>OneManager ' . getconstStr('Setup') . '</title>';
// Tfo
$html = '<title>Tfo ' . getconstStr('Setup') . '</title>';
if (isset($_POST['updateProgram']) && $_POST['updateProgram'] == getconstStr('updateProgram')) if (compareadminmd5('admin', getConfig('admin'), $_COOKIE['admin'], $_POST['_admin'])) {
$response = setConfigResponse(OnekeyUpate($_POST['GitSource'], $_POST['auth'], $_POST['project'], $_POST['branch']));
if (api_error($response)) {
Expand Down Expand Up @@ -1866,24 +1867,19 @@ function changedrivetype(d) {
$canOneKeyUpate = 1;
}
}
// Tfo
$frame .= '
<a href="https://github.com/qkqpttgf/OneManager-php" target="_blank">Github</a>
<a href="https://git.hit.edu.cn/ysun/OneManager-php" target="_blank">HIT Gitlab</a><br><br>
';
<a href="https://github.com/BingoKingo/Tfo" target="_blank">Github</a>
';
if (!$canOneKeyUpate) {
$frame .= '
' . getconstStr('CannotOneKeyUpate') . '<br>';
} else {
$frame .= '
<form name="updateform" action="" method="post">
<input name="_admin" type="hidden" value="">
Update from
<select name="GitSource" onchange="changeGitSource(this)">
<option value="Github" selected>Github</option>
<option value="HITGitlab">HIT Gitlab</option>
</select>
<input type="text" name="auth" size="6" placeholder="auth" value="qkqpttgf">
<input type="text" name="project" size="12" placeholder="project" value="OneManager-php">
<input type="text" name="auth" size="6" placeholder="auth" value="BingoKingo">
<input type="text" name="project" size="12" placeholder="project" value="Tfo">
<button name="QueryBranchs" onclick="querybranchs(this);return false;">' . getconstStr('QueryBranchs') . '</button>
<select name="branch">
<option value="master">master</option>
Expand Down Expand Up @@ -2227,11 +2223,12 @@ function render_list($path = '', $files = []) {
//$pretitle = str_replace('%23','#',$pretitle);
$statusCode = 200;
date_default_timezone_set(get_timezone($_SERVER['timezone']));

// Tfo
$authinfo = '
<!--
OneManager: An index & manager of Onedrive auth by ysun.
HIT Gitlab: https://git.hit.edu.cn/ysun/OneManager-php
Github: https://github.com/qkqpttgf/OneManager-php
Tfo: A website for two-point filestorage online (tfo).
Github: https://github.com/BingoKingo/Tfo
-->';
//$authinfo = $path . '<br><pre>' . json_encode($files, JSON_PRETTY_PRINT) . '</pre>';

Expand Down Expand Up @@ -2976,6 +2973,36 @@ function render_list($path = '', $files = []) {
//if (strlen($diskname)>15) $diskname = substr($diskname, 0, 12).'...';
while (strpos($html, '<!--DiskNameNow-->')) $html = str_replace('<!--DiskNameNow-->', $diskname, $html);

// Tfo
$html = str_replace('<!--Sitename-->', $_SERVER['sitename'], $html);

$tmp = splitfirst($html, '<!--MultiDiskArea2Start-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--MultiDiskArea2End-->');
$disktags = explode("|",getConfig('disktag'));
if (count($disktags)>1) {
$tmp1 = $tmp[1];
$tmp = splitfirst($tmp[0], '<!--MultiDisks2Start-->');
$MultiDiskArea2 = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--MultiDisks2End-->');
$MultiDisks = $tmp[0];
foreach ($disktags as $disk) if ($_SERVER['admin']||getConfig('diskDisplay', $disk)=='') {
$diskname = getConfig('diskname', $disk);
if ($diskname=='') $diskname = $disk;
$MultiDisksStr = str_replace('<!--MultiDisks2Url-->', path_format($_SERVER['base_path'].'/'.$disk.'/'), $MultiDisks);
$MultiDisksStr = str_replace('<!--MultiDisks2Now-->', ($_SERVER['disktag']==$disk?' now':''), $MultiDisksStr);
$MultiDisksStr = str_replace('<!--MultiDisks2Name-->', $diskname, $MultiDisksStr);
$MultiDiskArea2 .= $MultiDisksStr;
}
$MultiDiskArea2 .= $tmp[1];
$tmp[1] = $tmp1;
}
$html .= $MultiDiskArea2 . $tmp[1];
$diskname = getConfig('diskname', $_SERVER['disktag']);
if ($diskname=='') $diskname = $_SERVER['disktag'];
//if (strlen($diskname)>15) $diskname = substr($diskname, 0, 12).'...';
while (strpos($html, '<!--DiskNameNow-->')) $html = str_replace('<!--DiskNameNow-->', $diskname, $html);

$tmp = splitfirst($html, '<!--HeadomfStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--HeadomfEnd-->');
Expand Down Expand Up @@ -3180,11 +3207,12 @@ function render_list($path = '', $files = []) {
$html = str_replace('<!--FootStr-->', date("Y-m-d H:i:s") . " " . getconstStr('Week')[date("w")] . " " . $_SERVER['REMOTE_ADDR'] . $city . ' Runningtime:' . $exetime . 's Mem:' . size_format(memory_get_usage()), $html);
}

// Tfo
/*if ($_SERVER['admin']||!getConfig('disableChangeTheme')) {
$theme_arr = scandir(__DIR__ . $slash . 'theme');
$selecttheme = '
<div style="position: fixed;right: 10px;bottom: 10px;">
<select name="theme" onchange="changetheme(this.options[this.options.selectedIndex].value)">
<div style="position: fixed;right: 8px;bottom: 8px;">
<select name="theme" style="width: 20px;" onchange="changetheme(this.options[this.options.selectedIndex].value)">
<option value="">'.getconstStr('Theme').'</option>';
foreach ($theme_arr as $v1) {
if ($v1!='.' && $v1!='..') $selecttheme .= '
Expand Down
19 changes: 12 additions & 7 deletions conststr.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
$exts['music'] = ['mp3', 'wma', 'flac', 'ape', 'wav', 'ogg', 'm4a'];
$exts['office'] = ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'];
$exts['txt'] = ['txt', 'log', 'bat', 'sh', 'php', 'asp', 'js', 'css', 'json', 'html', 'c', 'cpp', 'md', 'py', 'omf'];
$exts['video'] = ['mp4', 'webm', 'mkv', 'mov', 'flv', 'blv', 'avi', 'wmv', 'm3u8', 'rm', '3gp', 'rmvb'];
// Tfo
$exts['video'] = ['mp4', 'webm', 'mkv', 'mov', 'flv', 'blv', 'avi', 'wmv', 'm3u8', 'm3u', 'rm', '3gp', 'rmvb'];
$exts['zip'] = ['zip', 'rar', '7z', 'gz', 'tar'];
$exts['apple'] = ['ipa', 'dmg', 'app', 'pkg'];
// Tfo
$exts['odo'] = ['wps', 'key', 'numbers', 'key', 'pdf', 'csv', 'dif', 'docm', 'dotx', 'odt', 'one', 'onepkg', 'onetoc2', 'pot', 'potm', 'potx', 'pps', 'ppsm', 'ppsx', 'pptm', 'prn', 'rtf', 'slk', 'thmx', 'xlam', 'xlsb', 'xlsm', 'xlt', 'xltx', 'xltm', 'one']; //Tfo

$constStr = [
'languages' => [
Expand Down Expand Up @@ -473,13 +477,14 @@
'fa' => 'فهرست',
'ar-sa' => 'الليست',
],
// Tfo
'NeedUpdate' => [
'en-us' => 'Program can update<br>Click setup in Operate at top.',
'zh-cn' => '可以升级程序<br>在上方管理菜单中<br>进入设置页面升级',
'zh-tw' => '可以升級程式<br>在上方管理選單中<br>進入設定頁面升級',
'ja' => 'プログラムをアップグレードできます<br>上記の管理メニューで<br>アップグレードする設定ページに入ります',
'ko-kr' => '프로그램을 업그레이드 할 수 있습니다. <br> 위의 관리 메뉴에서 <br> 업그레이드 할 설정 페이지를 입력하십시오.',
'fa' => 'برنامه می تواند آپدیت شود<br>روی گزینه نصب در بالای صفحه کلیک کنید.',
'en-us' => 'Program can update Click setup in Operate at top.',
'zh-cn' => '可以升级程序 在上方管理菜单中 进入设置页面升级',
'zh-tw' => '可以升級程式 在上方管理選單中 進入設定頁面升級',
'ja' => 'プログラムをアップグレードできます 上記の管理メニューで アップグレードする設定ページに入ります',
'ko-kr' => '프로그램을 업그레이드 할 수 있습니다. 위의 관리 메뉴에서 업그레이드 할 설정 페이지를 입력하십시오.',
'fa' => 'برنامه می تواند آپدیت شود روی گزینه نصب در بالای صفحه کلیک کنید.',
'ar-sa' => 'يمكن ترقية البرنامج في القائمة أعلاه إدارة',
],
'Operate' => [
Expand Down
19 changes: 8 additions & 11 deletions platform/AliyunFC.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ function printInput($event, $context)
{
if (strlen(json_encode($event['body']))>500) $event['body']=substr($event['body'],0,strpos($event['body'],'base64')+30) . '...Too Long!...' . substr($event['body'],-50);
echo urldecode(json_encode($event, JSON_PRETTY_PRINT)) . '
' . urldecode(json_encode($context, JSON_PRETTY_PRINT)) . '
';
}

Expand Down Expand Up @@ -229,7 +229,7 @@ function notnull(t)
$html .= '
<label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
}
//if (getConfig('AccessKeyID')==''||getConfig('AccessKeySecret')=='')
//if (getConfig('AccessKeyID')==''||getConfig('AccessKeySecret')=='')
$html .= '
<a href="https://usercenter.console.aliyun.com/?#/manage/ak" target="_blank">' . getconstStr('Create') . ' AccessKeyID & AccessKeySecret</a><br>
<label>AccessKeyID:<input name="AccessKeyID" type="text" placeholder="" size=""></label><br>
Expand All @@ -254,7 +254,7 @@ function changelanguage(str)
}
function notnull(t)
{';
//if (getConfig('AccessKeyID')==''||getConfig('AccessKeySecret')=='')
//if (getConfig('AccessKeyID')==''||getConfig('AccessKeySecret')=='')
$html .= '
if (t.AccessKeyID.value==\'\') {
alert(\'input AccessKeyID\');
Expand Down Expand Up @@ -421,17 +421,14 @@ function setConfigResponse($response)
return json_decode($response, true);
}

function OnekeyUpate($GitSource = 'Github', $auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
// Tfo
function OnekeyUpate($auth = 'BingoKingo', $project = 'Tfo', $branch = 'master')
{
$source = '/tmp/code.zip';
$outPath = '/tmp/';

if ($GitSource=='Github') {
// 从github下载对应tar.gz,并解压
$url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
} elseif ($GitSource=='HITGitlab') {
$url = 'https://git.hit.edu.cn/' . $auth . '/' . $project . '/-/archive/' . urlencode($branch) . '/' . $project . '-' . urlencode($branch) . '.tar.gz';
} else return json_encode(['ErrorMessage'=>'Git Source input Error!']);
// 从github下载对应tar.gz,并解压
$url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
$tarfile = '/tmp/github.tar.gz';
file_put_contents($tarfile, file_get_contents($url));
$phar = new PharData($tarfile);
Expand Down
19 changes: 8 additions & 11 deletions platform/BaiduCFC.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ function printInput($event, $context)
{
if (strlen(json_encode($event['body']))>500) $event['body']=substr($event['body'],0,strpos($event['body'],'base64')+30) . '...Too Long!...' . substr($event['body'],-50);
echo urldecode(json_encode($event, JSON_PRETTY_PRINT)) . '
' . urldecode(json_encode($context, JSON_PRETTY_PRINT)) . '
';
}

Expand Down Expand Up @@ -210,7 +210,7 @@ function notnull(t)
$html .= '
<label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
}
//if (getConfig('SecretId')==''||getConfig('SecretKey')=='')
//if (getConfig('SecretId')==''||getConfig('SecretKey')=='')
$html .= '
<a href="https://console.bce.baidu.com/iam/#/iam/accesslist" target="_blank">' . getconstStr('Create') . ' Access Key & Secret Key</a><br>
<label>Access Key:<input name="SecretId" type="text" placeholder="" size=""></label><br>
Expand All @@ -235,7 +235,7 @@ function changelanguage(str)
}
function notnull(t)
{';
//if (getConfig('SecretId')==''||getConfig('SecretKey')=='')
//if (getConfig('SecretId')==''||getConfig('SecretKey')=='')
$html .= '
if (t.SecretId.value==\'\') {
alert(\'input Access Key\');
Expand Down Expand Up @@ -379,17 +379,14 @@ function setConfigResponse($response)
return json_decode( $response, true );
}

function OnekeyUpate($GitSource = 'Github', $auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
// Tfo
function OnekeyUpate($auth = 'BingoKingo', $project = 'Tfo', $branch = 'master')
{
$source = '/tmp/code.zip';
$outPath = '/tmp/';

if ($GitSource=='Github') {
// 从github下载对应tar.gz,并解压
$url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
} elseif ($GitSource=='HITGitlab') {
$url = 'https://git.hit.edu.cn/' . $auth . '/' . $project . '/-/archive/' . urlencode($branch) . '/' . $project . '-' . urlencode($branch) . '.tar.gz';
} else return json_encode(['FunctionBrn'=>$_SERVER['functionBrn'], 'code'=>'Git Source input Error!']);
// 从github下载对应tar.gz,并解压
$url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
$tarfile = '/tmp/github.tar.gz';
file_put_contents($tarfile, file_get_contents($url));
$phar = new PharData($tarfile);
Expand Down
14 changes: 5 additions & 9 deletions platform/Heroku.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ function HerokuAPI($method, $url, $data = '', $apikey)
{
if ($method=='PATCH'||$method=='POST') {
$headers['Content-Type'] = 'application/json';
}
}
$headers['Authorization'] = 'Bearer ' . $apikey;
$headers['Accept'] = 'application/vnd.heroku+json; version=3';
//if (!isset($headers['Accept'])) $headers['Accept'] = '*/*';
Expand Down Expand Up @@ -340,15 +340,11 @@ function_name:' . $_SERVER['function_name'] . '<br>
<button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>';
}

function OnekeyUpate($GitSource = 'Github', $auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
// Tfo
function OnekeyUpate($auth = 'BingoKingo', $project = 'Tfo', $branch = 'master')
{
if ($GitSource=='Github') {
//'https://github.com/qkqpttgf/OneManager-php/tarball/master/';
$source = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
} elseif ($GitSource=='HITGitlab') {
$source = 'https://git.hit.edu.cn/' . $auth . '/' . $project . '/-/archive/' . urlencode($branch) . '/' . $project . '-' . urlencode($branch) . '.tar.gz';
} else return ['stat'=>403, 'body'=>json_encode(['id'=>'Error', 'message'=>'Git Source input Error!'])];

//'https://github.com/qkqpttgf/OneManager-php/tarball/master/';
$source = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
return updateHerokuapp(getConfig('HerokuappId'), getConfig('APIKey'), $source);
}

Expand Down
19 changes: 8 additions & 11 deletions platform/HuaweiFG_env.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ function printInput($event, $context)

if (strlen(json_encode($event['body']))>500) $event['body']=substr($event['body'],0,strpos($event['body'],'base64')+30) . '...Too Long!...' . substr($event['body'],-50);
echo urldecode(json_encode($event, JSON_PRETTY_PRINT)) . '
' . urldecode(json_encode($tmp, JSON_PRETTY_PRINT)) . '
';
}

Expand Down Expand Up @@ -237,7 +237,7 @@ function notnull(t)
$html .= '
<label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
}
//if (getConfig('HW_urn')==''||getConfig('HW_key')==''||getConfig('HW_secret')=='')
//if (getConfig('HW_urn')==''||getConfig('HW_key')==''||getConfig('HW_secret')=='')
$html .= '
在函数代码操作页上方找到URN,鼠标放上去后显示URN,复制填入:<br>
<label>URN:<input name="HW_urn" type="text" placeholder="" size=""></label><br>
Expand Down Expand Up @@ -268,7 +268,7 @@ function changelanguage(str)
}
function notnull(t)
{';
//if (getConfig('HW_urn')==''||getConfig('HW_key')==''||getConfig('HW_secret')=='')
//if (getConfig('HW_urn')==''||getConfig('HW_key')==''||getConfig('HW_secret')=='')
$html .= '
if (t.HW_urn.value==\'\') {
alert(\'input URN\');
Expand Down Expand Up @@ -429,17 +429,14 @@ function setConfigResponse($response)
return json_decode( $response, true );
}

function OnekeyUpate($GitSource = 'Github', $auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
// Tfo
function OnekeyUpate($auth = 'BingoKingo', $project = 'Tfo', $branch = 'master')
{
$source = '/tmp/code.zip';
$outPath = '/tmp/';

if ($GitSource=='Github') {
// 从github下载对应tar.gz,并解压
$url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
} elseif ($GitSource=='HITGitlab') {
$url = 'https://git.hit.edu.cn/' . $auth . '/' . $project . '/-/archive/' . urlencode($branch) . '/' . $project . '-' . urlencode($branch) . '.tar.gz';
} else return json_encode(['error_code'=>'Error', 'error_msg'=>'Git Source input Error!']);
// 从github下载对应tar.gz,并解压
$url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
$tarfile = '/tmp/github.tar.gz';
file_put_contents($tarfile, file_get_contents($url));
$phar = new PharData($tarfile);
Expand Down
Loading

0 comments on commit 15286a4

Please sign in to comment.