Sortable Networks; Disable noobhack

This commit is contained in:
Andrew Grant committed 2021-08-10 23:25:43 -04:00
1 parent 7e6d0c0b91
commit e3380f21f5
2 files changed
+46 -9

No files matched your search

+3 -3
View File
@@ -625,9 +625,9 @@ def clientGetWorkload(request):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# HACK: Make Noobpwnftw's workers jump around
if request.POST['username'] == 'WorkerPool':
N = len(set([x.engine for x in OpenBench.utils.getActiveTests()]))
if random.randrange(1 + N) == 0: return HttpResponse('None')
# if request.POST['username'] == 'WorkerPool':
# N = len(set([x.engine for x in OpenBench.utils.getActiveTests()]))
# if random.randrange(1 + N) == 0: return HttpResponse('None')
# Verify the User's credentials
try: user = authenticate(request, True)
+43 -6
View File
@@ -3,16 +3,53 @@
{% block style %}
{% endblock %}
{% block scripts %}
var Networks = [
{% for network in networks %}
{
'default' : "{{network.default}}",
'engine' : "{{network.engine}}",
'author' : "{{network.author|capfirst}}",
'name' : "{{network.name}}",
'hash' : "{{network.sha256}}",
},
{% endfor %}
];
function swap_networks(index1, index2) {
var temp = Networks[index1];
Networks[index1] = Networks[index2];
Networks[index2] = temp;
var table = document.getElementById("network-table");
var temp_row = table.rows[index1+1].innerHTML
table.rows[index1+1].innerHTML = table.rows[index2+1].innerHTML;
table.rows[index2+1].innerHTML = temp_row;
}
function sort_networks(field) {
for (let i = 0; i != Networks.length; i++)
for (let j = i + 1; j != Networks.length; j++)
if (Networks[j][field] > Networks[i][field])
swap_networks(i, j);
};
document.addEventListener('DOMContentLoaded', function () { sort_networks("default"); }, false);
{% endblock %}
{% block content %}
<table>
<table id="network-table">
<tr>
<th></th>
<th>Engine</th>
<th>Uploader</th>
<th>Name</th>
<th>Hash</th>
<th onclick=sort_networks("default")></th>
<th onclick=sort_networks("engine")>Engine</th>
<th onclick=sort_networks("author")>Uploader</th>
<th onclick=sort_networks("name")>Name</th>
<th onclick=sort_networks("hash")>Hash</th>
<th></th>
</tr>