Skip to content

Commit 35711c7

Browse files
committed
New error-pages worker
1 parent 20c778c commit 35711c7

File tree

15 files changed

+2282
-0
lines changed

15 files changed

+2282
-0
lines changed

error-pages/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# 👷 Error Pages
2+
3+
This worker serves HTML error pages from Cloudflare KV based on the request path. For example, a request to `/waf_block` will serve the HTML stored under the `waf_block.htm` key in KV.
4+
5+
## Deployment
6+
7+
Install local dependencies with `npm install`.
8+
9+
Login to wrangler with `npx wrangler login`.
10+
11+
After you've authorised, you can make modifications to the worker and run `npm run deploy` to deploy.
12+
13+
## Usage
14+
15+
Create or edit HTML files in `html_files/`.
16+
17+
Run the `./update_pages.sh` bash script on a system with NPM installed and wrangler logged in to push HTML files to the Cloudflare KV storage.
18+
19+
Changes should be live within a few seconds on `error-pages.pythondiscord.com`.
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<title>Python Discord • Error</title>
6+
7+
<meta charset="UTF-8">
8+
9+
<link rel="preconnect" href="https://fonts.gstatic.com">
10+
<link href="https://fonts.googleapis.com/css2?family=Hind:wght@400;600&display=swap" rel="stylesheet">
11+
12+
<style>
13+
html {
14+
height: 100%;
15+
}
16+
17+
body {
18+
background-color: #7289DA;
19+
background-image: url("https://raw.githubusercontent.com/python-discord/branding/master/logos/banner_pattern/banner_pattern.svg");
20+
background-size: 128px;
21+
font-family: "Hind", "Helvetica", "Arial", sans-serif;
22+
display: flex;
23+
align-items: center;
24+
justify-content: center;
25+
height: 100%;
26+
}
27+
28+
h1,
29+
p {
30+
color: black;
31+
padding: 0;
32+
margin: 0;
33+
}
34+
35+
h1 {
36+
margin-bottom: 15px;
37+
font-size: 26px;
38+
}
39+
40+
p {
41+
line-height: 125%;
42+
}
43+
44+
a {
45+
color: #7289DA;
46+
}
47+
48+
.error-box {
49+
display: flex;
50+
flex-direction: column;
51+
max-width: 512px;
52+
background-color: white;
53+
border-radius: 20px;
54+
overflow: hidden;
55+
box-shadow: 5px 7px 40px rgba(0, 0, 0, 0.432);
56+
}
57+
58+
.logo-box {
59+
display: flex;
60+
justify-content: center;
61+
height: 80px;
62+
padding: 15px;
63+
background-color: #758ad4;
64+
}
65+
66+
.content-box {
67+
padding: 25px;
68+
}
69+
70+
.cferror_details {
71+
list-style-type: none !important;
72+
background-color: #EEE;
73+
border-radius: 10px;
74+
padding: 20px;
75+
margin: 0;
76+
margin-top: 25px;
77+
}
78+
79+
li {
80+
font-family: monospace;
81+
}
82+
</style>
83+
</head>
84+
85+
<body>
86+
<div class="error-box">
87+
<div class="logo-box">
88+
<img
89+
src="https://raw.githubusercontent.com/python-discord/branding/b67897df93e572c1576a9026eb78c785a794d226/logos/logo_banner/logo_site_banner.svg"
90+
alt="Python Discord banner" />
91+
</div>
92+
<div class="content-box">
93+
::CLOUDFLARE_ERROR_1000S_BOX::
94+
</div>
95+
</div>
96+
</body>
97+
98+
</html>
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<title>Python Discord • Internal Server Error</title>
6+
7+
<meta charset="UTF-8">
8+
9+
<link rel="preconnect" href="https://fonts.gstatic.com">
10+
<link href="https://fonts.googleapis.com/css2?family=Hind:wght@400;600&display=swap" rel="stylesheet">
11+
12+
<style>
13+
html {
14+
height: 100%;
15+
}
16+
17+
body {
18+
background-color: #7289DA;
19+
background-image: url("https://raw.githubusercontent.com/python-discord/branding/master/logos/banner_pattern/banner_pattern.svg");
20+
background-size: 128px;
21+
font-family: "Hind", "Helvetica", "Arial", sans-serif;
22+
display: flex;
23+
align-items: center;
24+
justify-content: center;
25+
height: 100%;
26+
}
27+
28+
h1,
29+
p {
30+
color: black;
31+
padding: 0;
32+
margin: 0;
33+
}
34+
35+
h1 {
36+
margin-bottom: 15px;
37+
font-size: 26px;
38+
}
39+
40+
p {
41+
line-height: 125%;
42+
}
43+
44+
a {
45+
color: #7289DA;
46+
}
47+
48+
.error-box {
49+
display: flex;
50+
flex-direction: column;
51+
max-width: 512px;
52+
background-color: white;
53+
border-radius: 20px;
54+
overflow: hidden;
55+
box-shadow: 5px 7px 40px rgba(0, 0, 0, 0.432);
56+
}
57+
58+
.logo-box {
59+
display: flex;
60+
justify-content: center;
61+
height: 80px;
62+
padding: 15px;
63+
background-color: #758ad4;
64+
}
65+
66+
.content-box {
67+
padding: 25px;
68+
}
69+
70+
.cferror_details {
71+
list-style-type: none !important;
72+
background-color: #EEE;
73+
border-radius: 10px;
74+
padding: 20px;
75+
margin: 0;
76+
margin-top: 25px;
77+
}
78+
79+
li {
80+
font-family: monospace;
81+
}
82+
</style>
83+
</head>
84+
85+
<body>
86+
<div class="error-box">
87+
<div class="logo-box">
88+
<img
89+
src="https://raw.githubusercontent.com/python-discord/branding/b67897df93e572c1576a9026eb78c785a794d226/logos/logo_banner/logo_site_banner.svg"
90+
alt="Python Discord banner" />
91+
</div>
92+
<div class="content-box">
93+
::CLOUDFLARE_ERROR_500S_BOX::
94+
</div>
95+
</div>
96+
</body>
97+
98+
</html>

