![](http://content.invisioncic.com/r270260/set_resources_10/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
nnm
-
Posts
2 -
Joined
-
Last visited
Content Type
Profiles
Forums
Gallery
Downloads
Blogs
Events
Posts posted by nnm
-
-
для bird4static добавил управление в ext-ui
после установки ext-ui добавить файл
/opt/share/www/ext-ui/addons/editlist.php
со следующим содержимым:
Скрытый текст<?php // configuration $url = 'http://ip.of.your.router:88/ext-ui/addons/editlist.php'; $uservpn = '/opt/root/Bird4Static/lists/user-vpn.list'; $uservpn1 = '/opt/root/Bird4Static/lists/user-vpn1.list'; $uservpn2 = '/opt/root/Bird4Static/lists/user-vpn2.list'; $userisp = '/opt/root/Bird4Static/lists/user-isp.list'; // check if form has been submitted if (isset($_POST['vpn-text'])) { // save the text contents file_put_contents($uservpn, $_POST['vpn-text']); // redirect to form again header(sprintf('Location: %s', $url)); printf('<a href="%s">Moved</a>.', htmlspecialchars($url)); exit(); } if (isset($_POST['vpn-text1'])) { // save the text contents file_put_contents($uservpn1, $_POST['vpn-text1']); // redirect to form again header(sprintf('Location: %s', $url)); printf('<a href="%s">Moved</a>.', htmlspecialchars($url)); exit(); } if (isset($_POST['vpn-text2'])) { // save the text contents file_put_contents($uservpn2, $_POST['vpn-text2']); // redirect to form again header(sprintf('Location: %s', $url)); printf('<a href="%s">Moved</a>.', htmlspecialchars($url)); exit(); } if (isset($_POST['isp-text'])) { // save the text contents file_put_contents($userisp, $_POST['isp-text']); // redirect to form again header(sprintf('Location: %s', $url)); printf('<a href="%s">Moved</a>.', htmlspecialchars($url)); exit(); } // read the textfile $text = file_get_contents($uservpn); $text1 = file_get_contents($uservpn1); $text2 = file_get_contents($uservpn2); $textisp = file_get_contents($userisp); ?> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- HTML form0 --> <form id="selector" action="" method="post"> <input type="button" id="vpn" name="vpn" onclick="document.getElementById('uservpn').style.display='block'; document.getElementById('uservpn1').style.display='none'; document.getElementById('uservpn2').style.display='none'; document.getElementById('userisp').style.display='none'; return false;" value="user-vpn.list"/> <input type="button" id="vpn1" name="vpn1" onclick="document.getElementById('uservpn1').style.display='block'; document.getElementById('uservpn').style.display='none'; document.getElementById('uservpn2').style.display='none'; document.getElementById('userisp').style.display='none'; return false;" value="user-vpn1.list"/> <input type="button" id="vpn2" name="vpn2" onclick="document.getElementById('uservpn2').style.display='block'; document.getElementById('uservpn').style.display='none'; document.getElementById('uservpn1').style.display='none'; document.getElementById('userisp').style.display='none'; return false;" value="user-vpn2.list"/> <input type="button" id="second" name="second" onclick="document.getElementById('userisp').style.display='block'; document.getElementById('uservpn').style.display='none'; document.getElementById('uservpn1').style.display='none'; document.getElementById('uservpn2').style.display='none'; return false;" value="user-isp.list"/> </form> <!-- HTML form1 --> <div id="uservpn" style="display:none;"> <form id="vpn" action="" method="post" onsubmit="document.getElementById('uservpn').style.display='none'; return true;"> <legend>VPN list</legend> <textarea name="vpn-text" style="width:100%; height:30%;"><?php echo htmlspecialchars($text); ?></textarea> <input type="submit" value="Save&close"/> <input type="reset" value="Reset changes"/> </form> </div> <!-- HTML form1 --> <div id="uservpn1" style="display:none;"> <form id="vpn1" action="" method="post" onsubmit="document.getElementById('uservpn1').style.display='none'; return true;"> <legend>VPN1 list</legend> <textarea name="vpn-text1" style="width:100%; height:30%;"><?php echo htmlspecialchars($text1); ?></textarea> <input type="submit" value="Save&close"/> <input type="reset" value="Reset changes"/> </form> </div> <div id="uservpn2" style="display:none;"> <form id="vpn2" action="" method="post" onsubmit="document.getElementById('uservpn2').style.display='none'; return true;"> <legend>VPN2 list</legend> <textarea name="vpn-text2" style="width:100%; height:30%;"><?php echo htmlspecialchars($text2); ?></textarea> <input type="submit" value="Save&close"/> <input type="reset" value="Reset changes"/> </form> </div> <div id="userisp" style="display:none;"> <form id="isp" action="" method="post" onsubmit="document.getElementById('userisp').style.display='none'; return true;"> <legend>ISP list</legend> <textarea name="isp-text" style="width:100%; height:30%;"><?php echo htmlspecialchars($textisp); ?></textarea> <input type="submit" value="Save&close"/> <input type="reset" value="Reset changes"/> </form> </div> <form action="runbird4static.php"> <input type="submit" value="Restart service"> </form>
и этот, для кнопки перезапуска сервиса
/opt/share/www/ext-ui/addons/runbird4static.php
* для работы кнопки перезапуска сервиса нужно выдать права 777 на файл /opt/root/Bird4Static/scripts/add-bird4_routes.sh
Скрытый текст<?php shell_exec("/opt/root/Bird4Static/scripts/add-bird4_routes.sh"); header('Location: http://192.168.33.1:88/ext-ui/addons/editlist.php'); ?>
файл /opt/share/www/ext-ui/index.html отредактировать, добавив после строки
<meta charset="utf-8" />
свою строку обеспечивающую адаптивное отображение на мобильных устройствах:
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"/>
а перед этой строкой:
<a href="addons/info/index.php" target="myframe" title="System Health and Information"><img src="addons/img/btn/linfo.png"></a>
вставить свою строку с дополнительной кнопкой:
<a href="addons/editlist.php" target="myframe" title="Edit vpn list"><img src="addons/img/btn/vpn.png"></a>
ну или в любое удобное место в том же списке.
кроме этого нужно положить какую-нибудь иконку размером 48х48 по адресу /opt/share/www/ext-ui/addons/img/btn/vpn.png например такую:
на выходе получается такая страница:
нажатие на кнопку в верхнем ряду открывает соответствующий лист
нажатие на кнопку Save&close сохраняет лист и скрывает его с глаз долой.
Кнопка Restart service перезапускает сервис bird4static
p.s. я ненастоящий сварщик, я маску на стройке нашёл, так что замечания или улучшения горячо приветствуются.
-
3
-
bird4
in Вопросы по сборке и настройке Opkg
Posted
Не помню указал ли, для того чтобы скрипт отрабатывал через вызов со страницы UI нужно дать на него права 777, иначе у пользователя под которым крутится php не будет прав на исполнение и обновление не произойдёт
и да, обновление всегда проходит через запуск ./Bird4Static/scripts/add-bird4_routes.sh