* 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' $!";
|
open(my $fh, '<', $file) or die "Could not open file '$file' $!";
|
||||||
my $mac_address = undef;
|
my $mac_address = undef;
|
||||||
my $lease_block;
|
my $lease_block;
|
||||||
while(my $line = <$fh>) {
|
my $in_lease;
|
||||||
if($line =~ /lease $ip {/ .. $line =~ /}/) {
|
while (my $line = <$fh>) {
|
||||||
$lease_block .= $line;
|
# Start of the lease block for the requested IP
|
||||||
if($line =~ /}/) {
|
if ($line =~ /^lease\s+\Q$ip\E\s*{/) {
|
||||||
if($lease_block =~ /hardware ethernet (\S+);/) {
|
$in_lease = 1;
|
||||||
$mac_address = $1;
|
$lease_block = $line;
|
||||||
last;
|
next;
|
||||||
} else {
|
|
||||||
$lease_block = '';
|
|
||||||
}
|
}
|
||||||
|
# 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;
|
1;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -56,7 +56,7 @@
|
|||||||
'dhcpd_REMOVE' => 'Remove',
|
'dhcpd_REMOVE' => 'Remove',
|
||||||
'dhcpd_SAVE/RESTART' => 'Save/Restart',
|
'dhcpd_SAVE/RESTART' => 'Save/Restart',
|
||||||
'dhcpd_SAVE_TITLE' => 'After changing settings above, you must save and restart dhcpd.',
|
'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' => 'Scan your network',
|
||||||
'dhcpd_SCAN_YOUR_NETWORK_TITLE' => 'Scan your network to show active devices :',
|
'dhcpd_SCAN_YOUR_NETWORK_TITLE' => 'Scan your network to show active devices :',
|
||||||
'dhcpd_SECONDARY_DNS_ADDRESS' => 'Secondary DNS',
|
'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}) {
|
%} elsif ($dhcp_data->{success}) {
|
||||||
<div class='sme-border'>
|
<div class='sme-border'>
|
||||||
<h2> Operation Status Report - success</h2><p>
|
|
||||||
<font color=green>
|
|
||||||
%= $c->l($dhcp_data->{success});
|
%= $c->l($dhcp_data->{success});
|
||||||
</font>
|
</font>
|
||||||
</p>
|
</p>
|
||||||
@@ -29,7 +27,6 @@
|
|||||||
|
|
||||||
%} elsif ($dhcp_data->{error}) {
|
%} elsif ($dhcp_data->{error}) {
|
||||||
<div class='sme-error'>
|
<div class='sme-error'>
|
||||||
<h2> Operation Status Report - error</h2><p>
|
|
||||||
<font color=red>
|
<font color=red>
|
||||||
%= $c->l($dhcp_data->{error});
|
%= $c->l($dhcp_data->{error});
|
||||||
</font>
|
</font>
|
||||||
@@ -38,7 +35,6 @@
|
|||||||
|
|
||||||
%} elsif ($dhcp_data->{error}) {
|
%} elsif ($dhcp_data->{error}) {
|
||||||
<div class='sme-warning'>
|
<div class='sme-warning'>
|
||||||
<h2> Operation Status Report - warning</h2><p>
|
|
||||||
<font color=orange>
|
<font color=orange>
|
||||||
%= $c->l($dhcp_data->{error});
|
%= $c->l($dhcp_data->{error});
|
||||||
</font>
|
</font>
|
||||||
@@ -56,17 +52,9 @@
|
|||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
%= button_to $c->l('dhcpd_CONNECTED_IP') => '/dhcpd1', onclick=>"showSpinnerLeases()", id=>"scanLeases"
|
%= button_to $c->l('dhcpd_CONNECTED_IP') => '/dhcpd1', 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>
|
|
||||||
</td><td>
|
</td><td>
|
||||||
%= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3', onclick=>"showSpinnerNetwork()", id=>"scanNetwork"
|
%= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3', 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>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -179,41 +167,5 @@
|
|||||||
%}
|
%}
|
||||||
|
|
||||||
</div>
|
</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
|
%end
|
||||||
1;
|
1;
|
@@ -1,11 +1,6 @@
|
|||||||
<div id='dhcpd-leases'>
|
<div id='dhcpd-leases'>
|
||||||
<table><tr><td>
|
<table><tr><td>
|
||||||
%= button_to $c->l('dhcpd_REFRESH') => '/dhcpd1', onclick=>"showSpinnerLeases()", id=>"scanLeases"
|
%= button_to $c->l('dhcpd_REFRESH') => '/dhcpd1', 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>
|
|
||||||
|
|
||||||
</td><td>
|
</td><td>
|
||||||
%= button_to $c->l('dhcpd_REMOVE_ALL_LEASES') => '/dhcpd4'
|
%= button_to $c->l('dhcpd_REMOVE_ALL_LEASES') => '/dhcpd4'
|
||||||
</td>
|
</td>
|
||||||
@@ -77,37 +72,4 @@
|
|||||||
<br />
|
<br />
|
||||||
%= button_to $c->l('dhcpd_CLICK_HERE_TO_MAIN_PANEL') => '/dhcpd'
|
%= 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>
|
</div>
|
@@ -1,11 +1,6 @@
|
|||||||
<div id='dhcpd-scan'>
|
<div id='dhcpd-scan'>
|
||||||
<table><tr><td>
|
<table><tr><td>
|
||||||
%= button_to $c->l('dhcpd_REFRESH') => '/dhcpd3', onclick=>"showSpinnerNetwork1()", id=>"scanNetwork1"
|
%= button_to $c->l('dhcpd_REFRESH') => '/dhcpd3', 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>
|
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@@ -37,27 +32,4 @@
|
|||||||
%= hidden_field "hiddenmsg"=>"", id=>"hiddenmsg"
|
%= hidden_field "hiddenmsg"=>"", id=>"hiddenmsg"
|
||||||
<br />
|
<br />
|
||||||
%= button_to $c->l('dhcpd_CLICK_HERE_TO_MAIN_PANEL') => '/dhcpd'
|
%= 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>
|
</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 name smeserver-dhcpmanager
|
||||||
%define version 2.0.4
|
%define version 2.0.4
|
||||||
%define release 23
|
%define release 24
|
||||||
|
|
||||||
Summary: provide a dhcp panel in the server-manager for The SME Server
|
Summary: provide a dhcp panel in the server-manager for The SME Server
|
||||||
Name: %{name}
|
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//
|
Implementation of some feature arround dhcp clients like : wol, cleaning dhcpd.leases, Scan of your network etc//
|
||||||
|
|
||||||
%changelog
|
%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
|
* 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]
|
- Sort out archive on git stopping local archive update [SME: 13171]
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user