78 lines
2.5 KiB
Plaintext
78 lines
2.5 KiB
Plaintext
<% local config = require "config" %>
|
|
|
|
<html>
|
|
<style>
|
|
body{
|
|
margin:40px auto;
|
|
max-width:650px;
|
|
line-height:1.6;
|
|
font-size:18px;
|
|
color:#444;
|
|
padding:0 10px
|
|
}
|
|
h1,h2,h3{line-height:1.2}
|
|
</style>
|
|
<script src="https://unpkg.com/cronstrue@latest/dist/cronstrue.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/later/1.2.0/later.min.js"></script>
|
|
<script>
|
|
var starts_sched = "<%- config.server_starts %>";
|
|
var stops_sched = "<%- config.server_stops %>";
|
|
var starts = later.parse.cron(starts_sched);
|
|
var stops = later.parse.cron(stops_sched);
|
|
|
|
var cronstrue;
|
|
var soon_el, starts_el, stops_el;
|
|
|
|
function msToTime(duration) {
|
|
seconds = Math.floor((duration / 1000) % 60),
|
|
minutes = Math.floor((duration / (1000 * 60)) % 60),
|
|
hours = Math.floor((duration / (1000 * 60 * 60)) % 24);
|
|
days = Math.floor((duration / (1000 * 60 * 60 * 24) % 7));
|
|
|
|
hours = (hours < 10) ? "0" + hours : hours;
|
|
minutes = (minutes < 10) ? "0" + minutes : minutes;
|
|
seconds = (seconds < 10) ? "0" + seconds : seconds;
|
|
days = (days < 10) ? "0" + days : days;
|
|
|
|
return days + ":" + hours + ":" + minutes + ":" + seconds;
|
|
}
|
|
|
|
document.addEventListener("DOMContentLoaded", function(e){
|
|
cronstrue = window.cronstrue
|
|
soon_el = document.getElementById("soon");
|
|
starts_el = document.getElementById("starts");
|
|
stops_el = document.getElementById("stops");
|
|
starts_el.innerText = cronstrue.toString(starts_sched);
|
|
stops_el.innerText = cronstrue.toString(stops_sched);
|
|
set_timer();
|
|
});
|
|
|
|
function set_timer(){
|
|
var next_start = later.schedule(starts).next(1);
|
|
var next_stop = later.schedule(stops).next(1);
|
|
if (next_stop < next_start){
|
|
//server's up!
|
|
soon_el.innerText = "now!"
|
|
}else{
|
|
soon_el.innerText = msToTime(next_start - Date.now())
|
|
}
|
|
}
|
|
|
|
setInterval(set_timer, 1000);
|
|
</script>
|
|
<h1> Server will come up <span id="soon">when it comes up</span></h1>
|
|
<p> Server starts <span id="starts"><%- config.server_starts %></span>
|
|
and goes down again <span id="stops"><%- config.server_stops %></span>.
|
|
In the meantime, you can download <a href="https://multimc.org/">MultiMC</a>
|
|
and add the <a href="/instance.zip">instance</a> so you can play right
|
|
away when the server comes up.
|
|
<h3> Click "Add Instance" </h3>
|
|
<p><img src="/1.png" />
|
|
<h3> Click "Import from zip" </h3>
|
|
<p><img src="/2.png" />
|
|
<h3> Copy paste the url: </h3>
|
|
<code><pre>https://txwea.boo/instance.zip</pre></code>
|
|
<p><img src="/3.png" />
|
|
<h3> And click ok, then launch the instance to connect.</h3>
|
|
</html>
|