Skip to content

Commit

Permalink
Merge pull request #10 from necro-nemesis/Customization
Browse files Browse the repository at this point in the history
Tweaks and changes to the UI
  • Loading branch information
necro-nemesis authored Mar 18, 2019
2 parents dabf8b6 + aa033d4 commit 5313da8
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 121 deletions.
2 changes: 1 addition & 1 deletion includes/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@

// Locale settings
define('LOCALE_ROOT', 'locale');
define('LOCALE_DOMAIN', 'messages');
define('LOCALE_DOMAIN', 'messages');
7 changes: 3 additions & 4 deletions includes/dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function DisplayDashboard(){
preg_match('/state (UP|DOWN)/i', $stdoutIpWRepeatedSpaces, $matchesState ) || $matchesState[1] = 'unknown';
$interfaceState = $matchesState[1];

// Because of table layout used in the ip output we get the interface statistics directly from
// Because of table layout used in the ip output we get the interface statistics directly from
// the system. One advantage of this is that it could work when interface is disable.
exec('cat /sys/class/net/'.RASPI_WIFI_CLIENT_INTERFACE.'/statistics/rx_packets ', $stdoutCatRxPackets);
$strRxPackets = _('No data');
Expand Down Expand Up @@ -126,7 +126,7 @@ function DisplayDashboard(){
preg_match('/txpower ([0-9\.]+ dBm)/i', $stdoutIpInfoWRepSpaces, $matchesTxPower ) || $matchesTxPower[1] = '';
$txPower = $matchesTxPower[1];

// iw does not have the "Link Quality". This is a is an aggregate value,
// iw does not have the "Link Quality". This is a is an aggregate value,
// and depends on the driver and hardware.
// Display link quality as signal quality for now.
$strLinkQuality = 0;
Expand Down Expand Up @@ -173,7 +173,7 @@ function DisplayDashboard(){
}
} else {
$status->addMessage(sprintf(_('Interface is %s.'), strtolower($interfaceState)), $classMsgDevicestatus);
}
}
?>
<div class="row">
<div class="col-lg-12">
Expand Down Expand Up @@ -274,4 +274,3 @@ function getHumanReadableDatasize($numbytes, $precision = 2)

return $humanDatasize;
}

