shutdown.html 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Shutting Down</title>
  5. <meta charset="UTF-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=no">
  7. <script type="text/javascript" src="../../script/jquery.min.js"></script>
  8. <style>
  9. body{
  10. background-color: #0f0f0f;
  11. }
  12. .main{
  13. width: 400px;
  14. height: 100px;
  15. padding: 20px;
  16. position: absolute;
  17. top: 30%;
  18. left: calc(50% - 200px);
  19. color: white;
  20. font-family: monospace;
  21. text-align: center;
  22. }
  23. .brandicon{
  24. width: 70%;
  25. }
  26. </style>
  27. </head>
  28. <body>
  29. <br><br><br>
  30. <div class="main">
  31. <img class="brandicon" id="icon" src="#">
  32. <p id="countdown">Host server is shutting down in 60 seconds</p>
  33. </div>
  34. <script>
  35. //ArozOS default shutdown after 60 seconds after shutdown request has been made.
  36. //Shut it down
  37. $.getJSON("../../system/info/getArOZInfo?icon=true", function(data) {
  38. $("#icon").attr("src", "data:image/png;base64," + data["VendorIcon"]);
  39. });
  40. let counter = 60;
  41. function handleCountdown(){
  42. setTimeout(function(){
  43. counter--;
  44. if (counter == 0){
  45. setTimeout(function(){
  46. $.ajax({
  47. url: "../../system/auth/checkLogin",
  48. success: function(data){
  49. $("#countdown").text("Shutdown failed. Please try again later");
  50. document.title = "Shutdown Failed";
  51. },
  52. error: function(){
  53. //Server connection lost. Should have been shutted down
  54. $("#countdown").text("Shutdown Succeed: Host offline");
  55. document.title = "Offline";
  56. },
  57. timeout: 2000
  58. });
  59. }, 3000);
  60. $("#countdown").text("Checking Connection State...");
  61. }else{
  62. $("#countdown").text(`Host server is shutting down in ${counter} seconds`);
  63. handleCountdown();
  64. }
  65. }, 1000);
  66. }
  67. handleCountdown();
  68. </script>
  69. </body>
  70. </html>