mirror of
https://github.com/unraid/webgui.git
synced 2026-05-04 00:39:32 -05:00
Add wireless monitor in status bar
This commit is contained in:
@@ -20,6 +20,7 @@ $themes2 = in_array($theme,['gray','azure']);
|
||||
$config = "/boot/config";
|
||||
$entity = $notify['entity'] & 1 == 1;
|
||||
$alerts = '/tmp/plugins/my_alerts.txt';
|
||||
$wlan0 = file_exists('/sys/class/net/wlan0');
|
||||
|
||||
// adjust the text color in docker log window
|
||||
$fgcolor = in_array($theme,['white','azure']) ? '#1c1c1c' : '#f2f2f2';
|
||||
@@ -77,6 +78,7 @@ html{font-size:<?=$display['font']?>%}
|
||||
<?endif;?>
|
||||
<?
|
||||
$nchan = ['webGui/nchan/notify_poller','webGui/nchan/session_check'];
|
||||
if ($wlan0) $nchan[] = 'webGui/nchan/wlan0';
|
||||
$safemode = _var($var,'safeMode')=='yes';
|
||||
$tasks = find_pages('Tasks');
|
||||
$buttons = find_pages('Buttons');
|
||||
@@ -821,6 +823,7 @@ default:
|
||||
echo "<span class='green strong'><i class='fa fa-play-circle'></i> ",_('Array Started'),"</span>$progress"; break;
|
||||
}
|
||||
echo "</span></span><span id='countdown'></span><span id='user-notice' class='red-text'></span>";
|
||||
if ($wlan0) echo "<span id='wlan0' class='grey-text'><i class='fa fa-wifi fa-fw'></i></span>";
|
||||
echo "<span id='copyright'>Unraid® webGui ©2024, Lime Technology, Inc.";
|
||||
echo " <a href='https://docs.unraid.net/go/manual/' target='_blank' title=\""._('Online manual')."\"><i class='fa fa-book'></i> "._('manual')."</a>";
|
||||
echo "</span></div>";
|
||||
@@ -924,6 +927,14 @@ defaultPage.on('message', function(msg,meta) {
|
||||
}
|
||||
});
|
||||
|
||||
<?if ($wlan0):?>
|
||||
var nchan_wlan0 = new NchanSubscriber('/sub/wlan0',{subscriber:'websocket'});
|
||||
nchan_wlan0.on('message', function(color) {
|
||||
$('#wlan0').removeClass().addClass(color);
|
||||
});
|
||||
nchan_wlan0.start();
|
||||
<?endif;?>
|
||||
|
||||
var nchan_plugins = new NchanSubscriber('/sub/plugins',{subscriber:'websocket'});
|
||||
nchan_plugins.on('message', function(data) {
|
||||
if (!data || openDone(data)) return;
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/php -q
|
||||
<?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.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot = '/usr/local/emhttp';
|
||||
require_once "$docroot/webGui/include/publish.php";
|
||||
require_once "$docroot/webGui/include/Wrappers.php";
|
||||
|
||||
while (true) {
|
||||
if (file_exists('/var/local/emhttp/wireless.ini')) {
|
||||
$up = file_get_contents('/sys/class/net/wlan0/carrier')==1;
|
||||
$color = $up ? 'blue-text' : 'red-text';
|
||||
} else {
|
||||
$color = 'grey-text';
|
||||
}
|
||||
publish('wlan0',$color);
|
||||
sleep(5);
|
||||
}
|
||||
?>
|
||||
@@ -9,3 +9,4 @@ span.big.blue-text{cursor:pointer}
|
||||
span.strong.tour{margin-left:5px;padding-left:0}
|
||||
i.abortOps{font-size:2rem;float:right;margin-right:20px;margin-top:8px;cursor:pointer}
|
||||
pre#swalbody p{margin-block-end:1em}
|
||||
span#wlan0{float:right;margin-right:10px}
|
||||
Reference in New Issue
Block a user