mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
WIP: enable bind-addr control
This commit is contained in:
parent
04f62b9f0d
commit
eeccb19b35
@ -77,7 +77,8 @@ function DisplaySystem()
|
||||
}
|
||||
|
||||
if (!RASPI_MONITOR_ENABLED) {
|
||||
if (isset($_POST['SaveServerPort'])) {
|
||||
if (isset($_POST['SaveServerSettings'])) {
|
||||
// Save server port
|
||||
if (isset($_POST['serverPort'])) {
|
||||
if (strlen($_POST['serverPort']) > 4 || !is_numeric($_POST['serverPort'])) {
|
||||
$status->addMessage('Invalid value for port number', 'danger');
|
||||
@ -89,6 +90,19 @@ function DisplaySystem()
|
||||
}
|
||||
}
|
||||
}
|
||||
// Save server bind address
|
||||
if (isset($_POST['serverBind'])) {
|
||||
if (!filter_var($_POST['serverBind'], FILTER_VALIDATE_IP)) {
|
||||
$status->addMessage('Invalid value for bind address', 'danger');
|
||||
} else {
|
||||
$serverBind = escapeshellarg($_POST['serverBind']);
|
||||
//exec("sudo /etc/raspap/lighttpd/configport.sh $serverPort " .RASPI_LIGHTTPD_CONFIG. " ".$_SERVER['SERVER_NAME'], $return);
|
||||
//foreach ($return as $line) {
|
||||
// $status->addMessage($line, 'info');
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (isset($_POST['system_reboot'])) {
|
||||
$status->addMessage("System Rebooting Now!", "warning", false);
|
||||
@ -106,7 +120,8 @@ function DisplaySystem()
|
||||
}
|
||||
exec('cat '. RASPI_LIGHTTPD_CONFIG, $return);
|
||||
$conf = ParseConfig($return);
|
||||
$ServerPort = $conf['server.port'];
|
||||
$serverPort = $conf['server.port'];
|
||||
$serverBind = str_replace('"', '',$conf['server.bind']);
|
||||
|
||||
// define locales
|
||||
$arrLocales = array(
|
||||
@ -132,5 +147,5 @@ function DisplaySystem()
|
||||
'vi_VN.UTF-8' => 'Tiếng Việt (Vietnamese)'
|
||||
);
|
||||
|
||||
echo renderTemplate("system", compact("arrLocales", "status", "ServerPort"));
|
||||
echo renderTemplate("system", compact("arrLocales", "status", "serverPort", "serverBind"));
|
||||
}
|
||||
|
@ -1,12 +1,20 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Updates lighttpd server.port and restarts the service
|
||||
# Updates lighttpd config settings and restarts the service
|
||||
# @author billz
|
||||
# license: GNU General Public License v3.0
|
||||
|
||||
# Exit on error
|
||||
set -o errexit
|
||||
# Exit on error inside functions
|
||||
set -o errtrace
|
||||
# Turn on traces, disabled by default
|
||||
#set -o xtrace
|
||||
|
||||
server_port=$1
|
||||
lighttpd_conf=$2
|
||||
host=$3
|
||||
server_bind=$2
|
||||
lighttpd_conf=$3
|
||||
host=$4
|
||||
restart_service=0
|
||||
|
||||
while :; do
|
||||
|
@ -533,6 +533,12 @@ msgstr "System Rebooting Now!"
|
||||
msgid "System Shutting Down Now!"
|
||||
msgstr "System Shutting Down Now!"
|
||||
|
||||
msgid "Web server port"
|
||||
msgstr "Web server port"
|
||||
|
||||
msgid "Web server bind address"
|
||||
msgstr "Web server bind address"
|
||||
|
||||
#: includes/themes.php
|
||||
msgid "Theme settings"
|
||||
msgstr "Theme settings"
|
||||
|
@ -1,18 +1,25 @@
|
||||
<!-- advanced tab -->
|
||||
<div role="tabpanel" class="tab-pane" id="advanced">
|
||||
<div role="tabpanel" class="tab-pane" id="advanced">
|
||||
<h4 class="mt-3"><?php echo _("Advanced settings") ;?></h4>
|
||||
<?php if (!RASPI_MONITOR_ENABLED) : ?>
|
||||
<form action="?page=system_info" method="POST">
|
||||
<?php echo CSRFTokenFieldTag() ?>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="code"><?php echo _("Web server port") ;?></label>
|
||||
<form action="?page=system_info" method="POST">
|
||||
<?php echo CSRFTokenFieldTag() ?>
|
||||
<?php if (!RASPI_MONITOR_ENABLED) : ?>
|
||||
<input type="text" class="form-control" name="serverPort" value="<?php echo htmlspecialchars($ServerPort, ENT_QUOTES); ?>" />
|
||||
<?php endif ?>
|
||||
<input type="text" class="form-control" name="serverPort" value="<?php echo htmlspecialchars($serverPort, ENT_QUOTES); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<input type="submit" class="btn btn-outline btn-primary" name="SaveServerPort" value="<?php echo _("Save settings"); ?>" />
|
||||
<div class="row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="code"><?php echo _("Web server bind address") ;?></label>
|
||||
<input type="text" class="form-control" name="serverBind" value="<?php echo htmlspecialchars($serverBind, ENT_QUOTES); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<input type="submit" class="btn btn-outline btn-primary" name="SaveServerSettings" value="<?php echo _("Save settings"); ?>" />
|
||||
<input type="submit" class="btn btn-warning" name="RestartLighttpd" value="<?php echo _("Restart lighttpd"); ?>" />
|
||||
</div>
|
||||
</form>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user