Release
This commit is contained in:
22
web/api/config_get.php
Normal file
22
web/api/config_get.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
require __DIR__ . '/../lib/app.php';
|
||||
require __DIR__ . '/../lib/torctl.php';
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$parsed = read_torpanel_conf();
|
||||
$ui = torrc_to_ui($parsed);
|
||||
|
||||
$rate_mb = round($ui['rate_mbps'] / 8, 2);
|
||||
$burst_mb = round($ui['burst_mbps'] / 8, 2);
|
||||
$torrc = [
|
||||
'Nickname' => $ui['nickname'],
|
||||
'ContactInfo' => $ui['contact'],
|
||||
'ORPort' => (string)$ui['orport'],
|
||||
'BandwidthRate' => rtrim(rtrim(number_format($rate_mb, 2, '.', ''), '0'), '.') . ' MB',
|
||||
'BandwidthBurst' => rtrim(rtrim(number_format($burst_mb, 2, '.', ''), '0'), '.') . ' MB',
|
||||
'AccountingMax' => $ui['cap_gb'] . ' GB',
|
||||
'AccountingStart' => 'month ' . $ui['acc_day'] . ' 00:00',
|
||||
];
|
||||
|
||||
echo json_encode(['ok' => true] + $ui + $torrc);
|
||||
Reference in New Issue
Block a user