Merge pull request #10 from necro-nemesis/Customization

Tweaks and changes to the UI
pull/11/head 1.41a1
necro-nemesis 5 years ago committed by GitHub
commit 5313da8720
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -33,4 +33,4 @@ define('RASPI_VNSTAT_ENABLED', true );
// Locale settings // Locale settings
define('LOCALE_ROOT', 'locale'); define('LOCALE_ROOT', 'locale');
define('LOCALE_DOMAIN', 'messages'); define('LOCALE_DOMAIN', 'messages');

@ -60,7 +60,7 @@ function DisplayDashboard(){
preg_match('/state (UP|DOWN)/i', $stdoutIpWRepeatedSpaces, $matchesState ) || $matchesState[1] = 'unknown'; preg_match('/state (UP|DOWN)/i', $stdoutIpWRepeatedSpaces, $matchesState ) || $matchesState[1] = 'unknown';
$interfaceState = $matchesState[1]; $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. // 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); exec('cat /sys/class/net/'.RASPI_WIFI_CLIENT_INTERFACE.'/statistics/rx_packets ', $stdoutCatRxPackets);
$strRxPackets = _('No data'); $strRxPackets = _('No data');
@ -126,7 +126,7 @@ function DisplayDashboard(){
preg_match('/txpower ([0-9\.]+ dBm)/i', $stdoutIpInfoWRepSpaces, $matchesTxPower ) || $matchesTxPower[1] = ''; preg_match('/txpower ([0-9\.]+ dBm)/i', $stdoutIpInfoWRepSpaces, $matchesTxPower ) || $matchesTxPower[1] = '';
$txPower = $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. // and depends on the driver and hardware.
// Display link quality as signal quality for now. // Display link quality as signal quality for now.
$strLinkQuality = 0; $strLinkQuality = 0;
@ -173,7 +173,7 @@ function DisplayDashboard(){
} }
} else { } else {
$status->addMessage(sprintf(_('Interface is %s.'), strtolower($interfaceState)), $classMsgDevicestatus); $status->addMessage(sprintf(_('Interface is %s.'), strtolower($interfaceState)), $classMsgDevicestatus);
} }
?> ?>
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
@ -274,4 +274,3 @@ function getHumanReadableDatasize($numbytes, $precision = 2)
return $humanDatasize; return $humanDatasize;
} }

