index.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. 
  2. <!DOCTYPE html>
  3. <meta name="apple-mobile-web-app-capable" content="yes" />
  4. <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=0.6, maximum-scale=0.6"/>
  5. <html>
  6. <head>
  7. <meta charset="UTF-8">
  8. <script type='text/javascript' charset='utf-8'>
  9. // Hides mobile browser's address bar when page is done loading.
  10. window.addEventListener('load', function(e) {
  11. setTimeout(function() { window.scrollTo(0, 1); }, 1);
  12. }, false);
  13. </script>
  14. <title>ArOZ Onlineβ</title>
  15. <link rel="stylesheet" href="../../../script/tocas/tocas.css">
  16. <script src="../../../script/tocas/tocas.js"></script>
  17. <script src="../../../script/jquery.min.js"></script>
  18. </head>
  19. <body style="background-color: rgb(247, 247, 247);">
  20. <div class="ts container">
  21. <br>
  22. <div class="ts segment">
  23. <div class="ts header">
  24. Harddisk S.M.A.R.T
  25. <div class="sub header">
  26. <div class="ts divider"></div>
  27. <button class="ts left icon label" onclick="showSMARTDetails()">
  28. <i class="notice icon"></i> View SMART
  29. </button>
  30. </div>
  31. </div>
  32. </div>
  33. <div class="ts divider"></div>
  34. <div class="ts segment">
  35. <div class="ts divided items" id="diskFrame">
  36. </div>
  37. </div>
  38. <br><br><br>
  39. </div>
  40. <div class="ts modals dimmer">
  41. <dialog id="smartModals" class="ts closable modal">
  42. <div class="header">
  43. S.M.A.R.T Information
  44. </div>
  45. <div class="content">
  46. <table class="ts very basic table">
  47. <thead>
  48. <tr>
  49. <th>ID</th>
  50. <th>Attribute</th>
  51. <th>Value</th>
  52. <th>Worst</th>
  53. <th>Threshold</th>
  54. <th>State</th>
  55. </tr>
  56. </thead>
  57. <tbody id="SMARTtableBody">
  58. </tbody>
  59. </table>
  60. </div>
  61. <div class="actions">
  62. <button class="ts deny button">
  63. Close
  64. </button>
  65. </div>
  66. </dialog>
  67. </div>
  68. <Script>
  69. var template = '<div class="item" device="%mount%" onclick="select(this)"><i class="large disk outline icon"></i><div class="content"><div class="header">%model% / %capacity% / %temp%℃</div><div class="extra">Model Family: %model_family%<br>Mount point: %mount%<br>Firmware version: %firmware_version%<br>Serial: %serial_number%<br>Power on: %hour% Hours<br>Speed: %speed%<br>Rotation speed: %rotation_rate% rpm<br>Protocol: %protocol%</div></div></div>';
  70. $.get( "opr.php?opr=scan", function( raw ) {
  71. var Maindata = JSON.parse(raw);
  72. $.each( Maindata["devices"], function( key, value ) {
  73. $.get( "opr.php?opr=info&drive=" + value["name"], function( raw ) {
  74. var DiskData = JSON.parse(raw);
  75. var tmp = template;
  76. tmp = tmp.replace("%mount%",DiskData["device"]["info_name"]);
  77. tmp = tmp.replace("%model%",DiskData["model_name"]);
  78. tmp = tmp.replace("%capacity%",disksize(DiskData["user_capacity"]["bytes"]));
  79. tmp = tmp.replace("%temp%",DiskData["temperature"]["current"]);
  80. tmp = tmp.replace("%model_family%",DiskData["model_family"]);
  81. tmp = tmp.replace("%mount%",DiskData["device"]["info_name"]);
  82. tmp = tmp.replace("%firmware_version%",DiskData["firmware_version"]);
  83. tmp = tmp.replace("%serial_number%",DiskData["serial_number"]);
  84. tmp = tmp.replace("%hour%",DiskData["power_on_time"]["hours"]);
  85. tmp = tmp.replace("%speed%",DiskData["sata_version"]["string"] + " " + DiskData["interface_speed"]["current"]["string"]);
  86. tmp = tmp.replace("%rotation_rate%",DiskData["rotation_rate"]);
  87. tmp = tmp.replace("%protocol%",DiskData["device"]["protocol"]);
  88. $("#diskFrame").append(tmp);
  89. });
  90. });
  91. });
  92. function select(div){
  93. $("div.item").find( "i" ).css( "background-color", "#f7f7f7" );
  94. $("div.item").find( "i" ).css( "color", "#919191" );
  95. $("div.item").find( "i" ).attr( "class", "large disk outline icon" );
  96. $(div).find( "i" ).css( "background-color", "#49af79" );
  97. $(div).find( "i" ).css( "color", "#ffffff" );
  98. $(div).find( "i" ).attr( "class", "large checkmark icon" );
  99. }
  100. function showSMARTDetails(){
  101. var mountpoint = $("div.item:has(i[class='large checkmark icon'])").attr("device");
  102. $.get( "opr.php?opr=info&drive=" + mountpoint, function( raw ) {
  103. var DiskData = JSON.parse(raw);
  104. $("#SMARTtableBody").html("");
  105. $.each( DiskData["ata_smart_attributes"]["table"], function( key, value ) {
  106. var tmp = tmp + "<tr>";
  107. tmp = tmp + "<td>" + value["id"] + "</td>";
  108. tmp = tmp + "<td>" + value["name"] + "</td>";
  109. tmp = tmp + "<td>" + value["value"] + "</td>";
  110. tmp = tmp + "<td>" + value["worst"] + "</td>";
  111. tmp = tmp + "<td>" + value["thresh"] + "</td>";
  112. if(value["when_failed"] == ""){
  113. tmp = tmp + "<td>OK</td>";
  114. }else{
  115. tmp = tmp + "<td>Failed</td>";
  116. }
  117. $("#SMARTtableBody").append(tmp);
  118. });
  119. ts('#smartModals').modal("show");
  120. });
  121. }
  122. function disksize(size){
  123. if(size >= 1000000000000){
  124. return Math.floor(size/1000000000000) + " TB";
  125. }else if(size >= 1000000000){
  126. return Math.floor(size/1000000000) + " GB";
  127. }else if(size >= 1000000){
  128. return Math.floor(size/1000000) + " MB";
  129. }else if(size >= 1024){
  130. return Math.floor(size/1000) + " KB";
  131. }else{
  132. return size + " Bytes";
  133. }
  134. }
  135. console.warn("%cSTOP!\n%cPlease beware not to copy and paste anything from the internet to this console as this might bring damage to your system.",'color: red;font-size: 76px','color: red');
  136. console.info(`%c ! ____ _____ ___ ____
  137. ! ! / ___|_ _/ _ \\| _ \\
  138. ! ! ! \\___ \\ | || | | | |_) |
  139. ! ! ! ___) || || |_| | __/
  140. ! ! ! |____/ |_| \\___/|_|
  141. ! ! !
  142. ! !
  143. ! ! !
  144. !!!!!!!!!!!!!!!!!!! `,'color: red;');
  145. </script>
  146. </body>
  147. </html>