mirror of
https://github.com/unraid/webgui.git
synced 2025-12-31 22:50:25 -06:00
88 lines
3.5 KiB
Plaintext
88 lines
3.5 KiB
Plaintext
Menu="NetworkSettings"
|
|
Title="Interface Extra"
|
|
Tag="icon-custom"
|
|
---
|
|
<?php
|
|
/* Copyright 2005-2025, Lime Technology
|
|
* Copyright 2012-2025, Bergware International.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License version 2,
|
|
* as published by the Free Software Foundation.
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*/
|
|
?>
|
|
<?php
|
|
$cfg = '/boot/config/network-extra.cfg';
|
|
|
|
if (file_exists($cfg)) {
|
|
extract(parse_ini_file($cfg));
|
|
$include_interfaces = str_replace(" ", "\n", $include_interfaces);
|
|
$exclude_interfaces = str_replace(" ", "\n", $exclude_interfaces);
|
|
} else {
|
|
$include_interfaces = "";
|
|
$exclude_interfaces = "";
|
|
}
|
|
?>
|
|
<script>
|
|
function prepareText(form) {
|
|
var mgmt = ['br0','bond0','eth0','wlan0'];
|
|
form.include_interfaces.value = form.include.value.replace(/[\n,]/g,' ').replace(/ +/g,' ').trim();
|
|
form.exclude_interfaces.value = form.exclude.value.replace(/[\n,]/g,' ').replace(/ +/g,' ').trim();
|
|
form.include.disabled = true;
|
|
form.exclude.disabled = true;
|
|
var include = form.include_interfaces.value.split(' ');
|
|
var exclude = form.exclude_interfaces.value.split(' ');
|
|
// silently remove management interfaces from include list
|
|
for (var i=0,name; name=include[i]; i++) {
|
|
if (mgmt.includes(name)) include[i] = '';
|
|
}
|
|
form.include_interfaces.value = include.join(' ').replace(/ +/g,' ').trim();
|
|
// give warning when management interface is excluded
|
|
for (var i=0,name; name=exclude[i]; i++) {
|
|
if (mgmt.includes(name)) {
|
|
swal({title:"_(Management Interface)_ '"+name+"'",text:"_(You can not exclude this interface)_",type:'error',html:true,confirmButtonText:"_(Ok)_"});
|
|
form.include.disabled = false;
|
|
form.exclude.disabled = false;
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
$(function(){
|
|
$('form textarea').on('input',function(){
|
|
$(this).prop('rows',($(this).val().match(/\n/g)||[]).length+1);
|
|
});
|
|
setInterval(function(){$.post('/webGui/include/NetworkInfo.php',{listen:'listen'},function(text) {$('#listen').html(text);});},5000);
|
|
});
|
|
</script>
|
|
|
|
<form markdown="1" name="network_extra" method="POST" action="/update.php" target="progressFrame" onsubmit="return prepareText(this)">
|
|
<input type="hidden" name="#file" value="<?=$cfg?>">
|
|
<input type="hidden" name="#command" value="/webGui/scripts/update_services">
|
|
<input type="hidden" name="include_interfaces" value="">
|
|
<input type="hidden" name="exclude_interfaces" value="">
|
|
|
|
_(Current listening interfaces)_:
|
|
: <span id="listen"><?=exec("$docroot/webGui/scripts/show_interfaces") ?: _('Any')?></span><span class="red-text" style="margin-left:30px"><?=exec("$docroot/webGui/scripts/error_interfaces")?></span>
|
|
|
|
_(Include listening interfaces)_:
|
|
: <textarea name="include" spellcheck="false" cols="80" rows="<?=substr_count($include_interfaces, "\n") + 1?>" maxlength="2048" name="text" class="resize-none"><?=htmlspecialchars($include_interfaces)?></textarea>
|
|
|
|
:eth_network_extra_include_help:
|
|
|
|
_(Exclude listening interfaces)_:
|
|
: <textarea name="exclude" spellcheck="false" cols="80" rows="<?=substr_count($exclude_interfaces, "\n") + 1?>" maxlength="2048" name="text" class="resize-none"><?=htmlspecialchars($exclude_interfaces)?></textarea>
|
|
|
|
:eth_network_extra_exclude_help:
|
|
|
|
|
|
: <span class="inline-block">
|
|
<input type="submit" value="_(Apply)_" disabled>
|
|
<input type="button" value="_(Done)_" onclick="done()">
|
|
</span>
|
|
</form>
|