@ -262,7 +262,7 @@ function DisplayOpenVPNConfig() {
<h4>Server settings</h4> <h4>Server settings</h4>
<div class="row"> <div class="row">
<div class="form-group col-md-4"> <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); ?>" /> <input type="text" class="form-control" name="openvpn_port" value="<?php echo htmlspecialchars($arrServerConfig['port'], ENT_QUOTES); ?>" />
</div> </div>
</div> </div>
@ -350,14 +350,16 @@ function DisplayLokinetConfig(){
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<div class="panel panel-primary"> <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 --> <!-- /.panel-heading -->
<div class="panel-body"> <div class="panel-body">
<!-- Nav tabs --> <!-- Nav tabs -->
<ul class="nav 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>
<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> </li>
</ul> </ul>
@ -368,100 +370,59 @@ function DisplayLokinetConfig(){
<div class="tab-pane fade in active" id="basic"> <div class="tab-pane fade in active" id="basic">
<h4>Basic settings</h4> <h4>Basic settings</h4>
<form role="form" action="?page=save_hostapd_conf" method="POST"> <form role="form" action="?page=save_hostapd_conf" method="POST">
<div class="row"> <div class="row">
<div class="form-group col-md-4"> <div class="form-group col-lg-12">
<label for="code">VirtualAddrNetwork</label> <label for="code">Update lokinet-bootstrap settings</label>
<input type="text" class="form-control" name="virtualaddrnetwork" value="<?php echo htmlspecialchars($arrConfig['VirtualAddrNetwork'], ENT_QUOTES); ?>" /> <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); ?>" />
</div> <h5>Contact Loki user groups for the latest bootstrap file location</h5>
</div> <input type="submit" class="btn btn-success" name="ApplyLokinetSettings" value="Apply Bootstrap" />
<div class="row"> <?php
<div class="form-group col-md-4"> if( $lokinetstatus[0] == 0 ) {
<label for="code">AutomapHostsSuffixes</label> echo '<input type="submit" class="btn btn-success" name="StartLokinet" value="Start Lokinet" />' , PHP_EOL;
<input type="text" class="form-control" name="automaphostssuffixes" value="<?php echo htmlspecialchars($arrConfig['AutomapHostsSuffixes'], ENT_QUOTES); ?>" /> } else {
</div> echo '<input type="submit" class="btn btn-danger" name="StopLokient" value="Stop Lokinet" />' , PHP_EOL;
</div> };
<div class="row"> $filename = '/home/pi/.lokinet/lokinet.ini';
<div class="form-group col-md-4"> if (!file_exists($filename)) {
<label for="code">AutomapHostsOnResolve</label> echo '<input tpe="submit" class="btn btn-success" name="GenerateLokinet" value="Gnerate .ini" />' , PHP_EOL;
<input type="text" class="form-control" name="automaphostsonresolve" value="<?php echo htmlspecialchars($arrConfig['AutomapHostsOnResolve'], ENT_QUOTES); ?>" /> } else {
</div> echo '<input type="submit" class="btn btn-danger" name="ReGenerateLokinet" value="Regenerate .ini" />' , PHP_EOL;
</div> };
<div class="row"> ?>
<div class="form-group col-md-4"> </div>
<label for="code">TransListenAddress</label> </div>
<input type="text" class="form-control" name="translistenaddress" value="<?php echo htmlspecialchars($arrConfig['TransListenAddress'], ENT_QUOTES); ?>" /> </div>
</div>
</div> <div class="tab-pane fade" id="daemon">
<div class="row"> <h4>Lokient Daemon</h4>
<div class="form-group col-md-4"> <div class="row">
<label for="code">DNSPort</label> <div class="col-lg-12">
<input type="text" class="form-control" name="dnsport" value="<?php echo htmlspecialchars($arrConfig['DNSPort'], ENT_QUOTES); ?>" /> <iframe src="includes/webconsole.php" class="webconsole"></iframe>
</div> </div>
</div> </div>
<div class="row"> </div>
<div class="form-group col-md-4">
<label for="code">DNSListenAddress</label> <div class="tab-pane fade" id="youtube">
<input type="text" class="form-control" name="dnslistenaddress" value="<?php echo htmlspecialchars($arrConfig['DNSListenAddress'], ENT_QUOTES); ?>" /> <div class="container">
</div> <h2>This is Loki</h2>
</div> <div class="embed-responsive embed-responsive-16by9">
</div> <iframe class="embed-responsive-item" src="https://www.youtube.com/embed/Lykh-NqkKys"></iframe>
<div class="tab-pane fade" id="relay"> </div>
<h4>Relay settings</h4> </div>
<div class="row"> </div>
<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> </form>
</div> </div><!-- /.tab-content -->
<div class="row"> </div><!-- /.panel-body -->
<div class="form-group col-md-4"> <div class="panel-footer"> Information provided by Lokinet</div>
<label for="code">ORListenAddress</label> </div><!-- /.panel-primary -->
<input type="text" class="form-control" name="orlistenaddress" value="<?php echo htmlspecialchars($arrConfig['ORListenAddress'], ENT_QUOTES); ?>" /> </div><!-- /.col-lg-12 -->
</div> </div><!-- /.row -->
</div> <?php
<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>
<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
}
/** /**
* *
@ -527,13 +488,13 @@ function DisplayTorProxyConfig(){
<label for="code">AutomapHostsOnResolve</label> <label for="code">AutomapHostsOnResolve</label>
<input type="text" class="form-control" name="automaphostsonresolve" value="<?php echo htmlspecialchars($arrConfig['AutomapHostsOnResolve'], ENT_QUOTES); ?>" /> <input type="text" class="form-control" name="automaphostsonresolve" value="<?php echo htmlspecialchars($arrConfig['AutomapHostsOnResolve'], ENT_QUOTES); ?>" />
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="code">TransListenAddress</label> <label for="code">TransListenAddress</label>
<input type="text" class="form-control" name="translistenaddress" value="<?php echo htmlspecialchars($arrConfig['TransListenAddress'], ENT_QUOTES); ?>" /> <input type="text" class="form-control" name="translistenaddress" value="<?php echo htmlspecialchars($arrConfig['TransListenAddress'], ENT_QUOTES); ?>" />
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="code">DNSPort</label> <label for="code">DNSPort</label>
@ -588,7 +549,7 @@ function DisplayTorProxyConfig(){
</div> </div>
<input type="submit" class="btn btn-outline btn-primary" name="SaveTORProxySettings" value="Save settings" /> <input type="submit" class="btn btn-outline btn-primary" name="SaveTORProxySettings" value="Save settings" />
<?php <?php
if( $torproxystatus[0] == 0 ) { if( $torproxystatus[0] == 0 ) {
echo '<input type="submit" class="btn btn-success" name="StartTOR" value="Start TOR" />' , PHP_EOL; echo '<input type="submit" class="btn btn-success" name="StartTOR" value="Start TOR" />' , PHP_EOL;
} else { } else {
@ -602,7 +563,7 @@ function DisplayTorProxyConfig(){
</div><!-- /.panel-primary --> </div><!-- /.panel-primary -->
</div><!-- /.col-lg-12 --> </div><!-- /.col-lg-12 -->
</div><!-- /.row --> </div><!-- /.row -->
<?php <?php
} }
/** /**
@ -638,5 +599,5 @@ function SaveTORAndVPNConfig(){
foreach( $return as $line ) { foreach( $return as $line ) {
echo htmlspecialchars($line, ENT_QUOTES).'<br />' , PHP_EOL; echo htmlspecialchars($line, ENT_QUOTES).'<br />' , PHP_EOL;
} }
} }
} }

@ -64,14 +64,14 @@ function DisplaySystem(){
if (CSRFValidate()) { if (CSRFValidate()) {
if(isset($_POST['locale'])) { if(isset($_POST['locale'])) {
$_SESSION['locale'] = $_POST['locale']; $_SESSION['locale'] = $_POST['locale'];
$status->addMessage('Language setting saved', 'success'); $status->addMessage('Language setting saved', 'success');
} }
} else { } else {
error_log('CSRF violation'); error_log('CSRF violation');
} }
} }
// define locales // define locales
$arrLocales = array( $arrLocales = array(
'en_GB.UTF-8' => 'English', 'en_GB.UTF-8' => 'English',
'de_DE.UTF-8' => 'Deutsch', 'de_DE.UTF-8' => 'Deutsch',
@ -181,6 +181,9 @@ function DisplaySystem(){
<input type="submit" class="btn btn-warning" name="system_shutdown" value="<?php echo _("Shutdown"); ?>" /> <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)" /> <input type="button" class="btn btn-outline btn-primary" value="<?php echo _("Refresh"); ?>" onclick="document.location.reload(true)" />
</form> </form>
<h5><?php echo _("Development Support Appreciated"); ?></h5>
<h5><?php echo _("LK8CGQ17G9R3ys3Xf33wCeViD2B95jgdpjAhcRsjuheJ784dumXn7g3RPAzedWpFq364jJKYL9dkQ8mY66sZG9BiCwrYHPmcZin1VP8Btf"); ?></h5>
</div> </div>
</div> </div>
</div> </div>
@ -200,7 +203,7 @@ function DisplaySystem(){
<div role="tabpanel" class="tab-pane" id="console"> <div role="tabpanel" class="tab-pane" id="console">
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<iframe src="includes/webconsole.php" class="webconsole"></iframe> <iframe src="includes/webconsole.php" class="webconsole"></iframe>
</div> </div>
</div> </div>
@ -220,4 +223,3 @@ function DisplaySystem(){
</div><!-- /.row --> </div><!-- /.row -->
<?php <?php
} }

@ -9,7 +9,7 @@
* lighttpd (I have version 1.4.31-2 installed via apt) * lighttpd (I have version 1.4.31-2 installed via apt)
* php5-cgi (I have version 5.4.4-12 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. * along with their supporting packages, php5 will also need to be enabled.
* *
* @author Lawrence Yau <sirlagz@gmail.com> * @author Lawrence Yau <sirlagz@gmail.com>
* @author Bill Zimmerman <billzimmerman@gmail.com> * @author Bill Zimmerman <billzimmerman@gmail.com>
* @license GNU General Public License, version 3 (GPL-3.0) * @license GNU General Public License, version 3 (GPL-3.0)
@ -118,10 +118,10 @@ $theme_url = 'dist/css/'.htmlspecialchars($theme, ENT_QUOTES);
<li> <li>
<a href="index.php?page=wlan0_info"><i class="fa fa-dashboard fa-fw"></i> <?php echo _("Dashboard"); ?></a> <a href="index.php?page=wlan0_info"><i class="fa fa-dashboard fa-fw"></i> <?php echo _("Dashboard"); ?></a>
</li> </li>
<?php if ( RASPI_WIFICLIENT_ENABLED ) : ?> <?php if ( RASPI_WIFICLIENT_ENABLED ) : ?>
<li> <li>
<a href="index.php?page=wpa_conf"><i class="fa fa-signal fa-fw"></i> <?php echo _("Configure WiFi client"); ?></a> <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 endif; ?>
<?php if ( RASPI_HOTSPOT_ENABLED ) : ?> <?php if ( RASPI_HOTSPOT_ENABLED ) : ?>
<li> <li>
@ -131,7 +131,7 @@ $theme_url = 'dist/css/'.htmlspecialchars($theme, ENT_QUOTES);
<?php if ( RASPI_NETWORK_ENABLED ) : ?> <?php if ( RASPI_NETWORK_ENABLED ) : ?>
<li> <li>
<a href="index.php?page=network_conf"><i class="fa fa-sitemap fa-fw"></i> <?php echo _("Configure networking"); ?></a> <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 endif; ?>
<?php if ( RASPI_DHCP_ENABLED ) : ?> <?php if ( RASPI_DHCP_ENABLED ) : ?>
<li> <li>
@ -143,7 +143,7 @@ $theme_url = 'dist/css/'.htmlspecialchars($theme, ENT_QUOTES);
<a href="index.php?page=openvpn_conf"><i class="fa fa-lock fa-fw"></i> <?php echo _("Configure OpenVPN"); ?></a> <a href="index.php?page=openvpn_conf"><i class="fa fa-lock fa-fw"></i> <?php echo _("Configure OpenVPN"); ?></a>
</li> </li>
<?php endif; ?> <?php endif; ?>
<?php if ( RASPI_LOKINET_ENABLED ) : ?> <?php if ( RASPI_LOKINET_ENABLED ) : ?>
<li> <li>
<a href="index.php?page=lokinet_conf"><i class="fa fa-eye-slash fa-fw"></i> <?php echo _("Configure Lokinet"); ?></a> <a href="index.php?page=lokinet_conf"><i class="fa fa-eye-slash fa-fw"></i> <?php echo _("Configure Lokinet"); ?></a>
</li> </li>
@ -171,6 +171,8 @@ $theme_url = 'dist/css/'.htmlspecialchars($theme, ENT_QUOTES);
<li> <li>
<a href="index.php?page=system_info"><i class="fa fa-cube fa-fw"></i> <?php echo _("System"); ?></a> <a href="index.php?page=system_info"><i class="fa fa-cube fa-fw"></i> <?php echo _("System"); ?></a>
</li> </li>
</div>
</div>
</ul> </ul>
</div><!-- /.navbar-collapse --> </div><!-- /.navbar-collapse -->
</div><!-- /.navbar-default --> </div><!-- /.navbar-default -->
@ -187,7 +189,7 @@ $theme_url = 'dist/css/'.htmlspecialchars($theme, ENT_QUOTES);
</div> </div>
</div><!-- /.row --> </div><!-- /.row -->
<?php <?php
$extraFooterScripts = array(); $extraFooterScripts = array();
// handle page actions // handle page actions
switch( $page ) { switch( $page ) {
@ -209,7 +211,7 @@ $extraFooterScripts = array();
case "openvpn_conf": case "openvpn_conf":
DisplayOpenVPNConfig(); DisplayOpenVPNConfig();
break; break;
case "lokinet_conf": case "lokinet_conf":
DisplayLokinetConfig(); DisplayLokinetConfig();
break; break;
case "torproxy_conf": case "torproxy_conf":
@ -235,7 +237,7 @@ $extraFooterScripts = array();
} }
?> ?>
</div><!-- /#page-wrapper --> </div><!-- /#page-wrapper -->
</div><!-- /#wrapper --> </div><!-- /#wrapper -->
<!-- RaspAP JavaScript --> <!-- RaspAP JavaScript -->
@ -256,6 +258,9 @@ $extraFooterScripts = array();
<!-- Custom RaspAP JS --> <!-- Custom RaspAP JS -->
<script src="js/custom.js"></script> <script src="js/custom.js"></script>
<?php <?php
// Load non default JS/ECMAScript in footer. // Load non default JS/ECMAScript in footer.
foreach ($extraFooterScripts as $script) { foreach ($extraFooterScripts as $script) {

@ -148,5 +148,3 @@ $().ready(function(){
break; break;
} }
}); });

Loading…
Cancel
Save