Fix import paths and restore tracker functionality

This commit is contained in:
Chris Wilson 2020-07-18 23:01:35 -04:00
parent e62b406337
commit 5fdc3f757b
7 changed files with 163 additions and 151 deletions

View File

@ -0,0 +1,5 @@
#host-room input[type=text]{
width: calc(100% - 6px);
padding: 0.125rem;
height: 1.5rem;
}

View File

@ -1,43 +1,48 @@
{% extends 'layout.html' %} {% extends 'layout.html' %}
{% block head %} {% block head %}
<title>Multiworld {{ room.id }}</title> <title>Multiworld {{ room.id }}</title>
<link rel="stylesheet" type="text/css" href="{{ static_autoversion("host_room.css") }}" />
{% endblock %} {% endblock %}
{% block body %} {% block body %}
{% if room.owner == session["_id"] %} <div id="host-room">
Room created from <a href="{{ url_for("view_seed", seed=room.seed.id) }}">Seed #{{ room.seed.id }}</a><br> {% if room.owner == session["_id"] %}
{% endif %} Room created from <a href="{{ url_for("view_seed", seed=room.seed.id) }}">Seed #{{ room.seed.id }}</a><br>
{% if room.tracker %} {% endif %}
This room has a <a href="{{ url_for("get_tracker", tracker=room.tracker) }}">Multiworld Tracker</a> enabled.<br> {% if room.tracker %}
{% endif %} This room has a <a href="{{ url_for("get_tracker", tracker=room.tracker) }}">Multiworld Tracker</a> enabled.<br>
This room will be closed after {{ room.timeout//60//60 }} hours of inactivity. Should you wish to continue later, {% endif %}
you can simply refresh this page and the server will be started again.<br> This room will be closed after {{ room.timeout//60//60 }} hours of inactivity. Should you wish to continue later,
{% if room.owner == session["_id"] %} you can simply refresh this page and the server will be started again.<br>
<form method=post> {% if room.owner == session["_id"] %}
<div class="form-group"> <form method=post>
<label for="cmd"></label> <div class="form-group">
<input class="form-control" type="text" id="cmd" name="cmd" <label for="cmd"></label>
placeholder="Server Command. /help to list them, list gets appended to log."> <input class="form-control" type="text" id="cmd" name="cmd"
</div> placeholder="Server Command. /help to list them, list gets appended to log.">
</form> </div>
{% endif %} </form>
Log: {% endif %}
<div id="logger"></div> Log:
<script> <div id="logger"></div>
var xmlhttp = new XMLHttpRequest(); <script>
var url = '{{ url_for('display_log', room = room.id) }}'; let xmlhttp = new XMLHttpRequest();
let url = '{{ url_for('display_log', room = room.id) }}';
xmlhttp.onreadystatechange = function () { xmlhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) { if (this.readyState == 4 && this.status == 200) {
document.getElementById("logger").innerText = this.responseText; document.getElementById("logger").innerText = this.responseText;
}
};
function request_new() {
xmlhttp.open("GET", url, true);
xmlhttp.send();
} }
};
function request_new() { window.setTimeout(request_new, 1000);
xmlhttp.open("GET", url, true); window.setInterval(request_new, 3000);
xmlhttp.send(); </script>
} </div>
{% endblock %}
window.setTimeout(request_new, 1000);
window.setInterval(request_new, 3000);
</script>
{% endblock %}

View File

@ -2,7 +2,7 @@
{% block head %} {% block head %}
<title>Berserker's Multiworld</title> <title>Berserker's Multiworld</title>
<link rel="stylesheet" type="text/css" href="static/landing.css" /> <link rel="stylesheet" type="text/css" href="{{ static_autoversion("landing.css") }}" />
{% endblock %} {% endblock %}
{% block body %} {% block body %}

View File

@ -2,13 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<link <link rel="stylesheet" type="text/css" href="{{ static_autoversion("layout.css") }}" />
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"
integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk"
crossorigin="anonymous"
/>
<link rel="stylesheet" type="text/css" href="static/layout.css" />
{% block head %} {% block head %}
<title>Berserker's Multiworld</title> <title>Berserker's Multiworld</title>
{% endblock %} {% endblock %}

View File

@ -1,18 +1,25 @@
{% extends 'layout.html' %} {% extends 'layout.html' %}
{% block head %} {% block head %}
<title>Multiworld Tracker for Room {{ room.id }}</title> <title>Multiworld Tracker for Room {{ room.id }}</title>
<link rel="stylesheet" type="text/css"
href="https://cdn.datatables.net/v/bs4/jq-3.3.1/dt-1.10.21/fh-3.1.7/datatables.min.css"/>
<link rel="stylesheet" type="text/css" href="{{ static_autoversion("static.css") }}"/> <link rel="stylesheet" type="text/css" href="{{ static_autoversion("static.css") }}"/>
<script type="text/javascript" <link rel="stylesheet"
src="https://cdn.datatables.net/v/bs4/jq-3.3.1/dt-1.10.21/fh-3.1.7/datatables.min.js"></script> href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"
integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk"
crossorigin="anonymous" />
<link rel="stylesheet"
href="https://cdn.datatables.net/1.10.21/css/dataTables.bootstrap4.min.css" />
<script type="application/ecmascript"
src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
integrity="sha256-4+XzXVhsDmqanXGHaHvgh1gMQKX40OUvDEBTu8JcmNs="
crossorigin="anonymous"></script>
<script type="application/ecmascript"
src="https://cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js"></script>
<script type="application/ecmascript"
src="https://cdn.datatables.net/1.10.21/js/dataTables.bootstrap4.min.js"></script>
<script src="{{ static_autoversion("jquery.scrollsync.js") }}"></script> <script src="{{ static_autoversion("jquery.scrollsync.js") }}"></script>
<script> <script>
window.onload = () => {
$(document).ready(function () { let tables = $(".table").DataTable({
var tables = $(".table").DataTable({
"paging": false, "paging": false,
"ordering": true, "ordering": true,
"info": false, "info": false,
@ -59,114 +66,116 @@
tables.draw, {# this fixes the top header misalignment, for some reason #} tables.draw, {# this fixes the top header misalignment, for some reason #}
500 500
); );
}) }
</script> </script>
{% endblock %} {% endblock %}
{% block body %} {% block body %}
<input id="searchbox" class="form-control" type="text" placeholder="Search"> <input id="searchbox" class="form-control" type="text" placeholder="Search" />
<div> <div>
{% for team, players in inventory.items() %} {% for team, players in inventory.items() %}
<script type="application/ecmascript">console.log("Table 1: {{ team }} {{ players }}")</script>
<table class="table table-striped table-bordered table-hover table-sm"> <table class="table table-striped table-bordered table-hover table-sm">
<thead class="thead-dark"> <thead class="thead-dark">
<tr> <tr>
<th>#</th> <th>#</th>
<th>Name</th> <th>Name</th>
{% for name in tracking_names %} {% for name in tracking_names %}
{% if name in icons %} {% if name in icons %}
<th style="text-align: center"><img class="alttp-sprite" <th style="text-align: center">
src="{{ icons[name] }}" <img class="alttp-sprite" src="{{ icons[name] }}" alt="{{ name|e }}">
alt="{{ name|e }}"></th> </th>
{% else %} {% else %}
<th>{{ name|e }}</th> <th>{{ name|e }}</th>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for player, items in players.items() %} {% for player, items in players.items() %}
<tr> <tr>
<td class="table-info">{{ loop.index }}</td> <td class="table-info">{{ loop.index }}</td>
{% if (team, loop.index) in video %} {% if (team, loop.index) in video %}
<td class="table-info"> <td class="table-info">
<a target="_blank" href="https://www.twitch.tv/{{ video[(team, loop.index)][1] }}"> <a target="_blank" href="https://www.twitch.tv/{{ video[(team, loop.index)][1] }}">
{{ player_names[(team, loop.index)] }} {{ player_names[(team, loop.index)] }}
▶️</a></td> ▶️</a></td>
{% else %} {% else %}
<td class="table-info">{{ player_names[(team, loop.index)] }}</td>{% endif %} <td class="table-info">{{ player_names[(team, loop.index)] }}</td>
{% for id in tracking_ids %} {% endif %}
{% for id in tracking_ids %}
{% if items[id] %} {% if items[id] %}
<td style="text-align: center" class="table-success"> <td style="text-align: center" class="table-success">
{% if id in multi_items %}{{ items[id] }}{% else %}✔️{% endif %}</td> {% if id in multi_items %}{{ items[id] }}{% else %}✔️{% endif %}</td>
{% else %} {% else %}
<td></td> <td></td>
{% endif %} {% endif %}
{% endfor %}
</tr>
{% endfor %} {% endfor %}
</tr> </tbody>
{% endfor %} </table>
</tbody> {% endfor %}
</table>
{% endfor %}
{% for team, players in checks_done.items() %} {% for team, players in checks_done.items() %}
<table class="table table-striped table-bordered table-hover table-sm"> <table class="table table-striped table-bordered table-hover table-sm">
<thead class="thead-dark"> <script type="application/ecmascript">console.log("Table 2: {{ team }} {{ players }}")</script>
<tr> <thead class="thead-dark">
<th rowspan="2">#</th>
<th rowspan="2">Name</th>
{% for area in ordered_areas %}
{% set colspan = (3 if area in key_locations else 1) %}
{% if area in icons %}
<th colspan="{{ colspan }}" style="text-align: center"><img class="alttp-sprite"
src="{{ icons[area] }}"
alt="{{ area }}"></th>
{% else %}
<th colspan="{{ colspan }}">{{ area }}</th>
{% endif %}
{% endfor %}
<th rowspan="2">Last Activity</th>
</tr>
<tr>
{% for area in ordered_areas %}
<th style="text-align: center"><img class="alttp-sprite" src="{{ icons["Chest"] }}" alt="Checks">
</th>
{% if area in key_locations %}
<th style="text-align: center"><img class="alttp-sprite"
src="{{ icons["Small Key"] }}" alt="Small Key"></th>
<th style="text-align: center"><img class="alttp-sprite"
src="{{ icons["Big Key"] }}" alt="Big Key"></th>
{% endif %}
{% endfor %}
</tr>
</thead>
<tbody>
{% for player, checks in players.items() %}
<tr> <tr>
<td class="table-info">{{ loop.index }}</td> <th rowspan="2">#</th>
<td class="table-info">{{ player_names[(team, loop.index)]|e }}</td> <th rowspan="2">Name</th>
{% for area in ordered_areas %} {% for area in ordered_areas %}
{% set checks_done = checks[area] %} {% set colspan = (3 if area in key_locations else 1) %}
{% set checks_total = checks_in_area[area] %} {% if area in icons %}
{% if checks_done == checks_total %} <th colspan="{{ colspan }}" style="text-align: center"><img class="alttp-sprite"
<td style="text-align: center" class="table-success"> src="{{ icons[area] }}"
{{ checks_done }}/{{ checks_total }}</td> alt="{{ area }}"></th>
{% else %} {% else %}
<td style="text-align: center">{{ checks_done }}/{{ checks_total }}</td> <th colspan="{{ colspan }}">{{ area }}</th>
{% endif %}
{% if area in key_locations %}
<td>{{ inventory[team][player][small_key_ids[area]] }}</td>
<td>{% if inventory[team][player][big_key_ids[area]] %}✔️{% endif %}</td>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if activity_timers[(team, player)] %} <th rowspan="2">Last Activity</th>
<td class="table-info">{{ activity_timers[(team, player)] | render_timedelta }}</td>
{% else %}
<td class="table-warning">None</td>{% endif %}
</tr> </tr>
{% endfor %} <tr>
</tbody> {% for area in ordered_areas %}
</table> <th style="text-align: center"><img class="alttp-sprite" src="{{ icons["Chest"] }}" alt="Checks">
{% endfor %} </th>
{% if area in key_locations %}
<th style="text-align: center"><img class="alttp-sprite"
src="{{ icons["Small Key"] }}" alt="Small Key"></th>
<th style="text-align: center"><img class="alttp-sprite"
src="{{ icons["Big Key"] }}" alt="Big Key"></th>
{% endif %}
{% endfor %}
</tr>
</thead>
<tbody>
{% for player, checks in players.items() %}
<tr>
<td class="table-info">{{ loop.index }}</td>
<td class="table-info">{{ player_names[(team, loop.index)]|e }}</td>
{% for area in ordered_areas %}
{% set checks_done = checks[area] %}
{% set checks_total = checks_in_area[area] %}
{% if checks_done == checks_total %}
<td style="text-align: center" class="table-success">
{{ checks_done }}/{{ checks_total }}</td>
{% else %}
<td style="text-align: center">{{ checks_done }}/{{ checks_total }}</td>
{% endif %}
{% if area in key_locations %}
<td>{{ inventory[team][player][small_key_ids[area]] }}</td>
<td>{% if inventory[team][player][big_key_ids[area]] %}✔️{% endif %}</td>
{% endif %}
{% endfor %}
{% if activity_timers[(team, player)] %}
<td class="table-info">{{ activity_timers[(team, player)] | render_timedelta }}</td>
{% else %}
<td class="table-warning">None</td>{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
{% endfor %}
</div> </div>
{% endblock %} {% endblock %}

View File

@ -2,8 +2,8 @@
{% block head %} {% block head %}
<title>Upload Multidata</title> <title>Upload Multidata</title>
<link rel="stylesheet" type="text/css" href="static/uploads.css" /> <link rel="stylesheet" type="text/css" href="{{ static_autoversion("uploads.css") }}" />
<script type="application/ecmascript" src="static/uploads.js"></script> <script type="application/ecmascript" src="{{ static_autoversion("uploads.js") }}"></script>
{% endblock %} {% endblock %}
{% block body %} {% block body %}

View File

@ -3,9 +3,8 @@
{% block head %} {% block head %}
<title>Multiworld Seed {{ seed.id }}</title> <title>Multiworld Seed {{ seed.id }}</title>
<link rel="stylesheet" type="text/css" href="../static/layout.css"> <link rel="stylesheet" type="text/css" href="{{ static_autoversion("view_seed.css") }}" />
<link rel="stylesheet" type="text/css" href="../static/view_seed.css" /> <script type="application/ecmascript" src="{{ static_autoversion("view_seed.js") }}" ></script>
<script type="application/ecmascript" src="../static/view_seed.js" ></script>
{% endblock %} {% endblock %}
{% block body %} {% block body %}