wifiinfo.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <link rel="stylesheet" href="../../script/semantic/semantic.min.css">
  6. <script type="text/javascript" src="../../script/jquery.min.js"></script>
  7. <script type="text/javascript" src="../../script/semantic/semantic.min.js"></script>
  8. <script type="text/javascript" src="../../script/ao.css"></script>
  9. <link href="../../script/aos/aos.css" rel="stylesheet">
  10. <script src="../../script/aos/aos.js"></script>
  11. <title>WiFi Info</title>
  12. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  13. <style>
  14. .gradientbg{
  15. border-radius: 12px;
  16. background: rgb(253,255,254);
  17. background: linear-gradient(104deg, rgba(253,255,254,1) 29%, rgba(240,250,255,1) 100%);
  18. }
  19. .statusIcon{
  20. color: #ffffff;
  21. padding: 4em !important;
  22. text-align: center;
  23. }
  24. #status{
  25. font-size: 1.2em;
  26. color: #1f1f1f;
  27. }
  28. #status.error{
  29. color: rgb(245, 86, 86);
  30. }
  31. #status.connected{
  32. color: rgb(68, 177, 132);
  33. }
  34. #wifiicon{
  35. margin-left: auto;
  36. margin-right: auto;
  37. display: block;
  38. }
  39. </style>
  40. </head>
  41. <body>
  42. <br><br>
  43. <div class="ui container gradientbg">
  44. <div class="ui stackable grid">
  45. <div class="six wide column statusIcon" data-aos="fade-right" align="center">
  46. <img id="wifiicon" class="ui small image" src="../network/img/wifi-on.svg">
  47. <div id="status">Loading...</div>
  48. </div>
  49. <div class="ten wide column">
  50. <div class="ui container" style="padding: 4em;" data-aos="fade-left">
  51. <div class="ui segment">
  52. <h4 class="ui header">
  53. <i class="signal icon"></i>
  54. <div class="content">
  55. <span id="SSID"><i class="loading spinner icon"></i> Loading...</span>
  56. <div class="sub header" >WiFi SSID</div>
  57. </div>
  58. </h4>
  59. <h4 class="ui header">
  60. <i class="globe icon"></i>
  61. <div class="content">
  62. <span id="Interface">Loading...</span>
  63. <div class="sub header">Interface</div>
  64. </div>
  65. </h4>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. <div class="ui container" style="margin-top: 2em;">
  72. <div class="ui divider"></div>
  73. <small>WiFi information is supplied by wpa-supplicant or nmcli on Linux and Wireless AutoConfig Service (wlansvc) on Windows</small>
  74. </div>
  75. <script>
  76. AOS.init();
  77. initWifiInfo();
  78. function initWifiInfo(){
  79. $.ajax({
  80. url: "../../system/network/wifiinfo",
  81. method:"GET",
  82. success: function(data){
  83. if (data.error !== undefined){
  84. $("#SSID").text("N/A");
  85. $("#Interface").text("loopback");
  86. $("#status").text("Access Error");
  87. $("#wifiicon").attr('src', "../network/img/wifi-off.svg");
  88. console.log(data.error);
  89. }else if (data.ESSID == "" && data.Interface != ""){
  90. //Have WiFi interface but not connected to any hostspot
  91. $("#SSID").text("N/A");
  92. $("#Interface").text(data.Interface);
  93. $("#status").text("Standby");
  94. $("#wifiicon").attr('src', "../network/img/wifi-on.svg");
  95. }else if (data.Interface == ""){
  96. //No WiFi Interface
  97. $("#SSID").text("N/A");
  98. $("#Interface").text("No WiFi Interface");
  99. $("#status").html(`<i class="ui remove icon"></i> Missing WiFi Interface`);
  100. $("#wifiicon").attr('src', "../network/img/wifi-noiface.svg");
  101. $("#status").addClass("error");
  102. }else{
  103. //Connection Established
  104. $("#SSID").text(data.ESSID);
  105. $("#Interface").text(data.Interface);
  106. $("#status").html(`<i class="ui checkmark icon"></i> Connected`);
  107. $("#wifiicon").attr('src', "../network/img/wifi-on.svg");
  108. $("#status").addClass("connected");
  109. }
  110. }
  111. });
  112. }
  113. </script>
  114. </body>
  115. </html>