aboutsummaryrefslogtreecommitdiff
path: root/route/get
blob: 8938baf279baf5aa8bf3d934e833ba9f86d08dff (plain) (blame)
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
#!/bin/bash
source "$WEBSITE_ROOT/common";
offline() {
		echo """HTTP/1.1 200 OK
Content-type: text/html
Refresh: 10
X-Accel-Expires: 10

""";
	cat "$WEBSITE_ROOT/static/head.html";
	sidebar;
	echo "<span class='content'><b>LiBot is currently offline!</b><br>It is not possible to select the best shred for authorization. Please wait until it comes back before attempting to add it to your guild.</span>";
	cat "$WEBSITE_ROOT/static/tail.html";
	exit 0;
}

if bot_up; then
	bestid="$(get_prop 'BESTID')";
	if [ -z $bestid ]; then
		offline;
	fi;
	url="https://discord.com/oauth2/authorize?client_id=$bestid&scope=bot&permissions=3459136";
	echo """HTTP/1.1 301 Moved Permanently
Content-type: text/html
Location: $url

<!DOCTYPE html>
<html><body>Not redirected? <a href='$url'>Click here</a></body></html>""";
else
	offline;
fi;