165 changes: 63 additions & 102 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ function DisplayOpenVPNConfig() {
<h4>Server settings</h4>
<div class="row">
<div class="form-group col-md-4">
<label for="code">Port</label>
<label for="code">Port</label>
<input type="text" class="form-control" name="openvpn_port" value="<?php echo htmlspecialchars($arrServerConfig['port'], ENT_QUOTES); ?>" />
</div>
</div>
Expand Down Expand Up @@ -350,14 +350,16 @@ function DisplayLokinetConfig(){
<div class="row">
<div class="col-lg-12">
<div class="panel panel-primary">
<div class="panel-heading"><i class="fa fa-eye-slash fa-fw"></i> Configure TOR proxy</div>
<div class="panel-heading"><i class="fa fa-eye-slash fa-fw"></i> Configure Lokinet</div>
<!-- /.panel-heading -->
<div class="panel-body">
<!-- Nav tabs -->
<ul class="nav nav-tabs">
<li class="active"><a href="#basic" data-toggle="tab">Basic</a>
<li class="active"><a href="#basic" data-toggle="tab">Daemon Control</a>
</li>
<li><a href="#relay" data-toggle="tab">Relay</a>
<li><a href="#daemon" data-toggle="tab">Advanced Console User</a>
</li>
<li><a href="#youtube" data-toggle="tab">This is Loki</a>
</li>
</ul>

Expand All @@ -368,100 +370,59 @@ function DisplayLokinetConfig(){
<div class="tab-pane fade in active" id="basic">
<h4>Basic settings</h4>
<form role="form" action="?page=save_hostapd_conf" method="POST">
<div class="row">
<div class="form-group col-md-4">
<label for="code">VirtualAddrNetwork</label>
<input type="text" class="form-control" name="virtualaddrnetwork" value="<?php echo htmlspecialchars($arrConfig['VirtualAddrNetwork'], ENT_QUOTES); ?>" />
</div>
</div>
<div class="row">
<div class="form-group col-md-4">
<label for="code">AutomapHostsSuffixes</label>
<input type="text" class="form-control" name="automaphostssuffixes" value="<?php echo htmlspecialchars($arrConfig['AutomapHostsSuffixes'], ENT_QUOTES); ?>" />
</div>
</div>
<div class="row">
<div class="form-group col-md-4">
<label for="code">AutomapHostsOnResolve</label>
<input type="text" class="form-control" name="automaphostsonresolve" value="<?php echo htmlspecialchars($arrConfig['AutomapHostsOnResolve'], ENT_QUOTES); ?>" />
</div>
</div>
<div class="row">
<div class="form-group col-md-4">
<label for="code">TransListenAddress</label>
<input type="text" class="form-control" name="translistenaddress" value="<?php echo htmlspecialchars($arrConfig['TransListenAddress'], ENT_QUOTES); ?>" />
</div>
</div>
<div class="row">
<div class="form-group col-md-4">
<label for="code">DNSPort</label>
<input type="text" class="form-control" name="dnsport" value="<?php echo htmlspecialchars($arrConfig['DNSPort'], ENT_QUOTES); ?>" />
</div>
</div>
<div class="row">
<div class="form-group col-md-4">
<label for="code">DNSListenAddress</label>
<input type="text" class="form-control" name="dnslistenaddress" value="<?php echo htmlspecialchars($arrConfig['DNSListenAddress'], ENT_QUOTES); ?>" />
</div>
</div>
</div>
<div class="tab-pane fade" id="relay">
<h4>Relay settings</h4>
<div class="row">
<div class="form-group col-md-4">
<label for="code">ORPort</label>
<input type="text" class="form-control" name="orport" value="<?php echo htmlspecialchars($arrConfig['ORPort'], ENT_QUOTES); ?>" />
</div>
</div>
<div class="row">
<div class="form-group col-md-4">
<label for="code">ORListenAddress</label>
<input type="text" class="form-control" name="orlistenaddress" value="<?php echo htmlspecialchars($arrConfig['ORListenAddress'], ENT_QUOTES); ?>" />
</div>
</div>
<div class="row">
<div class="form-group col-md-4">
<label for="code">Nickname</label>
<input type="text" class="form-control" name="nickname" value="<?php echo htmlspecialchars($arrConfig['Nickname'], ENT_QUOTES); ?>" />
</div>
</div>
<div class="row">
<div class="form-group col-md-4">
<label for="code">Address</label>
<input type="text" class="form-control" name="address" value="<?php echo htmlspecialchars($arrConfig['Address'], ENT_QUOTES); ?>" />
</div>
</div>
<div class="row">
<div class="form-group col-md-4">
<label for="code">RelayBandwidthRate</label>
<input type="text" class="form-control" name="relaybandwidthrate" value="<?php echo htmlspecialchars($arrConfig['RelayBandwidthRate'], ENT_QUOTES); ?>" />
</div>
</div>
<div class="row">
<div class="form-group col-md-4">
<label for="code">RelayBandwidthBurst</label>
<input type="text" class="form-control" name="relaybandwidthburst" value="<?php echo htmlspecialchars($arrConfig['RelayBandwidthBurst'], ENT_QUOTES); ?>" />
</div>
</div>
</div>
<div class="row">
<div class="form-group col-lg-12">
<label for="code">Update lokinet-bootstrap settings</label>
<input type="text" class="form-control" name="loinetbootstrap" placeholder="http://206.81.100.174/n-st-5.signed" value="<?php echo htmlspecialchars($arrConfig['lokinetbootstrap'], ENT_QUOTES); ?>" />
<h5>Contact Loki user groups for the latest bootstrap file location</h5>
<input type="submit" class="btn btn-success" name="ApplyLokinetSettings" value="Apply Bootstrap" />
<?php
if( $lokinetstatus[0] == 0 ) {
echo '<input type="submit" class="btn btn-success" name="StartLokinet" value="Start Lokinet" />' , PHP_EOL;
} else {
echo '<input type="submit" class="btn btn-danger" name="StopLokient" value="Stop Lokinet" />' , PHP_EOL;
};
$filename = '/home/pi/.lokinet/lokinet.ini';
if (!file_exists($filename)) {
echo '<input tpe="submit" class="btn btn-success" name="GenerateLokinet" value="Gnerate .ini" />' , PHP_EOL;
} else {
echo '<input type="submit" class="btn btn-danger" name="ReGenerateLokinet" value="Regenerate .ini" />' , PHP_EOL;
};
?>
</div>
</div>
</div>

<div class="tab-pane fade" id="daemon">
<h4>Lokient Daemon</h4>
<div class="row">
<div class="col-lg-12">
<iframe src="includes/webconsole.php" class="webconsole"></iframe>
</div>
</div>
</div>

<div class="tab-pane fade" id="youtube">
<div class="container">
<h2>This is Loki</h2>
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/Lykh-NqkKys"></iframe>
</div>
</div>
</div>



</form>
</div><!-- /.tab-content -->
</div><!-- /.panel-body -->
<div class="panel-footer"> Information provided by Lokinet</div>
</div><!-- /.panel-primary -->
</div><!-- /.col-lg-12 -->
</div><!-- /.row -->
<?php
}

<input type="submit" class="btn btn-outline btn-primary" name="SaveTORProxySettings" value="Save settings" />
<?php
if( $torproxystatus[0] == 0 ) {
echo '<input type="submit" class="btn btn-success" name="StartTOR" value="Start TOR" />' , PHP_EOL;
} else {
echo '<input type="submit" class="btn btn-warning" name="StopTOR" value="Stop TOR" />' , PHP_EOL;
};
?>
</form>
</div><!-- /.tab-content -->
</div><!-- /.panel-body -->
<div class="panel-footer"> Information provided by tor</div>
</div><!-- /.panel-primary -->
</div><!-- /.col-lg-12 -->
</div><!-- /.row -->
<?php
}

/**
*
Expand Down Expand Up @@ -527,13 +488,13 @@ function DisplayTorProxyConfig(){
<label for="code">AutomapHostsOnResolve</label>
<input type="text" class="form-control" name="automaphostsonresolve" value="<?php echo htmlspecialchars($arrConfig['AutomapHostsOnResolve'], ENT_QUOTES); ?>" />
</div>
</div>
</div>
<div class="row">
<div class="form-group col-md-4">
<label for="code">TransListenAddress</label>
<input type="text" class="form-control" name="translistenaddress" value="<?php echo htmlspecialchars($arrConfig['TransListenAddress'], ENT_QUOTES); ?>" />
</div>
</div>
</div>
<div class="row">
<div class="form-group col-md-4">
<label for="code">DNSPort</label>
Expand Down Expand Up @@ -588,7 +549,7 @@ function DisplayTorProxyConfig(){
</div>

<input type="submit" class="btn btn-outline btn-primary" name="SaveTORProxySettings" value="Save settings" />
<?php
<?php
if( $torproxystatus[0] == 0 ) {
echo '<input type="submit" class="btn btn-success" name="StartTOR" value="Start TOR" />' , PHP_EOL;
} else {
Expand All @@ -602,7 +563,7 @@ function DisplayTorProxyConfig(){
</div><!-- /.panel-primary -->
</div><!-- /.col-lg-12 -->
</div><!-- /.row -->
<?php
<?php
}

/**
Expand Down Expand Up @@ -638,5 +599,5 @@ function SaveTORAndVPNConfig(){
foreach( $return as $line ) {
echo htmlspecialchars($line, ENT_QUOTES).'<br />' , PHP_EOL;
}
}
}
}
10 changes: 6 additions & 4 deletions includes/system.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ function DisplaySystem(){
if (CSRFValidate()) {
if(isset($_POST['locale'])) {
$_SESSION['locale'] = $_POST['locale'];
$status->addMessage('Language setting saved', 'success');
$status->addMessage('Language setting saved', 'success');
}
} else {
error_log('CSRF violation');
}
}

// define locales
// define locales
$arrLocales = array(
'en_GB.UTF-8' => 'English',
'de_DE.UTF-8' => 'Deutsch',
Expand Down Expand Up @@ -181,6 +181,9 @@ function DisplaySystem(){
<input type="submit" class="btn btn-warning" name="system_shutdown" value="<?php echo _("Shutdown"); ?>" />
<input type="button" class="btn btn-outline btn-primary" value="<?php echo _("Refresh"); ?>" onclick="document.location.reload(true)" />
</form>
<h5><?php echo _("Development Support Appreciated"); ?></h5>
<h5><?php echo _("LK8CGQ17G9R3ys3Xf33wCeViD2B95jgdpjAhcRsjuheJ784dumXn7g3RPAzedWpFq364jJKYL9dkQ8mY66sZG9BiCwrYHPmcZin1VP8Btf"); ?></h5>

</div>
</div>
</div>
Expand All @@ -200,7 +203,7 @@ function DisplaySystem(){

<div role="tabpanel" class="tab-pane" id="console">
<div class="row">
<div class="col-lg-12">
<div class="col-lg-12">
<iframe src="includes/webconsole.php" class="webconsole"></iframe>
</div>
</div>
Expand All @@ -220,4 +223,3 @@ function DisplaySystem(){
</div><!-- /.row -->
<?php
}

21 changes: 13 additions & 8 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* lighttpd (I have version 1.4.31-2 installed via apt)
* php5-cgi (I have version 5.4.4-12 installed via apt)
* along with their supporting packages, php5 will also need to be enabled.
*
*
* @author Lawrence Yau <[email protected]>
* @author Bill Zimmerman <[email protected]>
* @license GNU General Public License, version 3 (GPL-3.0)
Expand Down Expand Up @@ -118,10 +118,10 @@
<li>
<a href="index.php?page=wlan0_info"><i class="fa fa-dashboard fa-fw"></i> <?php echo _("Dashboard"); ?></a>
</li>
<?php if ( RASPI_WIFICLIENT_ENABLED ) : ?>
<?php if ( RASPI_WIFICLIENT_ENABLED ) : ?>
<li>
<a href="index.php?page=wpa_conf"><i class="fa fa-signal fa-fw"></i> <?php echo _("Configure WiFi client"); ?></a>
</li>
</li>
<?php endif; ?>
<?php if ( RASPI_HOTSPOT_ENABLED ) : ?>
<li>
Expand All @@ -131,7 +131,7 @@
<?php if ( RASPI_NETWORK_ENABLED ) : ?>
<li>
<a href="index.php?page=network_conf"><i class="fa fa-sitemap fa-fw"></i> <?php echo _("Configure networking"); ?></a>
</li>
</li>
<?php endif; ?>
<?php if ( RASPI_DHCP_ENABLED ) : ?>
<li>
Expand All @@ -143,7 +143,7 @@
<a href="index.php?page=openvpn_conf"><i class="fa fa-lock fa-fw"></i> <?php echo _("Configure OpenVPN"); ?></a>
</li>
<?php endif; ?>
<?php if ( RASPI_LOKINET_ENABLED ) : ?>
<?php if ( RASPI_LOKINET_ENABLED ) : ?>
<li>
<a href="index.php?page=lokinet_conf"><i class="fa fa-eye-slash fa-fw"></i> <?php echo _("Configure Lokinet"); ?></a>
</li>
Expand Down Expand Up @@ -171,6 +171,8 @@
<li>
<a href="index.php?page=system_info"><i class="fa fa-cube fa-fw"></i> <?php echo _("System"); ?></a>
</li>
</div>
</div>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.navbar-default -->
Expand All @@ -187,7 +189,7 @@
</div>
</div><!-- /.row -->

<?php
<?php
$extraFooterScripts = array();
// handle page actions
switch( $page ) {
Expand All @@ -209,7 +211,7 @@
case "openvpn_conf":
DisplayOpenVPNConfig();
break;
case "lokinet_conf":
case "lokinet_conf":
DisplayLokinetConfig();
break;
case "torproxy_conf":
Expand All @@ -235,7 +237,7 @@
}

?>
</div><!-- /#page-wrapper -->
</div><!-- /#page-wrapper -->
</div><!-- /#wrapper -->

<!-- RaspAP JavaScript -->
Expand All @@ -256,6 +258,9 @@
<!-- Custom RaspAP JS -->
<script src="js/custom.js"></script>




<?php
// Load non default JS/ECMAScript in footer.
foreach ($extraFooterScripts as $script) {
Expand Down
2 changes: 0 additions & 2 deletions js/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,3 @@ $().ready(function(){
break;
}
});


0 comments on commit 5313da8

Please sign in to comment.