2020-06-10 04:17:15 +03:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
2020-10-29 00:46:40 +03:00
<meta name="robots" content="noindex,nofollow">
2020-06-10 04:17:15 +03:00
<link rel="icon" href="/favicon.ico">
2020-08-19 04:29:13 +03:00
<link rel="apple-touch-icon" href="/favicon-303x303.png" />
2020-06-10 04:17:15 +03:00
<title>RDP</title>
2020-06-12 23:56:29 +03:00
<script type="text/javascript" src="mstsc/mstsc.js"></script>
<script type="text/javascript" src="mstsc/keyboard.js"></script>
<script type="text/javascript" src="mstsc/rle.js"></script>
<script type="text/javascript" src="mstsc/client.js"></script>
<script type="text/javascript" src="mstsc/canvas.js"></script>
2020-06-11 01:25:46 +03:00
<style>
2020-12-01 00:20:31 +03:00
:focus {
outline: 0;
}
2020-06-11 01:25:46 +03:00
body {
font-family:sans-serif;
margin: 0;
background-color: black;
}
.container {
background-color:cadetblue;
background: linear-gradient(to bottom right, #003366, #0055AA);
}
.middleContainer {
color: lightgray;
position: absolute;
top: 50%;
left: 50%;
-moz-transform: translateX(-50%) translateY(-50%);
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
}
.signinform {
2020-06-12 23:56:29 +03:00
width: 380px;
2020-06-11 01:25:46 +03:00
margin: 0 auto;
}
2021-06-30 03:13:18 +03:00
.formDropdown {
font-size: 17px;
}
2020-06-11 01:25:46 +03:00
.formLabel { }
.formControl {
2020-06-12 23:56:29 +03:00
width:calc(100% - 16px);
2020-06-11 01:25:46 +03:00
font-size: 17px;
border-radius: 5px;
}
.connectButton {
margin-top: 6px;
width: 100%;
padding: 6px;
font-size: 16px;
border-radius: 5px;
cursor:pointer;
}
.mainCanvas {
position: absolute;
top: 50%;
left: 50%;
-moz-transform: translateX(-50%) translateY(-50%);
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
}
</style>
2020-06-10 04:17:15 +03:00
<script language="javascript">
var client = null;
2020-06-11 01:25:46 +03:00
var canvas = null;
2020-06-10 04:17:15 +03:00
var urlargs = parseUriArgs();
2020-06-21 23:41:36 +03:00
if (urlargs.key && (isAlphaNumeric(urlargs.key) == false)) { delete urlargs.key; }
2020-06-14 03:43:12 +03:00
var cookie = ' {{{ cookie }}} ';
2022-05-11 03:44:34 +03:00
var serverCredentials = parseInt(' {{{ serverCredentials }}} ');
2020-06-14 03:43:12 +03:00
var name = decodeURIComponent(' {{{ name }}} ');
if (name != '') { document.title = name + ' - ' + document.title; }
2022-03-16 03:00:43 +03:00
var features = parseInt(' {{{ features }}} ');
2020-06-10 04:17:15 +03:00
2020-06-11 01:25:46 +03:00
function load() {
2020-07-06 22:46:38 +03:00
if (name != '') { QH('computerName', EscapeHtml(name)); }
2020-06-11 01:25:46 +03:00
client = MstscClient.create(Q('myCanvas'));
Q('inputDomain').focus();
canvas = Q('myCanvas');
2020-06-14 03:43:12 +03:00
if (cookie == '') {
QE('inputDomain', false);
QE('inputUsername', false);
QE('inputPassword', false);
QE('connectButton', false);
}
2021-06-30 03:13:18 +03:00
2022-05-11 03:44:34 +03:00
if (serverCredentials == 1) {
2021-06-30 03:13:18 +03:00
QV('dropdowndomain', true);
Q('d3coreMode').value = 1;
} else {
QV('dropdowndomain', false);
Q('d3coreMode').value = 2;
}
dropDownChange();
2020-06-10 04:17:15 +03:00
}
function connect(domain, username, password) {
2020-06-14 03:43:12 +03:00
if (cookie == '') return;
2020-06-11 01:25:46 +03:00
var domain = Q('inputDomain').value;
var username = Q('inputUsername').value;
var password = Q('inputPassword').value;
2021-06-30 03:13:18 +03:00
var savepass = Q('inputSaveCredentials').checked;
var options = { savepass: savepass, useServerCreds: (Q('d3coreMode').value == 1) };
2020-06-11 01:25:46 +03:00
QV('myCanvas', true);
QV('main', false);
2020-06-10 04:17:15 +03:00
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
2021-06-30 03:13:18 +03:00
client.connect(cookie, domain, username, password, options, function (err) { QV('myCanvas', false); QV('main', true); });
2020-06-11 01:25:46 +03:00
return false;
2020-06-10 04:17:15 +03:00
}
2020-06-11 01:25:46 +03:00
function Q(x) { return document.getElementById(x); } // "Q"
function QS(x) { try { return Q(x).style; } catch (x) { } } // "Q" style
function QE(x, y) { try { Q(x).disabled = !y; } catch (x) { } } // "Q" enable
function QV(x, y) { try { QS(x).display = (y ? '' : 'none'); } catch (x) { } } // "Q" visible
function QA(x, y) { Q(x).innerHTML += y; } // "Q" append
function QH(x, y) { Q(x).innerHTML = y; } // "Q" html
function QC(x) { try { return Q(x).classList; } catch (x) { } } // "Q" class
function EscapeHtml(x) { if (typeof x == 'string') return x.replace(/&/g, '&').replace(/>/g, '>').replace(/</g, '<').replace(/"/g, '"').replace(/'/g, '''); if (typeof x == 'boolean') return x; if (typeof x == 'number') return x; }
function EscapeHtmlBreaks(x) { if (typeof x == 'string') return x.replace(/&/g, '&').replace(/>/g, '>').replace(/</g, '<').replace(/"/g, '"').replace(/'/g, ''').replace(/\r/g, '<br />').replace(/\n/g, '').replace(/\t/g, ' '); if (typeof x == 'boolean') return x; if (typeof x == 'number') return x; }
2020-06-21 23:41:36 +03:00
// String validation
function isAlphaNumeric(str) { return (str.match(/^[A-Za-z0-9]+$/) != null); };
2020-06-26 19:35:12 +03:00
function isSafeString(str) { return ((typeof str == 'string') && (str.indexOf('<') == -1) && (str.indexOf('>') == -1) && (str.indexOf('&') == -1) && (str.indexOf('"') == -1) && (str.indexOf('\'') == -1) && (str.indexOf('+') == -1) && (str.indexOf('(') == -1) && (str.indexOf(')') == -1) && (str.indexOf('#') == -1) && (str.indexOf('%') == -1) && (str.indexOf(':') == -1)) };
2020-06-21 23:41:36 +03:00
// Parse URL arguments, only keep safe values
function parseUriArgs() {
var href = window.document.location.href;
if (href.endsWith('#')) { href = href.substring(0, href.length - 1); }
var name, r = { }, parsedUri = href.split(/[\?&|\=]/);
parsedUri.splice(0, 1);
for (x in parsedUri) {
switch (x % 2) {
case 0: { name = decodeURIComponent(parsedUri[x]); break; }
case 1: {
r[name] = decodeURIComponent(parsedUri[x]);
if (!isSafeString(r[name])) { delete r[name]; } else { var x = parseInt(r[name]); if (x == r[name]) { r[name] = x; } }
break;
} default: { break; }
}
}
return r;
}
2021-06-30 03:13:18 +03:00
function dropDownChange() {
var newCreds = (Q('d3coreMode').value == 2);
QV('rowdomain', newCreds);
QV('rowusername', newCreds);
QV('rowpassword', newCreds);
2022-03-16 03:00:43 +03:00
QV('rowremember', newCreds && ((features & 1) == 0));
2021-06-30 03:13:18 +03:00
if (newCreds) Q('inputUsername').focus();
}
2020-06-10 04:17:15 +03:00
</script>
</head>
2020-06-11 01:25:46 +03:00
<body onload='load()' style="position:absolute;top:0px;right:0;left:0;bottom:0px">
<div id="main" class="container" style="position:absolute;top:0px;right:0;left:0;bottom:0px">
<div class="middleContainer">
<div id="computerName" style="width:100%;text-align:center;font-size:24px"></div>
<table class="signinform">
<tr>
<td colspan="2"><hr style="color:gray;border:1px solid;" /></td>
</tr>
2021-06-30 03:13:18 +03:00
<tr id="dropdowndomain" style="display:none">
<td colspan="2">
2021-06-30 03:29:46 +03:00
<select id=d3coreMode style=width:100%;margin-bottom:5px class="formDropdown" onchange="dropDownChange()"><option value=1>Use server credentials</option><option value=2>Use new credentials</option></select>
2021-06-30 03:13:18 +03:00
</td>
</tr>
<tr id="rowdomain" style="display:none">
2020-06-11 01:25:46 +03:00
<td><label for="inputDomain" class="formLabel">Domain</label></td>
<td style="text-align:right"><input type="text" id="inputDomain" class="formControl" placeholder="Domain"></td>
</tr>
2021-06-30 03:13:18 +03:00
<tr id="rowusername" style="display:none">
2020-06-11 01:25:46 +03:00
<td><label for="inputUsername" class="formLabel">Username</label></td>
<td style="text-align:right"><input type="text" id="inputUsername" class="formControl" placeholder="Username"></td>
</tr>
2021-06-30 03:13:18 +03:00
<tr id="rowpassword" style="display:none">
2020-06-11 01:25:46 +03:00
<td><label for="inputPassword" class="formLabel">Password</label></td>
<td style="text-align:right"><input type="password" id="inputPassword" class="formControl" placeholder="Password"></td>
</tr>
2021-06-30 03:13:18 +03:00
<tr id="rowremember" style="display:none">
<td></td>
<td><label><input type="checkbox" id="inputSaveCredentials" style="margin-left:8px;margin-right:5px">Remember credentials</label></td>
</tr>
2020-06-11 01:25:46 +03:00
<tr>
<td colspan="2"><button class="connectButton" onclick="return connect()">Connect</button></td>
</tr>
</table>
</div>
</div>
<canvas id="myCanvas" class="mainCanvas" style="display:none" />
2020-06-10 04:17:15 +03:00
</body>
</html>