error-pages/html_files/captcha.htm

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<title>Python Discord • Action Required</title>
6+
7+
<meta charset="UTF-8">
8+
9+
<link rel="preconnect" href="https://fonts.gstatic.com">
10+
<link href="https://fonts.googleapis.com/css2?family=Hind:wght@400;600&display=swap" rel="stylesheet">
11+
12+
<style>
13+
html {
14+
height: 100%;
15+
}
16+
17+
body {
18+
background-color: #7289DA;
19+
background-image: url("https://raw.githubusercontent.com/python-discord/branding/master/logos/banner_pattern/banner_pattern.svg");
20+
background-size: 128px;
21+
font-family: "Hind", "Helvetica", "Arial", sans-serif;
22+
display: flex;
23+
align-items: center;
24+
justify-content: center;
25+
height: 100%;
26+
}
27+
28+
h1,
29+
p {
30+
color: black;
31+
padding: 0;
32+
margin: 0;
33+
}
34+
35+
h1 {
36+
margin-bottom: 15px;
37+
font-size: 26px;
38+
}
39+
40+
p {
41+
line-height: 125%;
42+
}
43+
44+
a {
45+
color: #7289DA;
46+
}
47+
48+
.error-box {
49+
display: flex;
50+
flex-direction: column;
51+
max-width: 512px;
52+
background-color: white;
53+
border-radius: 20px;
54+
overflow: hidden;
55+
box-shadow: 5px 7px 40px rgba(0, 0, 0, 0.432);
56+
}
57+
58+
.logo-box {
59+
display: flex;
60+
justify-content: center;
61+
height: 80px;
62+
padding: 15px;
63+
background-color: #758ad4;
64+
}
65+
66+
.content-box {
67+
padding: 25px;
68+
}
69+
</style>
70+
</head>
71+
72+
<body>
73+
<div class="error-box">
74+
<div class="logo-box">
75+
<img
76+
src="https://raw.githubusercontent.com/python-discord/branding/b67897df93e572c1576a9026eb78c785a794d226/logos/logo_banner/logo_site_banner.svg"
77+
alt="Python Discord banner" />
78+
</div>
79+
<div class="content-box">
80+
<h1>Please complete CAPTCHA to continue.</h1>
81+
::CAPTCHA_BOX::
82+
</div>
83+
</div>
84+
</body>
85+
86+
</html>
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<title>Python Discord • Country Blocked</title>
6+
7+
<meta charset="UTF-8">
8+
9+
<link rel="preconnect" href="https://fonts.gstatic.com">
10+
<link href="https://fonts.googleapis.com/css2?family=Hind:wght@400;600&display=swap" rel="stylesheet">
11+
12+
<style>
13+
html {
14+
height: 100%;
15+
}
16+
17+
body {
18+
background-color: #7289DA;
19+
background-image: url("https://raw.githubusercontent.com/python-discord/branding/master/logos/banner_pattern/banner_pattern.svg");
20+
background-size: 128px;
21+
font-family: "Hind", "Helvetica", "Arial", sans-serif;
22+
display: flex;
23+
align-items: center;
24+
justify-content: center;
25+
height: 100%;
26+
}
27+
28+
h1,
29+
p {
30+
color: black;
31+
padding: 0;
32+
margin: 0;
33+
}
34+
35+
h1 {
36+
margin-bottom: 15px;
37+
font-size: 26px;
38+
}
39+
40+
p {
41+
line-height: 125%;
42+
}
43+
44+
a {
45+
color: #7289DA;
46+
}
47+
48+
.error-box {
49+
display: flex;
50+
flex-direction: column;
51+
max-width: 512px;
52+
background-color: white;
53+
border-radius: 20px;
54+
overflow: hidden;
55+
box-shadow: 5px 7px 40px rgba(0, 0, 0, 0.432);
56+
}
57+
58+
.logo-box {
59+
display: flex;
60+
justify-content: center;
61+
height: 80px;
62+
padding: 15px;
63+
background-color: #758ad4;
64+
}
65+
66+
.content-box {
67+
padding: 25px;
68+
}
69+
</style>
70+
</head>
71+
72+
<body>
73+
<div class="error-box">
74+
<div class="logo-box">
75+
<img
76+
src="https://raw.githubusercontent.com/python-discord/branding/b67897df93e572c1576a9026eb78c785a794d226/logos/logo_banner/logo_site_banner.svg"
77+
alt="Python Discord banner" />
78+
</div>
79+
<div class="content-box">
80+
<h1>This site is blocked in your country.</h1>
81+
<p>Please contact <a href="mailto:ops@pythondiscord.com">ops@pythondiscord.com</a> for more information.</p>
82+
</div>
83+
</div>
84+
</body>
85+
86+
</html>

0 commit comments

Comments
 (0)