-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathurlconfig.html
62 lines (47 loc) · 2.37 KB
/
urlconfig.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
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="description" content="Gedys Mobile">
<title>Gedys Mobile</title>
<!-- Polyfills -->
<script src="./script/url.js"></script>
<script src="./script/urlsearchparams.js"></script>
<script src="./script/startswith.js"></script>
</head>
<body>
<p>Enter URL to mobileonline.nsf: <input type="text"
placeholder="https://server.tld/path/mobileonline.nsf/index.xsp" id="url" size="60"> <button
onclick="generate()">Generate</button></p>
<p>(Optional) Enter username for config URL: <input type="text" id="username"></p>
<p>Redirect URL: <input type="text" id="redirect" size="60"> <button onclick="copy('redirect')">Copy</button></p>
<p>Config URL: <input type="text" id="config" size="60"> <button onclick="copy('config')">Copy</button></p>
<p>URL Suffix: <input type="text" id="suffix" size="60"> <button onclick="copy('suffix')">Copy</button></p>
<script>
const HOST = "https://gomobile.gedys-intraware.de";
function generate() {
var urlField = document.getElementById("url");
var redirectField = document.getElementById("redirect");
var configField = document.getElementById("config");
var usernameField = document.getElementById("username");
var suffixField = document.getElementById("suffix");
redirectField.value = HOST + "/redirect?url=" + encodeURIComponent(urlField.value);
suffixField.value = "?url=" + encodeURIComponent(urlField.value);
var mobielURI = new URL(urlField.value);
configField.value = HOST + "/setup?"
+ "https=" + (mobielURI.protocol === "https:" ? true : false)
+ "&server=" + encodeURIComponent(mobielURI.hostname)
+ (mobielURI.port !== "" ? encodeURIComponent(":") + encodeURIComponent(mobielURI.port) : "")
+ "&path=" + encodeURIComponent(mobielURI.pathname);
if (usernameField.value !== "") {
configField.value = configField.value + "&username=" + encodeURIComponent(usernameField.value);
}
}
function copy(fieldId) {
var copyText = document.getElementById(fieldId);
copyText.select();
document.execCommand("copy");
}
</script>
</body>
</html>