WebHost: On-Server rolling

This commit is contained in:
Fabian Dill
2020-08-02 22:11:52 +02:00
parent cfb8e2ce71
commit 22abd09087
13 changed files with 330 additions and 87 deletions

View File

@@ -6,7 +6,7 @@
{% endblock %}
{% block body %}
{% for filename, resulttext in results.items() %}
<span>{{ filename }}: {{ resulttext }}</span><br>
{% for filename, resulttext in results.items() %}
<span>{{ filename }}: {{ "Looks ok" if resulttext == True else resulttext }}</span><br>
{% endfor %}
{% endblock %}

View File

@@ -0,0 +1,42 @@
{% extends 'layout.html' %}
{% block head %}
{{ super() }}
<title>Generate Game</title>
<link rel="stylesheet" type="text/css" href="{{ static_autoversion("uploads.css") }}"/>
<script type="application/ecmascript" src="{{ static_autoversion("generate.js") }}"></script>
{% endblock %}
{% block body %}
<div id="uploads-wrapper">
<div id="uploads" class="main-content">
<h3>Upload YAML(s){% if race %} (Race Mode){% endif %}</h3>
<p>
This page accepts a yaml file containing generator options.
You can find a documented example at <a
href="https://raw.githubusercontent.com/Berserker66/MultiWorld-Utilities/master/easy.yaml">easy.yaml</a>.
This file can be saved as .yaml, edited to your liking and then supplied to the generator.
You can also upload a .zip with multiple YAMLs.
A proper menu is in the works.
{% if race -%}
Race Mode means the spoiler log will be unavailable.
{%- else -%}
You can go to <a href="{{ url_for("generate", race=True) }}">Race Mode</a> to create a game without
spoiler log.
{%- endif -%}
</p>
<p>
After generation is complete, you will have the option to download a patch file.
This patch file can be opened with the <a
href="https://github.com/Berserker66/MultiWorld-Utilities/releases">Client</a> to create a rom file.
In-Browser patching will come.
</p>
<div id="uploads-form-wrapper">
<form id="upload-form" method="post" enctype="multipart/form-data">
<input id="file-input" type="file" name="file">
</form>
<button id="upload-button">Upload</button>
</div>
</div>
</div>
{% endblock %}

View File

@@ -1,5 +1,5 @@
{% extends 'layout.html' %}
{% import "macros.html" as macros %}
{% block head %}
<title>Multiworld {{ room.id|suuid }}</title>
<link rel="stylesheet" type="text/css" href="{{ static_autoversion("host_room.css") }}"/>
@@ -18,6 +18,10 @@
This room will be closed after {{ room.timeout//60//60 }} hours of inactivity. Should you wish to continue
later,
you can simply refresh this page and the server will be started again.<br>
{% if room.last_port %}
You can connect to this room by using '/connect berserkermulti.world:{{ room.last_port }}'
in the <a href="https://github.com/Berserker66/MultiWorld-Utilities/releases">client</a>.<br>{% endif %}
{{ macros.list_patches_room(room.seed.patches, room) }}
{% if room.owner == session["_id"] %}
<form method=post>
<div class="form-group">
@@ -26,15 +30,15 @@
placeholder="Server Command. /help to list them, list gets appended to log.">
</div>
</form>
{% endif %}
Log:
Log:
<div id="logger"></div>
<script>
let xmlhttp = new XMLHttpRequest();
let url = '{{ url_for('display_log', room = room.id) }}';
xmlhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
if (this.readyState === 4 && this.status === 200) {
document.getElementById("logger").innerText = this.responseText;
}
};
@@ -47,5 +51,6 @@
window.setTimeout(request_new, 1000);
window.setInterval(request_new, 10000);
</script>
{% endif %}
</div>
{% endblock %}

View File

@@ -19,9 +19,15 @@
</p>
</div>
<div id="landing-buttons">
<a href="uploads">
<a href="{{ url_for("generate") }}">
<button>Start Playing</button>
</a>
<a href="{{ url_for("uploads") }}">
<button>Upload Multiworld</button>
</a>
<a href="{{ url_for("mysterycheck") }}">
<button>Test YAML Config</button>
</a>
</div>
<div id="landing-body">
<p>This is a <span data-tooltip="Allegedly.">randomizer</span> for The Legend of Zelda: A

View File

@@ -6,3 +6,13 @@
{{ caller() }}
</ul>
{%- endmacro %}
{% macro list_patches_room(patches, room) %}
{% if patches %}
<ul>
{% for patch in patches %}
<li><a href="{{ url_for("download_patch", patch_id=patch.id, room_id=room.id) }}">
Patch for player {{ patch.player }} - {{ room.seed.multidata["names"][0][patch.player-1] }}</a></li>
{% endfor %}
</ul>
{% endif %}
{%- endmacro -%}

View File

@@ -21,25 +21,33 @@
<td>Created:&nbsp;</td>
<td id="creation-time" data-creation-time="{{ seed.creation_time }}"></td>
</tr>
{% if seed.spoiler %}
<tr>
<td>Spoiler:&nbsp;</td>
<td><a href="{{ url_for("download_spoiler", seed_id=seed.id) }}">Download</a></td>
</tr>
{% endif %}
<tr>
<td>Players:&nbsp;</td>
<td>
<ul>
{% for team in seed.multidata["names"] %}
<li>Team #{{ loop.index }} - {{ team | length }}
<ul>
{% for player in team %}
<li>{{ player }}</li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
</td>
</tr>
<tr>
<td>Rooms:&nbsp;</td>
<td>
<li>Team #{{ loop.index }} - {{ team | length }}
<ul>
{% for player in team %}
<li>
<a href="{{ url_for("download_raw_patch", seed_id=seed.id, player_id=loop.index) }}">{{ player }}</a>
</li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
</td>
</tr>
<tr>
<td>Rooms:&nbsp;</td>
<td>
{% call macros.list_rooms(rooms) %}
<li>
<a href="{{ url_for("new_room", seed=seed.id) }}">Create New Room</a>