-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
95 lines (86 loc) · 3.15 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>RustDesk File Name Config Generator</title>
<style>
body {
font-family: system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Noto Sans, Ubuntu, Cantarell, Helvetica Neue, Oxygen, Fira Sans, Droid Sans, sans-serif;
margin: 40px;
}
div {
width: calc(100% / 3);
margin-bottom: 10px;
}
label {
display: block;
margin-bottom: 5px;
}
input {
width: calc(100% / 3);
padding: 8px;
margin-bottom: 10px;
}
textarea {
width: calc(100% / 3);
padding: 8px;
resize: none;
}
button {
padding: 10px;
background-color: #024eff;
color: white;
border: none;
cursor: pointer;
border-radius: .5rem;
display: block;
margin-top: 10px;
}
</style>
</head>
<body>
<h2>RustDesk File Name Config Generator</h2>
<div>
This form conveniently generates a file name for RustDesk.exe that contains the encoded settings defined here. More information on how this works can be found <a href="https://RustDesk.com/docs/en/self-host/client-configuration/#4-put-config-in-RustDeskexe-file-name-windows-only">here</a>.
</div>
<form id="myForm">
<label for="host">ID Server:</label>
<input type="text" id="host" name="host" oninput="generateAndDisplay()">
<label for="relay">Relay Server</label>
<input type="text" id="relay" name="relay" oninput="generateAndDisplay()">
<label for="api">API Server:</label>
<input type="text" id="api" name="api" oninput="generateAndDisplay()">
<label for="key">Key:</label>
<input type="text" id="key" name="key" oninput="generateAndDisplay()">
</form>
<h2>Result:</h2>
<textarea type="text" id="result" rows="4" readonly></textarea>
<button onclick="copyToClipboard()">Copy</button>
<script>
function generateAndDisplay() {
var host = document.getElementById('host').value;
var key = document.getElementById('key').value;
var api = document.getElementById('api').value;
var relay = document.getElementById('relay').value;
var jsonData = {
"host": host,
"key": key,
"api": api,
"relay": relay
};
var base64Encoded = btoa(JSON.stringify(jsonData))
.replace(/\+/g, '-')
.replace(/\//g, '_')
.replace(/=+$/, '');
var reversedString = base64Encoded.split('').reverse().join('');
var filename = `rustdesk--${reversedString}--.exe`;
document.getElementById('result').value = filename;
}
function copyToClipboard() {
document.getElementById('result').select();
document.execCommand('copy');
}
</script>
</body>
</html>