Compare commits

...

5 Commits

Author SHA1 Message Date
necro-nemesis 537ebfdf8c
Merge pull request #45 from necro-nemesis/master
update to master
3 years ago
necro-nemsis f4a389e364 Add exit node info and form clear 3 years ago
necro-nemsis c0bd858d3d Fix boostrap css error 3 years ago
necro-nemsis 467502d3b0 fix for vnstat v2.6 3 years ago
necro-nemsis fa6e2be125 Bump to 2.7. JSON exit support 3 years ago

@ -1,6 +1,6 @@
![](https://i.imgur.com/2ZrhaiH.png) ![](https://i.imgur.com/2ZrhaiH.png)
# `LabyrinthAP / Lokinet Access Point` [![Release 2.6](https://img.shields.io/badge/Release-2.6-green.svg)](https://github.com/necro-nemesis/raspap-webgui/releases) # `LabyrinthAP / Lokinet Access Point` [![Release 2.7](https://img.shields.io/badge/Release-2.7-green.svg)](https://github.com/necro-nemesis/raspap-webgui/releases)
LabyrinthAP interfaces with Lokinet daemon to facilitate connections to the Lokinet global privacy network. LabyrinthAP provides a simple, responsive web interface to control wifi, hostapd, Lokinet daemon and related services necessary to access Lokinet on the Raspberry Pi or Orange Pi. LabyrinthAP interfaces with Lokinet daemon to facilitate connections to the Lokinet global privacy network. LabyrinthAP provides a simple, responsive web interface to control wifi, hostapd, Lokinet daemon and related services necessary to access Lokinet on the Raspberry Pi or Orange Pi.

@ -17,7 +17,7 @@ if (empty($interface)) {
} else { } else {
exit('No network interfaces found.'); exit('No network interfaces found.');
} }
} }
define('IFNAMSIZ', 16); define('IFNAMSIZ', 16);
if (strlen($interface) > IFNAMSIZ) { if (strlen($interface) > IFNAMSIZ) {
@ -38,10 +38,10 @@ $jsonobj = json_decode($jsonstdoutvnstat[0], true);
$timeunits = filter_input(INPUT_GET, 'tu'); $timeunits = filter_input(INPUT_GET, 'tu');
if ($timeunits === 'm') { if ($timeunits === 'm') {
// months // months
$jsonData = $jsonobj['interfaces'][0]['traffic']['months']; $jsonData = $jsonobj['interfaces'][0]['traffic']['month'];
} else { } else {
// default: days // default: days
$jsonData = $jsonobj['interfaces'][0]['traffic']['days']; $jsonData = $jsonobj['interfaces'][0]['traffic']['day'];
} }
$datasizeunits = filter_input(INPUT_GET, 'dsu'); $datasizeunits = filter_input(INPUT_GET, 'dsu');
@ -74,14 +74,12 @@ for ($i = count($jsonData) - 1; $i >= 0; --$i) {
} }
if ($timeunits === 'm') { if ($timeunits === 'm') {
echo '{ "date": "' , $dt->format('Y-m') , '", "rx": "' , $datareceived , echo '{ "date": "' , $dt->format('Y-m') , '", "rx": "' , $datareceived ,
'", "tx": "' , $datasend , '" }'; '", "tx": "' , $datasend , '" }';
} else { } else {
echo '{ "date": "' , $dt->format('Y-m-d') , '", "rx": "' , $datareceived , echo '{ "date": "' , $dt->format('Y-m-d') , '", "rx": "' , $datareceived ,
'", "tx": "' , $datasend , '" }'; '", "tx": "' , $datasend , '" }';
} }
} }
echo ' ]'; echo ' ]';

