forked from Open-CT/openct-tasks
93 lines
3.6 KiB
HTML
93 lines
3.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
<title>Precomputing data tool</title>
|
|
<script
|
|
src="https://code.jquery.com/jquery-3.2.1.min.js"
|
|
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
|
|
crossorigin="anonymous"></script>
|
|
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/hmac-sha256.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/components/enc-base64-min.js"></script>
|
|
<script src="bebras_tools.js" type="text/javascript"></script>
|
|
<script src="jwt.js" type="text/javascript"></script>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<div class="form-group">
|
|
<label>Server host</label>
|
|
<input type="text" class="form-control" id="host" value="http://localhost:3000">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Platform Name</label>
|
|
<input type="text" class="form-control" id="platform_name" value="test">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="task_id">Task itemUrl</label>
|
|
<input type="text" class="form-control" id="task_url" value="http://localhost?taskID=test-server-modules">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="random_seed_min">Task random_seed min</label>
|
|
<input type="text" class="form-control" id="random_seed_min" value="1">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Task random_seed max</label>
|
|
<input type="text" class="form-control" id="random_seed_max" value="10">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Task token key</label>
|
|
<input type="text" class="form-control" id="key" value="buddy">
|
|
</div>
|
|
<button class="btn btn-primary" id="run">Run</button>
|
|
|
|
<br><br>
|
|
|
|
<div id="log"></div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
function callTools(task_interface, task, callback) {
|
|
task_interface.taskData({
|
|
task: task,
|
|
success: callback,
|
|
error: callback
|
|
})
|
|
}
|
|
|
|
|
|
function run() {
|
|
var min = parseInt($('#random_seed_min').val(), 10)
|
|
var max = parseInt($('#random_seed_max').val(), 10)
|
|
var task_url = $('#task_url').val()
|
|
var platform_name = $('#platform_name').val()
|
|
var key = $('#key').val()
|
|
|
|
var task_interface = BebrasTools.connect({
|
|
host: $('#host').val()
|
|
}).taskInterface()
|
|
|
|
$('#log').empty()
|
|
for(var i=min; i<=max; i++) {
|
|
var task = signJWT({
|
|
itemUrl: task_url,
|
|
randomSeed: i,
|
|
platformName: platform_name
|
|
}, key)
|
|
callTools(task_interface, task, function(res) {
|
|
$('#log').append('<pre>' + JSON.stringify(res, 4) + '</pre>')
|
|
})
|
|
}
|
|
}
|
|
|
|
$('#run').click(run)
|
|
</script>
|
|
</body>
|
|
</html> |