mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-23 19:37:23 +08:00
fix installation for beta5
This commit is contained in:
+6
-14
@@ -1,4 +1,4 @@
|
|||||||
APP_NAME=Laravel
|
APP_NAME=NexusPHP
|
||||||
APP_ENV=local
|
APP_ENV=local
|
||||||
APP_KEY=base64:WUbN2wa2kl3E1VDW4iKaH3RBHw3hKY7BK0hWEkBZmGg=
|
APP_KEY=base64:WUbN2wa2kl3E1VDW4iKaH3RBHw3hKY7BK0hWEkBZmGg=
|
||||||
APP_DEBUG=true
|
APP_DEBUG=true
|
||||||
@@ -10,7 +10,7 @@ LOG_LEVEL=debug
|
|||||||
DB_CONNECTION=mysql
|
DB_CONNECTION=mysql
|
||||||
DB_HOST=127.0.0.1
|
DB_HOST=127.0.0.1
|
||||||
DB_PORT=3306
|
DB_PORT=3306
|
||||||
DB_DATABASE=laravel
|
DB_DATABASE=nexusphp
|
||||||
DB_USERNAME=root
|
DB_USERNAME=root
|
||||||
DB_PASSWORD=
|
DB_PASSWORD=
|
||||||
|
|
||||||
@@ -45,21 +45,13 @@ MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
|||||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
||||||
|
|
||||||
|
|
||||||
|
REDIS_HOST=
|
||||||
MYSQL_HOST=127.0.0.1
|
REDIS_PASSWORD=
|
||||||
MYSQL_PORT=3306
|
REDIS_PORT=
|
||||||
MYSQL_USERNAME=
|
REDIS_DB=
|
||||||
MYSQL_PASSWORD=
|
|
||||||
MYSQL_DATABASE=nexusphp
|
|
||||||
|
|
||||||
REDIS_HOST=127.0.0.1
|
|
||||||
REDIS_PASSWORD=null
|
|
||||||
REDIS_PORT=6379
|
|
||||||
REDIS_DATABASE=0
|
|
||||||
|
|
||||||
USE_CRON_TRIGGER_CLEANUP=false
|
USE_CRON_TRIGGER_CLEANUP=false
|
||||||
|
|
||||||
LOG_FILE=/tmp/nexus.log
|
LOG_FILE=/tmp/nexus.log
|
||||||
LOG_SPLIT=daily
|
|
||||||
|
|
||||||
TIMEZONE=PRC
|
TIMEZONE=PRC
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ export default {
|
|||||||
next()
|
next()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log('showMenu: ', !noMenu.includes(to.path))
|
||||||
state.showMenu = !noMenu.includes(to.path)
|
state.showMenu = !noMenu.includes(to.path)
|
||||||
state.currentPath = to.path
|
state.currentPath = to.path
|
||||||
document.title = pathMap[to.name]
|
document.title = pathMap[to.name]
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<div class="nickname">
|
<div class="nickname">
|
||||||
<p>Username:{{ userInfo && userInfo.username || '' }}</p>
|
<p>Username:{{ userInfo && userInfo.username || '' }}</p>
|
||||||
<p>Email:{{ userInfo && userInfo.email || '' }}</p>
|
<p>Class:{{ userInfo && userInfo.class_text || '' }}</p>
|
||||||
<el-tag size="small" effect="dark" class="logout" @click="logout">Logout</el-tag>
|
<el-tag size="small" effect="dark" class="logout" @click="logout">Logout</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
@@ -67,7 +67,7 @@ export default {
|
|||||||
router.back()
|
router.back()
|
||||||
}
|
}
|
||||||
router.afterEach((to) => {
|
router.afterEach((to) => {
|
||||||
// console.log("Head afterEach to", to)
|
console.log("Head afterEach to", to)
|
||||||
const { id } = to.query
|
const { id } = to.query
|
||||||
state.name = pathMap[to.name]
|
state.name = pathMap[to.name]
|
||||||
})
|
})
|
||||||
|
|||||||
Vendored
+7
-6
@@ -8,13 +8,14 @@ axios.defaults.withCredentials = true
|
|||||||
axios.defaults.headers['X-Requested-With'] = 'XMLHttpRequest'
|
axios.defaults.headers['X-Requested-With'] = 'XMLHttpRequest'
|
||||||
axios.defaults.headers['Content-Type'] = 'application/json'
|
axios.defaults.headers['Content-Type'] = 'application/json'
|
||||||
axios.defaults.headers['Accept'] = 'application/json'
|
axios.defaults.headers['Accept'] = 'application/json'
|
||||||
axios.defaults.headers['Authorization'] = 'Bearer ' + localGet('token')
|
// axios.defaults.headers['Authorization'] = 'Bearer ' + localGet('token')
|
||||||
|
|
||||||
// axios.interceptors.request.use(config => {
|
axios.interceptors.request.use(config => {
|
||||||
// // console.log('before request', config)
|
config.headers['Authorization'] = 'Bearer ' + localGet('token')
|
||||||
// config.headers['Authorization'] = 'Bearer ' + localGet('token')
|
return config
|
||||||
// return config
|
}, error => {
|
||||||
// })
|
return Promise.reject(error)
|
||||||
|
})
|
||||||
|
|
||||||
axios.interceptors.response.use(res => {
|
axios.interceptors.response.use(res => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
|
|||||||
@@ -57,11 +57,9 @@ export default {
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
api.login(state.ruleForm).then(res => {
|
api.login(state.ruleForm).then(res => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
localSet('token', res.data.token)
|
localSet('token', res.data.token)
|
||||||
router.push({name: 'dashboard'})
|
localSet('userInfo', res.data)
|
||||||
// api.getUserBase().then(res => {
|
router.push({name: 'dashboard'})
|
||||||
// localSet('userInfo', res.data)
|
|
||||||
// })
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
console.log('error submit!!')
|
console.log('error submit!!')
|
||||||
|
|||||||
@@ -29,7 +29,9 @@ class UserResource extends JsonResource
|
|||||||
'downloaded_text' => mksize($this->downloaded),
|
'downloaded_text' => mksize($this->downloaded),
|
||||||
'bonus' => $this->seedbonus,
|
'bonus' => $this->seedbonus,
|
||||||
'seedtime' => $this->seedtime,
|
'seedtime' => $this->seedtime,
|
||||||
|
'seedtime_text' => mkprettytime($this->seedtime),
|
||||||
'leechtime' => $this->leechtime,
|
'leechtime' => $this->leechtime,
|
||||||
|
'leechtime_text' => mkprettytime($this->leechtime),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace App\Repositories;
|
namespace App\Repositories;
|
||||||
|
|
||||||
|
use App\Http\Resources\UserResource;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
@@ -10,16 +11,17 @@ class AuthenticateRepository extends BaseRepository
|
|||||||
{
|
{
|
||||||
$user = User::query()
|
$user = User::query()
|
||||||
->where('username', $username)
|
->where('username', $username)
|
||||||
->firstOrFail(['id', 'secret', 'passhash']);
|
->first(array_merge(User::$commonFields, ['secret', 'passhash']));
|
||||||
if (md5($user->secret . $password . $user->secret) != $user->passhash) {
|
if (!$user || md5($user->secret . $password . $user->secret) != $user->passhash) {
|
||||||
throw new \InvalidArgumentException('username or password invalid');
|
throw new \InvalidArgumentException('Username or password invalid.');
|
||||||
}
|
}
|
||||||
$token = DB::transaction(function () use ($user) {
|
$tokenName = __METHOD__ . __LINE__;
|
||||||
|
$token = DB::transaction(function () use ($user, $tokenName) {
|
||||||
$user->tokens()->delete();
|
$user->tokens()->delete();
|
||||||
$tokenResult = $user->createToken(__CLASS__ . __FUNCTION__ . __LINE__);
|
$tokenResult = $user->createToken($tokenName);
|
||||||
return $tokenResult->plainTextToken;
|
return $tokenResult->plainTextToken;
|
||||||
});
|
});
|
||||||
$result = $user->toArray();
|
$result = (new UserResource($user))->response()->getData(true)['data'];
|
||||||
$result['token'] = $token;
|
$result['token'] = $token;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-6
@@ -1,11 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!empty($_SERVER['HTTP_X_REQUEST_ID'])) {
|
define('REQUEST_ID', $_SERVER['HTTP_X_REQUEST_ID'] ?? $_SERVER['REQUEST_ID'] ?? str_pad(str_replace('.', '', LARAVEL_START), 14, "0", STR_PAD_RIGHT));
|
||||||
define('REQUEST_ID', $_SERVER['HTTP_X_REQUEST_ID']);
|
|
||||||
} else {
|
|
||||||
$requestId = str_replace('.', '', LARAVEL_START);
|
|
||||||
define('REQUEST_ID', str_pad($requestId, 14, "0", STR_PAD_RIGHT));
|
|
||||||
}
|
|
||||||
define('IN_NEXUS', false);
|
define('IN_NEXUS', false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Generated
+9
-5
@@ -987,16 +987,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/framework",
|
"name": "laravel/framework",
|
||||||
"version": "v8.35.1",
|
"version": "v8.40.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/laravel/framework.git",
|
"url": "https://github.com/laravel/framework.git",
|
||||||
"reference": "d118c0df39e7524131176aaf76493eae63a8a602"
|
"reference": "a654897ad7f97aea9d7ef292803939798c4a02a4"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/laravel/framework/zipball/d118c0df39e7524131176aaf76493eae63a8a602",
|
"url": "https://api.github.com/repos/laravel/framework/zipball/a654897ad7f97aea9d7ef292803939798c4a02a4",
|
||||||
"reference": "d118c0df39e7524131176aaf76493eae63a8a602",
|
"reference": "a654897ad7f97aea9d7ef292803939798c4a02a4",
|
||||||
"shasum": "",
|
"shasum": "",
|
||||||
"mirrors": [
|
"mirrors": [
|
||||||
{
|
{
|
||||||
@@ -1153,7 +1153,11 @@
|
|||||||
"framework",
|
"framework",
|
||||||
"laravel"
|
"laravel"
|
||||||
],
|
],
|
||||||
"time": "2021-03-30T21:34:17+00:00"
|
"support": {
|
||||||
|
"issues": "https://github.com/laravel/framework/issues",
|
||||||
|
"source": "https://github.com/laravel/framework"
|
||||||
|
},
|
||||||
|
"time": "2021-04-28T14:38:56+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/sanctum",
|
"name": "laravel/sanctum",
|
||||||
|
|||||||
+6
-6
@@ -11,17 +11,17 @@ return [
|
|||||||
'use_cron_trigger_cleanup' => nexus_env('USE_CRON_TRIGGER_CLEANUP', false),
|
'use_cron_trigger_cleanup' => nexus_env('USE_CRON_TRIGGER_CLEANUP', false),
|
||||||
|
|
||||||
'mysql' => [
|
'mysql' => [
|
||||||
'host' => nexus_env('MYSQL_HOST', '127.0.0.1'),
|
'host' => nexus_env('DB_HOST', '127.0.0.1'),
|
||||||
'port' => nexus_env('MYSQL_PORT', 3306),
|
'port' => nexus_env('DB_PORT', 3306),
|
||||||
'username' => nexus_env('MYSQL_USERNAME', 'root'),
|
'username' => nexus_env('DB_USERNAME', 'root'),
|
||||||
'password' => nexus_env('MYSQL_PASSWORD', ''),
|
'password' => nexus_env('DB_PASSWORD', ''),
|
||||||
'database' => nexus_env('MYSQL_DATABASE', 'nexusphp'),
|
'database' => nexus_env('DB_DATABASE', 'nexusphp'),
|
||||||
],
|
],
|
||||||
|
|
||||||
'redis' => [
|
'redis' => [
|
||||||
'host' => nexus_env('REDIS_HOST', '127.0.0.1'),
|
'host' => nexus_env('REDIS_HOST', '127.0.0.1'),
|
||||||
'port' => nexus_env('REDIS_PORT', 6379),
|
'port' => nexus_env('REDIS_PORT', 6379),
|
||||||
'database' => nexus_env('REDIS_DATABASE', 0),
|
'database' => nexus_env('REDIS_DB', 0),
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
+2
-2
@@ -7,7 +7,8 @@ define('ROOT_PATH', $rootpath);
|
|||||||
define('VERSION_NUMBER', '1.6.0');
|
define('VERSION_NUMBER', '1.6.0');
|
||||||
define('CURRENT_SCRIPT', strstr(basename($_SERVER['SCRIPT_FILENAME']), '.', true));
|
define('CURRENT_SCRIPT', strstr(basename($_SERVER['SCRIPT_FILENAME']), '.', true));
|
||||||
define('IS_ANNOUNCE', CURRENT_SCRIPT == 'announce');
|
define('IS_ANNOUNCE', CURRENT_SCRIPT == 'announce');
|
||||||
define('REQUEST_ID', $_SERVER['HTTP_X_REQUEST_ID'] ?? $_SERVER['REQUEST_ID'] ?? intval(NEXUS_START * 10000));
|
define('REQUEST_ID', $_SERVER['HTTP_X_REQUEST_ID'] ?? $_SERVER['REQUEST_ID'] ?? str_pad(str_replace('.', '', NEXUS_START), 14, "0", STR_PAD_RIGHT));;
|
||||||
|
require $rootpath . 'vendor/autoload.php';
|
||||||
if (!file_exists($rootpath . '.env')) {
|
if (!file_exists($rootpath . '.env')) {
|
||||||
$installScriptRelativePath = 'install/install.php';
|
$installScriptRelativePath = 'install/install.php';
|
||||||
$installScriptFile = $rootpath . "public/$installScriptRelativePath";
|
$installScriptFile = $rootpath . "public/$installScriptRelativePath";
|
||||||
@@ -15,7 +16,6 @@ if (!file_exists($rootpath . '.env')) {
|
|||||||
nexus_redirect($installScriptRelativePath);
|
nexus_redirect($installScriptRelativePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
require $rootpath . 'vendor/autoload.php';
|
|
||||||
require $rootpath . 'nexus/Database/helpers.php';
|
require $rootpath . 'nexus/Database/helpers.php';
|
||||||
require $rootpath . 'classes/class_cache_redis.php';
|
require $rootpath . 'classes/class_cache_redis.php';
|
||||||
require $rootpath . 'include/eloquent.php';
|
require $rootpath . 'include/eloquent.php';
|
||||||
|
|||||||
@@ -20,9 +20,7 @@ class Install
|
|||||||
'searchbox', 'secondicons', 'sources', 'standards', 'stylesheets', 'sysoppanel', 'teams', 'torrents_state', 'uploadspeed', 'agent_allowed_family',
|
'searchbox', 'secondicons', 'sources', 'standards', 'stylesheets', 'sysoppanel', 'teams', 'torrents_state', 'uploadspeed', 'agent_allowed_family',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $envNames = ['MYSQL_HOST', 'MYSQL_PORT', 'MYSQL_USERNAME', 'MYSQL_PASSWORD', 'MYSQL_DATABASE', 'REDIS_HOST', 'REDIS_PORT', 'REDIS_DATABASE'];
|
protected $envNames = ['DB_HOST', 'DB_PORT', 'DB_USERNAME', 'DB_PASSWORD', 'DB_DATABASE', 'REDIS_HOST', 'REDIS_PORT', 'REDIS_DB'];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@@ -423,15 +421,15 @@ class Install
|
|||||||
}
|
}
|
||||||
$this->doLog("[CREATE ENV] final newData: " . json_encode($newData));
|
$this->doLog("[CREATE ENV] final newData: " . json_encode($newData));
|
||||||
unset($key, $value);
|
unset($key, $value);
|
||||||
mysql_connect($newData['MYSQL_HOST'], $newData['MYSQL_USERNAME'], $newData['MYSQL_PASSWORD'], $newData['MYSQL_DATABASE'], $newData['MYSQL_PORT']);
|
mysql_connect($newData['DB_HOST'], $newData['DB_USERNAME'], $newData['DB_PASSWORD'], $newData['DB_DATABASE'], $newData['DB_PORT']);
|
||||||
if (extension_loaded('redis') && !empty($newData['REDIS_HOST'])) {
|
if (extension_loaded('redis') && !empty($newData['REDIS_HOST'])) {
|
||||||
$redis = new \Redis();
|
$redis = new \Redis();
|
||||||
$redis->connect($newData['REDIS_HOST'], $newData['REDIS_PORT'] ?: 6379);
|
$redis->connect($newData['REDIS_HOST'], $newData['REDIS_PORT'] ?: 6379);
|
||||||
if (isset($newData['REDIS_DATABASE'])) {
|
if (isset($newData['REDIS_DB'])) {
|
||||||
if (!ctype_digit($newData['REDIS_DATABASE']) || $newData['REDIS_DATABASE'] < 0 || $newData['REDIS_DATABASE'] > 15) {
|
if (!ctype_digit($newData['REDIS_DB']) || $newData['REDIS_DB'] < 0 || $newData['REDIS_DB'] > 15) {
|
||||||
throw new \InvalidArgumentException("invalid redis database: " . $newData['redis_database']);
|
throw new \InvalidArgumentException("invalid redis database: " . $newData['REDIS_DB']);
|
||||||
}
|
}
|
||||||
$redis->select($newData['REDIS_DATABASE']);
|
$redis->select($newData['REDIS_DB']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$content = "";
|
$content = "";
|
||||||
@@ -502,8 +500,13 @@ class Install
|
|||||||
$sqlFile = ROOT_PATH . '_db/dbstructure_v1.6.sql';
|
$sqlFile = ROOT_PATH . '_db/dbstructure_v1.6.sql';
|
||||||
}
|
}
|
||||||
$string = file_get_contents($sqlFile);
|
$string = file_get_contents($sqlFile);
|
||||||
$pattern = "/INSERT INTO `(\w+)` VALUES \(.*\);\n/i";
|
if ($string === false) {
|
||||||
|
throw new \RuntimeException("can't not read dbstructure file: $sqlFile");
|
||||||
|
}
|
||||||
|
//@todo test in php 7.3
|
||||||
|
$pattern = "/INSERT INTO `(\w+)` VALUES \(.*\);/i";
|
||||||
preg_match_all($pattern, $string, $matches, PREG_SET_ORDER);
|
preg_match_all($pattern, $string, $matches, PREG_SET_ORDER);
|
||||||
|
$this->doLog("[IMPORT DATA] matches count: " . count($matches));
|
||||||
foreach ($matches as $match) {
|
foreach ($matches as $match) {
|
||||||
$table = $match[1];
|
$table = $match[1];
|
||||||
$sql = trim($match[0]);
|
$sql = trim($match[0]);
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ if ($currentStep == 1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($currentStep == 2) {
|
if ($currentStep == 2) {
|
||||||
$envExampleFile = "$rootpath.env.example";
|
$envExampleFile = $rootpath . ".env.example";
|
||||||
|
$dbstructureFile = $rootpath . "_db/dbstructure_v1.6.sql";
|
||||||
$envExampleData = readEnvFile($envExampleFile);
|
$envExampleData = readEnvFile($envExampleFile);
|
||||||
$envFormControls = $install->listEnvFormControls();
|
$envFormControls = $install->listEnvFormControls();
|
||||||
$newData = array_column($envFormControls, 'value', 'name');
|
$newData = array_column($envFormControls, 'value', 'name');
|
||||||
@@ -41,11 +42,17 @@ if ($currentStep == 2) {
|
|||||||
}
|
}
|
||||||
$tableRows = [
|
$tableRows = [
|
||||||
[
|
[
|
||||||
'label' => '.env.example',
|
'label' => basename($envExampleFile),
|
||||||
'required' => 'exists && readable',
|
'required' => 'exists && readable',
|
||||||
'current' => $envExampleFile,
|
'current' => $envExampleFile,
|
||||||
'result' => $install->yesOrNo(file_exists($envExampleFile) && is_readable($envExampleFile)),
|
'result' => $install->yesOrNo(file_exists($envExampleFile) && is_readable($envExampleFile)),
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'label' => basename($dbstructureFile),
|
||||||
|
'required' => 'exists && readable',
|
||||||
|
'current' => $dbstructureFile,
|
||||||
|
'result' => $install->yesOrNo(file_exists($dbstructureFile) && is_readable($dbstructureFile)),
|
||||||
|
],
|
||||||
];
|
];
|
||||||
$fails = array_filter($tableRows, function ($value) {return $value['result'] == 'NO';});
|
$fails = array_filter($tableRows, function ($value) {return $value['result'] == 'NO';});
|
||||||
$pass = empty($fails);
|
$pass = empty($fails);
|
||||||
|
|||||||
@@ -354,8 +354,8 @@
|
|||||||
'code' =>
|
'code' =>
|
||||||
array (
|
array (
|
||||||
'mainversion' => 'NexusPHP',
|
'mainversion' => 'NexusPHP',
|
||||||
'subversion' => 'v1.6.0-beta4',
|
'subversion' => 'v1.6.0-beta5',
|
||||||
'releasedate' => '2021-03-19',
|
'releasedate' => '2021-04-30',
|
||||||
'website' => '<a href="https://nexusphp.org" target="_blank">https://nexusphp.org</a>',
|
'website' => '<a href="https://nexusphp.org" target="_blank">https://nexusphp.org</a>',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user