update to 8.18

This commit is contained in:
Km.Van
2024-07-27 16:02:58 +08:00
parent eae6cddd58
commit 7d4803d8a1
4 changed files with 31 additions and 21 deletions

View File

@@ -1,5 +1,5 @@
{
"APP_VERSION": "8.17",
"APP_VERSION": "8.18",
"APP_NAME": "X Prober",
"APP_URL": "https://github.com/kmvan/x-prober",
"AUTHOR_URL": "https://inn-studio.com/prober",
@@ -19,27 +19,27 @@
"LATEST_NGINX_STABLE_VERSION": "1.22.0",
"BENCHMARKS": [
{
"name": "Olink / AMD-3700X / PHP80 JIT",
"name": "Olink / E5-2680 v4 / PHP83 JIT",
"url": "https://www.olink.cloud/clients/aff.php?aff=120",
"date": "2021-07-13",
"proberUrl": "https://x-prober-server-benchmark-olink-frk.inn-studio.com",
"binUrl": "https://speedtest.fishfish.date",
"date": "2024-05-29",
"proberUrl": "https://x-prober-server-benchmark-olink-sj.inn-studio.com",
"binUrl": "",
"detail": {
"cpu": 436593,
"read": 57382,
"write": 22271
"cpu": 268212,
"read": 18495,
"write": 6164
}
},
{
"name": "RamNode / PHP80 JIT",
"name": "RamNode / PHP82 JIT",
"url": "https://clientarea.ramnode.com/aff.php?aff=4143",
"date": "2021-07-17",
"date": "2023-05-02",
"proberUrl": "https://x-prober-server-benchmark-ramnode-sea.inn-studio.com",
"binUrl": "https://x-prober-server-benchmark-ramnode-sea.inn-studio.com/512m.bin",
"detail": {
"cpu": 199626,
"read": 67379,
"write": 12453
"cpu": 203245,
"read": 68706,
"write": 11452
}
},
{
@@ -54,15 +54,15 @@
}
},
{
"name": "Vultr / Tokyo / PHP80 JIT",
"name": "Vultr / Tokyo / PHP82 JIT",
"url": "https://www.vultr.com/?ref=7826363-4F",
"date": "2021-07-17",
"date": "2023-05-02",
"proberUrl": "https://x-prober-server-benchmark-vultr-tokyo.inn-studio.com/",
"binUrl": "https://hnd-jp-ping.vultr.com/vultr.com.100MB.bin",
"detail": {
"cpu": 229400,
"read": 65474,
"write": 15558
"cpu": 243748,
"read": 46066,
"write": 13824
}
},
{

View File

@@ -2,12 +2,22 @@
All Notable changes to `X-Prober` will be documented in this file
## 8.18.0 - 2024-07-27
### Add
- Add ARM CPU detection
### Optimize
- Optimize disk usage detection
## 8.17.0 - 2023-12-31
### Add
- Add detail disk usage
-
### Optimize
- Optimize style

2
dist/prober.php vendored
View File

@@ -96,7 +96,7 @@ namespace InnStudio\Prober\Components\Nodes; use InnStudio\Prober\Components\Eve
namespace InnStudio\Prober\Components\Nodes; use InnStudio\Prober\Components\Events\EventsApi; use InnStudio\Prober\Components\Rest\RestResponse; use InnStudio\Prober\Components\Rest\StatusCode; final class Fetch extends NodesApi { public function __construct() { EventsApi::on('init', function ($action) { switch ($action) { case 'nodes': EventsApi::emit('fetchNodesBefore'); $response = new RestResponse(EventsApi::emit('nodes', array())); $response->json()->end(); case 'node': EventsApi::emit('fetchNodeBefore'); $nodeId = filter_input(\INPUT_GET, 'nodeId', \FILTER_DEFAULT); $response = new RestResponse(); if ( ! $nodeId) { $response->setStatus(StatusCode::$BAD_REQUEST)->json()->end(); } $data = $this->getNodeData($nodeId); if ( ! $data) { $response->setStatus(StatusCode::$NO_CONTENT)->json()->end(); } $response->setData($data)->json()->end(); } return $action; }, 100); } private function getNodeData($nodeId) { foreach ($this->getNodes() as $item) { if ( ! isset($item['id']) || ! isset($item['url']) || $item['id'] !== $nodeId) { continue; } return $this->getRemoteContent("{$item['url']}?action=fetch"); } } private function getRemoteContent($url) { $content = ''; if (\function_exists('curl_init')) { $ch = curl_init(); curl_setopt_array($ch, array( \CURLOPT_URL => $url, \CURLOPT_RETURNTRANSFER => true, )); $content = curl_exec($ch); curl_close($ch); return json_decode($content, true) ?: null; } return json_decode(file_get_contents($url), true) ?: null; } }
namespace InnStudio\Prober\Components\Nodes; use InnStudio\Prober\Components\Xconfig\XconfigApi; class NodesApi { public $ID = 'nodes'; public function getNodes() { $items = XconfigApi::getNodes(); if ( ! $items || ! \is_array($items)) { return array(); } return array_filter(array_map(function ($item) { if (2 !== \count($item)) { return; } return array( 'id' => $item[0], 'url' => $item[1], ); }, $items)); } }
namespace InnStudio\Prober\Components\Nodes; final class Nodes { public function __construct() { new Conf(); new Fetch(); } }
namespace InnStudio\Prober\Components\Config; class ConfigApi { public static $APP_VERSION = '8.17'; public static $APP_NAME = 'X Prober'; public static $APP_URL = 'https://github.com/kmvan/x-prober'; public static $APP_CONFIG_URLS = array('https://raw.githubusercontent.com/kmvan/x-prober/master/AppConfig.json', 'https://api.inn-studio.com/download/?id=xprober-config'); public static $APP_CONFIG_URL_DEV = 'http://localhost:8000/AppConfig.json'; public static $APP_TEMPERATURE_SENSOR_URL = 'http://127.0.0.1'; public static $APP_TEMPERATURE_SENSOR_PORTS = array(2048, 4096); public static $AUTHOR_URL = 'https://inn-studio.com/prober'; public static $UPDATE_PHP_URLS = array('https://raw.githubusercontent.com/kmvan/x-prober/master/dist/prober.php', 'https://api.inn-studio.com/download/?id=xprober'); public static $AUTHOR_NAME = 'INN STUDIO'; public static $LATEST_PHP_STABLE_VERSION = '8'; public static $LATEST_NGINX_STABLE_VERSION = '1.22.0'; }
namespace InnStudio\Prober\Components\Config; class ConfigApi { public static $APP_VERSION = '8.18'; public static $APP_NAME = 'X Prober'; public static $APP_URL = 'https://github.com/kmvan/x-prober'; public static $APP_CONFIG_URLS = array('https://raw.githubusercontent.com/kmvan/x-prober/master/AppConfig.json', 'https://api.inn-studio.com/download/?id=xprober-config'); public static $APP_CONFIG_URL_DEV = 'http://localhost:8000/AppConfig.json'; public static $APP_TEMPERATURE_SENSOR_URL = 'http://127.0.0.1'; public static $APP_TEMPERATURE_SENSOR_PORTS = array(2048, 4096); public static $AUTHOR_URL = 'https://inn-studio.com/prober'; public static $UPDATE_PHP_URLS = array('https://raw.githubusercontent.com/kmvan/x-prober/master/dist/prober.php', 'https://api.inn-studio.com/download/?id=xprober'); public static $AUTHOR_NAME = 'INN STUDIO'; public static $LATEST_PHP_STABLE_VERSION = '8'; public static $LATEST_NGINX_STABLE_VERSION = '1.22.0'; }
namespace InnStudio\Prober\Components\Database; use InnStudio\Prober\Components\Events\EventsApi; use InnStudio\Prober\Components\Xconfig\XconfigApi; use PDO; use SQLite3; final class Conf extends DatabaseConstants { public function __construct() { EventsApi::on('conf', function (array $conf) { if (XconfigApi::isDisabled($this->ID)) { return $conf; } $sqlite3Version = class_exists('SQLite3') ? SQLite3::version() : false; $conf[$this->ID] = array( 'sqlite3' => $sqlite3Version ? $sqlite3Version['versionString'] : false, 'sqliteLibversion' => \function_exists('sqlite_libversion') ? sqlite_libversion() : false, 'mysqliClientVersion' => \function_exists('mysqli_get_client_version') ? mysqli_get_client_version() : false, 'mongo' => class_exists('Mongo'), 'mongoDb' => class_exists('MongoDB'), 'postgreSql' => \function_exists('pg_connect'), 'paradox' => \function_exists('px_new'), 'msSql' => \function_exists('sqlsrv_server_info'), 'pdo' => class_exists('PDO') ? implode(',', PDO::getAvailableDrivers()) : false, ); return $conf; }); } }
namespace InnStudio\Prober\Components\Database; class DatabaseConstants { protected $ID = 'database'; }
namespace InnStudio\Prober\Components\Database; final class Database { public function __construct() { new Conf(); } }

View File

@@ -7,7 +7,7 @@ namespace InnStudio\Prober\Components\Config;
class ConfigApi
{
public static $APP_VERSION = '8.17';
public static $APP_VERSION = '8.18';
public static $APP_NAME = 'X Prober';
public static $APP_URL = 'https://github.com/kmvan/x-prober';
public static $APP_CONFIG_URLS = array('https://raw.githubusercontent.com/kmvan/x-prober/master/AppConfig.json', 'https://api.inn-studio.com/download/?id=xprober-config');