Skip to content

Commit 20c819b

Browse files
committed
inline css
1 parent a42e5ee commit 20c819b

12 files changed

+170
-4
lines changed

captchasrv.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ import (
1919
"time"
2020
)
2121

22-
//go:embed form.html success.html
22+
//go:embed font.css form.html success.html
2323
var templateFS embed.FS
2424

25+
//go:embed font/*
26+
var staticFS embed.FS
27+
2528
var (
2629
// Generate using e.g. “openssl rand -hex 32”.
2730
hmacSecretStr = flag.String("hmac_secret_key",
@@ -42,7 +45,7 @@ var (
4245
"host:port to listen on for HTTP requests")
4346
)
4447

45-
var templates = template.Must(template.New("").ParseFS(templateFS, "*.html"))
48+
var templates = template.Must(template.New("").ParseFS(templateFS, "*.html", "*.css"))
4649

4750
func verifyCaptcha(response string) error {
4851
resp, err := http.PostForm("https://www.google.com/recaptcha/api/siteverify",
@@ -165,6 +168,8 @@ func main() {
165168
log.Fatalf("Could not decode -hmac_secret=%q as hex string: %v", *hmacSecretStr, err)
166169
}
167170

171+
http.Handle("/font/", http.FileServer(http.FS(staticFS)))
172+
168173
http.HandleFunc("/submit", func(w http.ResponseWriter, r *http.Request) {
169174
w.Header().Set("X-Frame-Options", "DENY")
170175
w.Header().Set("X-XSS-Protection", "1; mode=block")

font.css

+160
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
/* cyrillic-ext */
2+
@font-face {
3+
font-family: 'Open Sans';
4+
font-style: normal;
5+
font-weight: 400;
6+
font-stretch: 100%;
7+
font-display: swap;
8+
src: url(/font/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSKmu1aB.woff2) format('woff2');
9+
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
10+
}
11+
/* cyrillic */
12+
@font-face {
13+
font-family: 'Open Sans';
14+
font-style: normal;
15+
font-weight: 400;
16+
font-stretch: 100%;
17+
font-display: swap;
18+
src: url(/font/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSumu1aB.woff2) format('woff2');
19+
unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
20+
}
21+
/* greek-ext */
22+
@font-face {
23+
font-family: 'Open Sans';
24+
font-style: normal;
25+
font-weight: 400;
26+
font-stretch: 100%;
27+
font-display: swap;
28+
src: url(/font/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSOmu1aB.woff2) format('woff2');
29+
unicode-range: U+1F00-1FFF;
30+
}
31+
/* greek */
32+
@font-face {
33+
font-family: 'Open Sans';
34+
font-style: normal;
35+
font-weight: 400;
36+
font-stretch: 100%;
37+
font-display: swap;
38+
src: url(/font/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSymu1aB.woff2) format('woff2');
39+
unicode-range: U+0370-03FF;
40+
}
41+
/* hebrew */
42+
@font-face {
43+
font-family: 'Open Sans';
44+
font-style: normal;
45+
font-weight: 400;
46+
font-stretch: 100%;
47+
font-display: swap;
48+
src: url(/font/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTS2mu1aB.woff2) format('woff2');
49+
unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
50+
}
51+
/* vietnamese */
52+
@font-face {
53+
font-family: 'Open Sans';
54+
font-style: normal;
55+
font-weight: 400;
56+
font-stretch: 100%;
57+
font-display: swap;
58+
src: url(/font/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSCmu1aB.woff2) format('woff2');
59+
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
60+
}
61+
/* latin-ext */
62+
@font-face {
63+
font-family: 'Open Sans';
64+
font-style: normal;
65+
font-weight: 400;
66+
font-stretch: 100%;
67+
font-display: swap;
68+
src: url(/font/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSGmu1aB.woff2) format('woff2');
69+
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
70+
}
71+
/* latin */
72+
@font-face {
73+
font-family: 'Open Sans';
74+
font-style: normal;
75+
font-weight: 400;
76+
font-stretch: 100%;
77+
font-display: swap;
78+
src: url(/font/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTS-muw.woff2) format('woff2');
79+
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
80+
}
81+
/* cyrillic-ext */
82+
@font-face {
83+
font-family: 'Open Sans';
84+
font-style: normal;
85+
font-weight: 700;
86+
font-stretch: 100%;
87+
font-display: swap;
88+
src: url(/font/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSKmu1aB.woff2) format('woff2');
89+
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
90+
}
91+
/* cyrillic */
92+
@font-face {
93+
font-family: 'Open Sans';
94+
font-style: normal;
95+
font-weight: 700;
96+
font-stretch: 100%;
97+
font-display: swap;
98+
src: url(/font/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSumu1aB.woff2) format('woff2');
99+
unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
100+
}
101+
/* greek-ext */
102+
@font-face {
103+
font-family: 'Open Sans';
104+
font-style: normal;
105+
font-weight: 700;
106+
font-stretch: 100%;
107+
font-display: swap;
108+
src: url(/font/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSOmu1aB.woff2) format('woff2');
109+
unicode-range: U+1F00-1FFF;
110+
}
111+
/* greek */
112+
@font-face {
113+
font-family: 'Open Sans';
114+
font-style: normal;
115+
font-weight: 700;
116+
font-stretch: 100%;
117+
font-display: swap;
118+
src: url(/font/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSymu1aB.woff2) format('woff2');
119+
unicode-range: U+0370-03FF;
120+
}
121+
/* hebrew */
122+
@font-face {
123+
font-family: 'Open Sans';
124+
font-style: normal;
125+
font-weight: 700;
126+
font-stretch: 100%;
127+
font-display: swap;
128+
src: url(/font/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTS2mu1aB.woff2) format('woff2');
129+
unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
130+
}
131+
/* vietnamese */
132+
@font-face {
133+
font-family: 'Open Sans';
134+
font-style: normal;
135+
font-weight: 700;
136+
font-stretch: 100%;
137+
font-display: swap;
138+
src: url(/font/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSCmu1aB.woff2) format('woff2');
139+
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
140+
}
141+
/* latin-ext */
142+
@font-face {
143+
font-family: 'Open Sans';
144+
font-style: normal;
145+
font-weight: 700;
146+
font-stretch: 100%;
147+
font-display: swap;
148+
src: url(/font/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSGmu1aB.woff2) format('woff2');
149+
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
150+
}
151+
/* latin */
152+
@font-face {
153+
font-family: 'Open Sans';
154+
font-style: normal;
155+
font-weight: 700;
156+
font-stretch: 100%;
157+
font-display: swap;
158+
src: url(/font/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTS-muw.woff2) format('woff2');
159+
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
160+
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

form.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<html>
33
<head>
44
<title>RobustIRC CAPTCHA</title>
5-
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400">
65
<style type="text/css">
6+
{{ template "font.css" }}
77
body {
88
font-family: "Open Sans";
99
}

success.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
<html>
33
<head>
44
<title>RobustIRC CAPTCHA</title>
5-
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400">
65
<style type="text/css">
6+
{{ template "font.css" }}
7+
78
body {
89
font-family: "Open Sans";
910
}

0 commit comments

Comments
 (0)