Merge branch 'add-radius-connection' into 'master'

added new radius module

See merge request fronk/thetool!890
This commit is contained in:
Luca Haid
2025-01-14 08:10:58 +00:00
2 changed files with 22 additions and 21 deletions

View File

@@ -19,4 +19,21 @@ class RadiusController extends mfBaseController {
}
protected function proxyUnsecureHTTPRequestToRadiusAction() {
$url = "http://radius.xinon.at/api.php?" . http_build_query($_GET);
$url = str_replace("proxyUnsecureHTTPRequestToRadius", "", $url);
$opts = [
"http" => [
"method" => "GET",
"header" => "Authorization: Basic " . base64_encode("admin:saveman"),
]
];
header("Content-Type: application/json");
$context = stream_context_create($opts);
$response = file_get_contents($url, false, $context);
echo $response;
die();
}
}

View File

@@ -170,11 +170,7 @@ Vue.component('radius', {
info: this.info,
custnum: custnum,
});
const response = await fetch(`http://radius.xinon.at/api.php?${params.toString()}`, {
headers: {
'Authorization': 'Basic ' + btoa('admin:saveman')
}
});
const response = await fetch(`${window.TT_CONFIG['BASE_PATH']}/Radius/proxyUnsecureHTTPRequestToRadius?${params.toString()}`);
if (response.ok) {
this.radiusUsers = await response.json();
} else {
@@ -183,14 +179,10 @@ Vue.component('radius', {
},
async fetchRadacctData(username) {
const params = new URLSearchParams({
action: 'fetchRadacct',
action2: 'fetchRadacct',
username: username,
});
const response = await fetch(`http://radius.xinon.at/api.php?${params.toString()}`, {
headers: {
'Authorization': 'Basic ' + btoa('admin:saveman')
}
});
const response = await fetch(`${window.TT_CONFIG['BASE_PATH']}/Radius/proxyUnsecureHTTPRequestToRadius?${params.toString()}`);
if (response.ok) {
this.radacctData = await response.json();
this.showRadacctModal = true;
@@ -200,16 +192,8 @@ Vue.component('radius', {
},
async loadFreeUsers() {
try {
const natResponse = await fetch('http://radius.xinon.at/api.php?action=free_user&filter=nat', {
headers: {
'Authorization': 'Basic ' + btoa('admin:saveman')
}
});
const stfResponse = await fetch('http://radius.xinon.at/api.php?action=free_user&filter=stf', {
headers: {
'Authorization': 'Basic ' + btoa('admin:saveman')
}
});
const natResponse = await fetch(window.TT_CONFIG['BASE_PATH'] + '/Radius/proxyUnsecureHTTPRequestToRadius?action2=free_user&filter=nat');
const stfResponse = await fetch(window.TT_CONFIG['BASE_PATH'] + '/Radius/proxyUnsecureHTTPRequestToRadius?action2=free_user&filter=stf');
if (natResponse.ok && stfResponse.ok) {
const natData = await natResponse.json();