diff --git a/common.php b/common.php index 42862eb..b1c7e25 100644 --- a/common.php +++ b/common.php @@ -1,8 +1,14 @@ alert(\''.getconstStr('SetSecretsFirst').'\');', 302, [ 'Location' => $url ]); } + $_SERVER['sitename'] = getConfig('sitename'); + if (empty($_SERVER['sitename'])) $_SERVER['sitename'] = getconstStr('defaultSitename'); $_SERVER['base_disk_path'] = $_SERVER['base_path']; $disktags = explode("|",getConfig('disktag')); // echo 'count$disk:'.count($disktags); if (count($disktags)>1) { - if ($path=='/'||$path=='') return output('', 302, [ 'Location' => path_format($_SERVER['base_path'].'/'.$disktags[0].'/') ]); + if ($path=='/'||$path=='') { + $files['folder']['childCount'] = count($disktags); + foreach ($disktags as $disktag) { + $files['children'][$disktag]['folder'] = 1; + $files['children'][$disktag]['name'] = $disktag; + } + if ($_GET['json']) { + // return a json + return files_json($files); + } + return render_list($path, $files); + //return output('', 302, [ 'Location' => path_format($_SERVER['base_path'].'/'.$disktags[0].'/') ]); + } $_SERVER['disktag'] = splitfirst( substr(path_format($path), 1), '/' )[0]; //$pos = strpos($path, '/'); //if ($pos>1) $_SERVER['disktag'] = substr($path, 0, $pos); @@ -538,8 +556,6 @@ function getconstStr($str) function config_oauth() { - $_SERVER['sitename'] = getConfig('sitename'); - if (empty($_SERVER['sitename'])) $_SERVER['sitename'] = getconstStr('defaultSitename'); $_SERVER['redirect_uri'] = 'https://scfonedrive.github.io'; if (getConfig('Drive_ver')=='shareurl') { $_SERVER['api_url'] = getConfig('shareapiurl'); @@ -1617,7 +1633,7 @@ function EnvOpt($needUpdate = 0) asort($ShowedInnerEnv); $html = 'OneManager '.getconstStr('Setup').''; if (isset($_POST['updateProgram'])&&$_POST['updateProgram']==getconstStr('updateProgram')) { - $response = OnekeyUpate($_POST['auth'], $_POST['project'], $_POST['branch']); + $response = setConfigResponse(OnekeyUpate($_POST['auth'], $_POST['project'], $_POST['branch'])); if (api_error($response)) { $html = api_error_msg($response); $title = 'Error';