Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 32fbd7e

Browse files
authored
ent: Add utf charset to doc and add svg based power button - [ch7623] (#239)
* ent: Add utf charset to doc and add svg based power button - [ch7623]
1 parent b039b93 commit 32fbd7e

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

internal/loginsrv/server.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ type Server struct {
1515
func loginRedirectHTMLDoc(message string, status string) string {
1616
htmlTemplate := `<html>
1717
<head>
18+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
1819
<meta name="viewport" content="width=device-width, initial-scale=1" />
1920
<link
2021
rel="icon"
@@ -67,18 +68,28 @@ func loginRedirectHTMLDoc(message string, status string) string {
6768
top: -100px;
6869
opacity: 0;
6970
}
71+
#power svg {
72+
width: 80px;
73+
height: 80px;
74+
}
7075
.power-on {
7176
color: #519a54;
7277
background-color: #a2e0a5;
7378
align-items: center;
7479
animation: glow-green 1s alternate infinite ease-in-out,
7580
slide-down-fade-in 1s normal forwards ease-in-out;
7681
}
82+
.power-on svg {
83+
fill: #519a54;
84+
}
7785
.power-off {
7886
background-color: #dd47641a;
7987
color: #dd4764;
8088
animation: slide-down-fade-in 1s normal forwards ease-in-out;
8189
}
90+
.power-off svg {
91+
fill: #dd4764;
92+
}
8293
#instruction {
8394
position: relative;
8495
top: -100px;
@@ -155,7 +166,14 @@ func loginRedirectHTMLDoc(message string, status string) string {
155166
></path>
156167
</svg>
157168
<div class="power-{{.Status}}" id="power">
158-
<span>&#9211;</span>
169+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 310 310">
170+
<path
171+
d="M221.742,46.906c-7.28-3.954-16.387-1.259-20.341,6.021c-3.955,7.279-1.259,16.386,6.02,20.341 C242.937,92.561,265,129.626,265,170c0,60.654-49.346,110-110,110S45,230.654,45,170c0-40.198,21.921-77.186,57.208-96.531 c7.265-3.982,9.925-13.1,5.943-20.364c-3.983-7.264-13.101-9.925-20.364-5.943C42.891,71.775,15,118.844,15,170 c0,77.196,62.804,140,140,140s140-62.804,140-140C295,118.62,266.929,71.453,221.742,46.906z"
172+
></path>
173+
<path
174+
d="M155,130c8.284,0,15-6.716,15-15V15c0-8.284-6.716-15-15-15c-8.284,0-15,6.716-15,15v100 C140,123.284,146.716,130,155,130z"
175+
></path>
176+
</svg>
159177
</div>
160178
<p id="instruction">{{.Message}}</p>
161179
</div>
@@ -191,7 +209,7 @@ func (srv *Server) ServeHTTP(w http.ResponseWriter, req *http.Request) {
191209
case <-ctx.Done():
192210
// Client disconnect. Nothing to do.
193211
case srv.TokenChan <- token:
194-
w.Header().Set("Content-Type", "text/html")
212+
w.Header().Set("Content-Type", "text/html; charset=UTF-8")
195213
w.WriteHeader(http.StatusOK)
196214
_, _ = fmt.Fprint(w, loginRedirectHTMLDoc("You are logged in, you may close this window now.", "on"))
197215
}

0 commit comments

Comments
 (0)