-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
105 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
|
||
<title>Quick Parsec</title> | ||
|
||
<!-- Stylesheets --> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> | ||
<link rel="stylesheet" href="../../styles.css"> | ||
|
||
<!-- Scripts --> | ||
<script> | ||
delete module.exports | ||
</script> | ||
<script src="https://code.jquery.com/jquery-3.2.1.js"></script> | ||
<script src="window.js"></script> | ||
</head> | ||
|
||
<body> | ||
<div id="container" class="container-fluid"> | ||
|
||
<div class=""> | ||
<div class="col-12"> | ||
<h1>Your computers</h1> | ||
</div> | ||
</div> | ||
<div id="list-computers"> | ||
</div> | ||
|
||
</div> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
|
||
const request = require('request') | ||
const savedData = require('../../utils/saved-data') | ||
const navigate = require('../../utils/navigate') | ||
var session_id = null | ||
var listServer = [] | ||
|
||
$(() => { | ||
init() | ||
}) | ||
|
||
async function init() { | ||
session_id = await savedData.get('session_id') | ||
if (!session_id) navigate('/activity/login/') | ||
refreshList() | ||
} | ||
|
||
function refreshList() { | ||
request({ | ||
url: 'https://parsecgaming.com/v1/server-list?include_managed=true', | ||
method: 'post', | ||
headers: { | ||
'X-Parsec-Session-Id': session_id, | ||
} | ||
}, (err, res, body) => { | ||
body = JSON.parse(body) | ||
|
||
if (body.error) { | ||
alert(body.error) | ||
navigate('/activity/login/') | ||
return | ||
} | ||
|
||
listServer = body | ||
renderListServer() | ||
}) | ||
} | ||
|
||
function renderListServer() { | ||
let buildServerEntry = (server, i) => { | ||
return ` | ||
<div class="col-12"> | ||
<b>${server.name}</b> (${server.status})<br> | ||
<button class="btn btn-success" onclick="btnSetDefault(${i})">Set default</button> | ||
<button class="btn btn-default" onclick="btnConnect(${i})">Connect</button> | ||
</div> | ||
` | ||
} | ||
let html = listServer.map(buildServerEntry).join('') | ||
console.log(html) | ||
$('#list-computers').html(html) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters