@ -278,16 +278,53 @@ function DisplayLokinetConfig()
< / ul >
<!-- Tab panes -->
< div class = "tab-content" >
< p > <?php echo $status ; ?> </ p >
< p > <?php echo $status ; ?> </ p >
< p > <?php echo "Current Lokinet $lokiversion " ; ?> </ p >
< div class = "tab-pane fade in active" id = "basic" >
< form role = "form" action = "?page=save_hostapd_conf" method = "POST" >
< h5 > Enter Exit Node Data to activate:< / h5 >
< label for = "exitaddress" > Exit Address:< / label >
< input type = "text" class = "form-control" placeholder = "enter exit address here" id = "exitaddress" name = "exitaddress" >
< label for = "exitaddress" > Exit:< / label >
< 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 } = data['exits'][i];
console.log('Exit name : ' + exit);
console.log('Exit token : '+ auth);
console.log('Exit location : ' + geo);
console.log('Dropdown selection : ' + selection);
document.getElementById("auth").value = auth;
break;
}
}
}
< / script >
< label for = "exitkey" > Exit Key: (optional)< / label >
< input type = "text" class = "form-control" placeholder = "enter exit key here" id = "exitkey" name = "exitkey" >
< br / >
< input type = "text" class = "form-control" id = "auth" placeholder = "optional exit authorization key" id = "exitkey" name = "exitkey" >
< / datalist >
< br / >
<?php
if ($exitstatus != "no exits") {
echo '< input type = "submit" class = "btn btn-danger" name = "StopExit" value = "Stop Exit" / > ', PHP_EOL;
@ -323,7 +360,7 @@ function DisplayLokinetConfig()
<?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 >
< h5 >< pre > <?php echo "LA8VDcoJgiv2bSiVqyaT6hJ67LXbnQGpf9Uk3zh9ikUKPJUWeYbgsd9gxQ5ptM2hQNSsCaRETQ3GM9FLDe7BGqcm4ve69bh" ; ?> </ pre ></ h5 >
< / div >
< / div > < / div >
<?php
}