-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-domain.html
More file actions
65 lines (56 loc) · 2.21 KB
/
check-domain.html
File metadata and controls
65 lines (56 loc) · 2.21 KB
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
---
title: Server Lookup
permalink: "/server-lookup"
layout: en/legal
class: legal
type: server-lookup
theme: light
redirect_from:
- "/server-lookup/"
---
<p> Is this Rocket.Chat Workspace Hosted by Rocket.Chat? </p>
<form id="lookup-form" onSubmit='return isHosted()'>
<fieldset>
<input required minlength="3" class="input input--light" type="text" id="lookup" name="lookup"
placeholder="Type the server domain" />
<div class="space--2"></div>
<button type="submit" class="button">Search</button>
<div class="space--4"></div>
</fieldset>
</form>
<div id="lookup-result" class="lookup-result hidden">
<h3 class="display--small">Result:</h3>
<p id="result-text"></p>
</div>
<p>Contact <a class="button--link" href="mailto:legal@rocket.chat">legal@rocket.chat</a> in case of legal requests or <a class="button--link" href="mailto:support@rocket.chat" >support@rocket.chat</a> in case of support requests</p>
<script>
var form = document.getElementById("lookup-form");
form.addEventListener('submit', isHosted);
function isHosted(event) {
event.preventDefault();
var xhttp = new XMLHttpRequest();
var domain = document.getElementById("lookup").value
var resultWrapper = document.getElementById("lookup-result")
var resultElement = document.getElementById("result-text");
xhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
var data = JSON.parse(this.responseText);
resultElement.innerHTML = '';
resultWrapper.className = 'lookup-result'
if(data.hosted) {
resultElement.className = 'hosted-by-true'
resultElement.append('True. This Workspace is hosted by Rocket.Chat');
} else {
resultElement.className = 'hosted-by-false'
resultElement.append('False. This Workspace is NOT hosted by Rocket.Chat');
}
}
};
xhttp.open(
"GET",
`https://cloud.rocket.chat/api/v1/utils/checkhosted?domain=${domain}`,
true
);
xhttp.send();
};
</script>