-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
102 lines (98 loc) · 3.53 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
96
97
98
99
100
101
102
<title>Switchbru DNS Controller</title>
<h3>Switchbru DNS Controller (beta)</h3>
<style>
html {
font-family: sans-serif;
width: 700px;
margin: 0 auto;
font-size: 16px;
line-height: 22px;
margin-top: 20px;
}
strong {
color: red;
}
a {
color: blue;
}
pre {
width: 100%;
background-color: #eee;
padding: 10px;
white-space: pre-wrap;
}
</style>
<body onload="getStatus()">
<p>
<strong>This controller is still under development, and changes you make here may not stick forever yet.</strong> Please let us know your experiences with it on our Discord server at <a href="http://discord.fortheusers.org">discord.fortheusers.org</a>.
</p>
<p>
If you would like to disable the DNS for a period of time or indefinitely, you can do so on this page. You should use this if setting the DNS back to Automatic does not dismiss the browser.
</p>
<p>
If you disable it indefinitely, and you'd like to get it back, you can visit this page on a computer at <a href="https://dns.switchbru.com">https://dns.switchbru.com</a>. (Needs to be on the same network as your Switch).
</p>
<div>
<div>
<h4>Current Status</h4>
<pre id="curStatus">Checking...</pre>
</div>
<div>
<h4>Update Status</h4>
<select id="dropdown" onchange="document.getElementById('send').disabled = false">
<option disabled selected>Select a Status</option>
<option value="enable">Enable indefinitely</option>
<option value="300">Disable for 5 Minutes</option>
<option value="1800">Disable for 30 Minutes</option>
<option value="3600">Disable for 1 Hour</option>
<option value="18000">Disable for 5 Hours</option>
<option value="86400">Disable for 1 Day</option>
<option value="604800">Disable for 7 Days</option>
<option value="disable">Disable indefinitely</option>
</select>
<button id="send" disabled onclick="updateStatus()">Apply Changes</button>
<p><i>Switchbru DNS is intended to help users browse the Internet on their Switch. We apologize for any inconvenience iff you did not intend for it to appear.</i></p>
</div>
</div>
</body>
<script>
let CONTROLLER_URL = "http://lanechange.fortheusers.org/change";
function getStatus()
{
let box = document.getElementById("curStatus");
fetch(CONTROLLER_URL).then(data => {
if (data.status == 404) {
box.innerHTML = "No overrides for your IP currently exist.\nDNS redirection will work normally.";
return;
}
data.text().then(resp => {
box.innerHTML = resp;
})
})
}
function updateStatus()
{
let selection = document.getElementById("dropdown").value;
if (selection == "enable") {
fetch(CONTROLLER_URL, { method: 'DELETE' }).then(resp => {
location.reload();
});
return;
}
if (selection == "disable") {
fetch(CONTROLLER_URL, { method: 'POST', body: JSON.stringify({
lane: "nintendo"
})}).then(resp => {
location.reload();
});
return;
}
// a time in seconds
fetch(CONTROLLER_URL, { method: 'POST', body: JSON.stringify({
lane: "nintendo",
duration: parseInt(selection)
})}).then(resp => {
location.reload();
});
}
</script>