@ -1,4 +1,4 @@
<?php <?php
if (filter_input(INPUT_GET, 'tu') == 'h') { if (filter_input(INPUT_GET, 'tu') == 'h') {
header('X-Content-Type-Options: nosniff'); header('X-Content-Type-Options: nosniff');
@ -40,10 +40,10 @@ if (filter_input(INPUT_GET, 'tu') == 'h') {
} }
$jsonobj = json_decode($jsonstdoutvnstat[0], true)['interfaces'][0]; $jsonobj = json_decode($jsonstdoutvnstat[0], true)['interfaces'][0];
$jsonData = $jsonobj['traffic']['hours']; $jsonData = $jsonobj['traffic']['hour'];
for ($i = count($jsonData) - 1; $i >= 0; --$i) { for ($i = count($jsonData) - 1; $i >= 0; --$i) {
$data_template[$jsonData[$i]['id']]['rx'] = round($jsonData[$i]['rx'] / 1024, 0); $data_template[$jsonData[$i]['time']['hour']]['rx'] = round($jsonData[$i]['rx'] / 1024, 0);
$data_template[$jsonData[$i]['id']]['tx'] = round($jsonData[$i]['tx'] / 1024, 0); $data_template[$jsonData[$i]['time']['hour']]['tx'] = round($jsonData[$i]['tx'] / 1024, 0);
} }
$data = array(); $data = array();

@ -1,6 +1,6 @@
<?php <?php
define('RASPI_VERSION', '2.6'); define('RASPI_VERSION', '2.7');
define('RASPI_CONFIG', '/etc/raspap'); define('RASPI_CONFIG', '/etc/raspap');
define('RASPI_CONFIG_NETWORKING',RASPI_CONFIG.'/networking'); define('RASPI_CONFIG_NETWORKING',RASPI_CONFIG.'/networking');
define('RASPI_ADMIN_DETAILS', RASPI_CONFIG.'/raspap.auth'); define('RASPI_ADMIN_DETAILS', RASPI_CONFIG.'/raspap.auth');

@ -278,16 +278,55 @@ function DisplayLokinetConfig()
</ul> </ul>
<!-- Tab panes --> <!-- Tab panes -->
<div class="tab-content"> <div class="tab-content">
<p><?php echo $status; ?></p> <p><?php echo $status; ?></p>
<p><?php echo "Current Lokinet $lokiversion"; ?></p> <p><?php echo "Current Lokinet $lokiversion"; ?></p>
<div class="tab-pane fade in active" id="basic"> <div class="tab-pane fade in active" id="basic">
<form role="form" action="?page=save_hostapd_conf" method="POST"> <form role="form" action="?page=save_hostapd_conf" method="POST">
<h5>Enter Exit Node Data to activate:</h5> <h5>Enter Exit Node Data to activate:</h5>
<label for="exitaddress">Exit Address:</label> <label for="exitaddress">Exit:</label>
<input type="text" class="form-control" placeholder="enter exit address here" id="exitaddress" name="exitaddress"> <input type="text" class="form-control" list="exitaddresses" placeholder="enter exit address here" id="exitaddress" name="exitaddress" onchange="OnSelectionChange()">
<?php $api_url = 'https://my-json-server.typicode.com/necro-nemesis/exits-api/exits';
// Read JSON file
$json_data = file_get_contents($api_url);
// Decode JSON data into PHP array
$response_data = json_decode($json_data,true);
?>
<datalist id="exitaddresses">
<?php foreach($response_data as $response){
$listedexits = '<option value=\''.$response['exit'].'\'>';
echo $listedexits;
}
?>
</datalist>
<script>
//JSON Authentication Token Handler
async function OnSelectionChange(){
var selection = document.getElementById("exitaddress").value;
const endpoint = 'https://my-json-server.typicode.com/necro-nemesis/exits-api/db';
const response = await fetch(endpoint);
const data = await response.json();
for (var i = 0; i < data['exits'].length; i++) {
if (data['exits'][i]['exit'] == selection) {
const { exit, auth, geo, rate } = data['exits'][i];
console.log('Exit name : ' + exit);
console.log('Exit token : '+ auth);
console.log('Exit location : ' + geo);
console.log('Exit rate : ' + rate);
console.log('Dropdown selection : ' + selection);
alert('EXIT NODE INFORMATION\r\rExit Address : ' + exit + '\rExit Location : ' + geo + '\rExit Autorization Key : ' + auth + '\rMonthly Rate : ' + rate);
document.getElementById("auth").value = auth;
break;
}
}
}
</script>
<label for="exitkey">Exit Key: (optional)</label> <label for="exitkey">Exit Key: (optional)</label>
<input type="text" class="form-control" placeholder="enter exit key here" id="exitkey" name="exitkey"> <input type="text" class="form-control" id="auth" placeholder="optional exit authorization key" id="exitkey" name="exitkey">
<br/> <br/>
<input type="reset" class="btn btn-default" value="Clear">
<?php <?php
if ($exitstatus != "no exits") { if ($exitstatus != "no exits") {
echo '<input type="submit" class="btn btn-danger" name="StopExit" value="Stop Exit" />', PHP_EOL; echo '<input type="submit" class="btn btn-danger" name="StopExit" value="Stop Exit" />', PHP_EOL;
@ -323,7 +362,7 @@ function DisplayLokinetConfig()
<?php echo '<input type="submit" class="btn btn-success" name="checkaddress" value="Submit" />', <?php echo '<input type="submit" class="btn btn-success" name="checkaddress" value="Submit" />',
PHP_EOL; ?><h5><?php echo "Your development support is greatly appreciated <br>Independent LabyrinthAP developer TechnicalTumbleweed's OXEN wallet address:"; ?></h5> PHP_EOL; ?><h5><?php echo "Your development support is greatly appreciated <br>Independent LabyrinthAP developer TechnicalTumbleweed's OXEN wallet address:"; ?></h5>
<h5><pre><?php echo "LA8VDcoJgiv2bSiVqyaT6hJ67LXbnQGpf9Uk3zh9ikUKPJUWeYbgsd9gxQ5ptM2hQNSsCaRETQ3GM9FLDe7BGqcm4ve69bh"; ?></pre></h5> <h5><pre><?php echo "LA8VDcoJgiv2bSiVqyaT6hJ67LXbnQGpf9Uk3zh9ikUKPJUWeYbgsd9gxQ5ptM2hQNSsCaRETQ3GM9FLDe7BGqcm4ve69bh"; ?></pre></h5>
</div> </div></div>
<?php <?php
} }

@ -12,7 +12,7 @@
* *
* @author TechnicalTumbleweed (Oxen-> Session Lokinet/Telegram Oxen Community) * @author TechnicalTumbleweed (Oxen-> Session Lokinet/Telegram Oxen Community)
* @license GNU General Public License, version 3 (GPL-3.0) * @license GNU General Public License, version 3 (GPL-3.0)
* @version 2.6 * @version 2.7
* @link https://github.com/necro-nemesis/LabyrinthAP * @link https://github.com/necro-nemesis/LabyrinthAP
*/ */

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save