shutdown.html 2.7 KB

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