* Sat Sep 27 2025 Brian Read <brianr@koozali.org> 2.0.4-24.sme
- Fix crash in network scan [SME: 13180] - Remove spinners as no longer necessary [SME: 13189]
This commit is contained in:
@@ -483,16 +483,28 @@ sub get_mac_address {
|
||||
open(my $fh, '<', $file) or die "Could not open file '$file' $!";
|
||||
my $mac_address = undef;
|
||||
my $lease_block;
|
||||
while(my $line = <$fh>) {
|
||||
if($line =~ /lease $ip {/ .. $line =~ /}/) {
|
||||
$lease_block .= $line;
|
||||
if($line =~ /}/) {
|
||||
if($lease_block =~ /hardware ethernet (\S+);/) {
|
||||
$mac_address = $1;
|
||||
last;
|
||||
} else {
|
||||
$lease_block = '';
|
||||
my $in_lease;
|
||||
while (my $line = <$fh>) {
|
||||
# Start of the lease block for the requested IP
|
||||
if ($line =~ /^lease\s+\Q$ip\E\s*{/) {
|
||||
$in_lease = 1;
|
||||
$lease_block = $line;
|
||||
next;
|
||||
}
|
||||
# If inside the lease block, accumulate lines
|
||||
if ($in_lease) {
|
||||
$lease_block .= $line;
|
||||
|
||||
# Look for hardware ethernet line to capture MAC
|
||||
if ($line =~ /hardware ethernet\s+(\S+);/) {
|
||||
$mac_address = $1;
|
||||
}
|
||||
|
||||
# End of lease block
|
||||
if ($line =~ /^}/) {
|
||||
$in_lease = 0;
|
||||
last if $mac_address; # Exit if MAC found
|
||||
$lease_block = ''; # Reset if MAC not found
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -700,5 +712,3 @@ sub Perform_Wake_Up($){
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
||||
|
@@ -56,7 +56,7 @@
|
||||
'dhcpd_REMOVE' => 'Remove',
|
||||
'dhcpd_SAVE/RESTART' => 'Save/Restart',
|
||||
'dhcpd_SAVE_TITLE' => 'After changing settings above, you must save and restart dhcpd.',
|
||||
'dhcpd_SCANNING_NETWORK_TITLE' => 'Scanning your network, the time needed depends of your subnet mask',
|
||||
'dhcpd_SCANNING_NETWORK_TITLE' => 'Scanning your network, the time needed depends on your subnet mask',
|
||||
'dhcpd_SCAN_YOUR_NETWORK' => 'Scan your network',
|
||||
'dhcpd_SCAN_YOUR_NETWORK_TITLE' => 'Scan your network to show active devices :',
|
||||
'dhcpd_SECONDARY_DNS_ADDRESS' => 'Secondary DNS',
|
||||
|
28
root/usr/share/smanager/themes/default/public/js/dhcpd.js
Normal file
28
root/usr/share/smanager/themes/default/public/js/dhcpd.js
Normal file
@@ -0,0 +1,28 @@
|
||||
function Wol_confirm(event,msg,current){
|
||||
const getMAC = /.*MAC\=(.*)\&name.*/;
|
||||
var MAC = current.href.match(getMAC)[1];
|
||||
if (confirm(msg+": MAC: "+MAC))
|
||||
{ return true;}
|
||||
else {event.preventDefault();return false;}
|
||||
}
|
||||
|
||||
function Winpop_confirm(event,msg,current){
|
||||
const getIP = /.*ip\=(.*)/;
|
||||
var IP = ": IP: "+current.href.match(getIP)[1];
|
||||
msg = msg.replace("$",IP);
|
||||
var retVal = prompt(msg);
|
||||
if (retVal) {
|
||||
//Write it away in a hidden field
|
||||
$hidden = document.getElementById("hiddenMsg");
|
||||
$hidden.value = retVal;
|
||||
return true;
|
||||
} else {event.preventDefault();return false;}
|
||||
}
|
||||
|
||||
function Remove_lease_confirm(event,msg,current){
|
||||
const getIP = /.*ip\=(.*)/;
|
||||
var IP = current.href.match(getIP)[1];
|
||||
if (confirm(msg+" IP: "+IP))
|
||||
{ return true;}
|
||||
else {event.preventDefault();return false;}
|
||||
}
|
@@ -20,8 +20,6 @@
|
||||
|
||||
%} elsif ($dhcp_data->{success}) {
|
||||
<div class='sme-border'>
|
||||
<h2> Operation Status Report - success</h2><p>
|
||||
<font color=green>
|
||||
%= $c->l($dhcp_data->{success});
|
||||
</font>
|
||||
</p>
|
||||
@@ -29,7 +27,6 @@
|
||||
|
||||
%} elsif ($dhcp_data->{error}) {
|
||||
<div class='sme-error'>
|
||||
<h2> Operation Status Report - error</h2><p>
|
||||
<font color=red>
|
||||
%= $c->l($dhcp_data->{error});
|
||||
</font>
|
||||
@@ -38,7 +35,6 @@
|
||||
|
||||
%} elsif ($dhcp_data->{error}) {
|
||||
<div class='sme-warning'>
|
||||
<h2> Operation Status Report - warning</h2><p>
|
||||
<font color=orange>
|
||||
%= $c->l($dhcp_data->{error});
|
||||
</font>
|
||||
@@ -56,17 +52,9 @@
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
%= button_to $c->l('dhcpd_CONNECTED_IP') => '/dhcpd1', onclick=>"showSpinnerLeases()", id=>"scanLeases"
|
||||
<button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="load" style="display:none">
|
||||
Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')-->
|
||||
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
</button>
|
||||
%= button_to $c->l('dhcpd_CONNECTED_IP') => '/dhcpd1', id=>"scanLeases"
|
||||
</td><td>
|
||||
%= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3', onclick=>"showSpinnerNetwork()", id=>"scanNetwork"
|
||||
<button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="loadingNetwork" style="display:none">
|
||||
Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')-->
|
||||
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
</button>
|
||||
%= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3', id=>"scanNetwork"
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -179,41 +167,5 @@
|
||||
%}
|
||||
|
||||
</div>
|
||||
|
||||
%= javascript begin
|
||||
if (document.getElementById("load")){document.getElementById("load").style.display="none";}
|
||||
if (document.getElementById("loadingNetwork")){document.getElementById("loadingNetwork").style.display="none";}
|
||||
|
||||
function showSpinnerLeases(){
|
||||
document.getElementById("scanLeases").style.display="none";
|
||||
document.getElementById("load").style.display="inline";
|
||||
}
|
||||
|
||||
function showSpinnerNetwork(){
|
||||
document.getElementById("scanNetwork").style.display="none";
|
||||
document.getElementById("loadingNetwork").style.display="inline";
|
||||
}
|
||||
%end
|
||||
|
||||
%= stylesheet begin
|
||||
.spinnerButtonOverlay,
|
||||
.spinnerButtonOverlay:hover,
|
||||
.spinnerButtonOverlay:any-link ,
|
||||
.spinnerButtonOverlay:focus ,
|
||||
.spinnerButtonOverlay:active {
|
||||
appearance: auto;
|
||||
user-select: none;
|
||||
align-items: flex-start;
|
||||
cursor: default;
|
||||
box-sizing: border-box;
|
||||
background-color: #efefef;
|
||||
color: black;
|
||||
padding: 1px 6px;
|
||||
border-width: 2px;
|
||||
border-style: outset;
|
||||
border-color: darkgrey;
|
||||
border-image: initial;
|
||||
}
|
||||
%end
|
||||
%end
|
||||
1;
|
@@ -1,11 +1,6 @@
|
||||
<div id='dhcpd-leases'>
|
||||
<table><tr><td>
|
||||
%= button_to $c->l('dhcpd_REFRESH') => '/dhcpd1', onclick=>"showSpinnerLeases()", id=>"scanLeases"
|
||||
<button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="load" style="display:true">
|
||||
Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')-->
|
||||
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
</button>
|
||||
|
||||
%= button_to $c->l('dhcpd_REFRESH') => '/dhcpd1', id=>"scanLeases"
|
||||
</td><td>
|
||||
%= button_to $c->l('dhcpd_REMOVE_ALL_LEASES') => '/dhcpd4'
|
||||
</td>
|
||||
@@ -77,37 +72,4 @@
|
||||
<br />
|
||||
%= button_to $c->l('dhcpd_CLICK_HERE_TO_MAIN_PANEL') => '/dhcpd'
|
||||
|
||||
%= javascript begin
|
||||
function Wol_confirm(event,msg,current){
|
||||
const getMAC = /.*MAC\=(.*)\&name.*/;
|
||||
var MAC = current.href.match(getMAC)[1];
|
||||
if (confirm(msg+": MAC: "+MAC))
|
||||
{ return true;}
|
||||
else {event.preventDefault();return false;}
|
||||
}
|
||||
|
||||
function Winpop_confirm(event,msg,current){
|
||||
const getIP = /.*ip\=(.*)/;
|
||||
var IP = ": IP: "+current.href.match(getIP)[1];
|
||||
msg = msg.replace("$",IP);
|
||||
var retVal = prompt(msg);
|
||||
if (retVal) {
|
||||
//Write it away in a hidden field
|
||||
$hidden = document.getElementById("hiddenMsg");
|
||||
$hidden.value = retVal;
|
||||
return true;
|
||||
} else {event.preventDefault();return false;}
|
||||
}
|
||||
|
||||
function Remove_lease_confirm(event,msg,current){
|
||||
const getIP = /.*ip\=(.*)/;
|
||||
var IP = current.href.match(getIP)[1];
|
||||
if (confirm(msg+" IP: "+IP))
|
||||
{ return true;}
|
||||
else {event.preventDefault();return false;}
|
||||
}
|
||||
|
||||
%end
|
||||
|
||||
|
||||
</div>
|
@@ -1,11 +1,6 @@
|
||||
<div id='dhcpd-scan'>
|
||||
<table><tr><td>
|
||||
%= button_to $c->l('dhcpd_REFRESH') => '/dhcpd3', onclick=>"showSpinnerNetwork1()", id=>"scanNetwork1"
|
||||
<button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="loadingNetwork1" style="display:true">
|
||||
Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')-->
|
||||
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
</button>
|
||||
|
||||
%= button_to $c->l('dhcpd_REFRESH') => '/dhcpd3', id=>"scanNetwork1"
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -37,27 +32,4 @@
|
||||
%= hidden_field "hiddenmsg"=>"", id=>"hiddenmsg"
|
||||
<br />
|
||||
%= button_to $c->l('dhcpd_CLICK_HERE_TO_MAIN_PANEL') => '/dhcpd'
|
||||
|
||||
%= javascript begin
|
||||
function Wol_confirm(event,msg,current){
|
||||
const getMAC = /.*MAC\=(.*)\&name.*/;
|
||||
var MAC = current.href.match(getMAC)[1];
|
||||
if (confirm(msg+": MAC: "+MAC))
|
||||
{ return true;}
|
||||
else {event.preventDefault();return false;}
|
||||
}
|
||||
|
||||
|
||||
%end
|
||||
|
||||
|
||||
</div>
|
||||
%= javascript begin
|
||||
document.getElementById("loadingNetwork1").style.display="none";
|
||||
|
||||
function showSpinnerNetwork1(){
|
||||
document.getElementById("scanNetwork1").style.display="none";
|
||||
document.getElementById("loadingNetwork1").style.display="inline";
|
||||
}
|
||||
|
||||
%end
|
||||
|
@@ -1,6 +1,6 @@
|
||||
%define name smeserver-dhcpmanager
|
||||
%define version 2.0.4
|
||||
%define release 23
|
||||
%define release 24
|
||||
|
||||
Summary: provide a dhcp panel in the server-manager for The SME Server
|
||||
Name: %{name}
|
||||
@@ -25,6 +25,10 @@ AutoReqProv: no
|
||||
Implementation of some feature arround dhcp clients like : wol, cleaning dhcpd.leases, Scan of your network etc//
|
||||
|
||||
%changelog
|
||||
* Sat Sep 27 2025 Brian Read <brianr@koozali.org> 2.0.4-24.sme
|
||||
- Fix crash in network scan [SME: 13180]
|
||||
- Remove spinners as no longer necessary [SME: 13189]
|
||||
|
||||
* Wed Sep 24 2025 Brian Read <brianr@koozali.org> 2.0.4-23.sme
|
||||
- Sort out archive on git stopping local archive update [SME: 13171]
|
||||
|
||||
|
Reference in New Issue
Block a user