feat: serve robots.txt, subtitle
This commit is contained in:
parent
b19919399f
commit
f4a348b00f
@ -11,3 +11,6 @@ var PublicFS embed.FS
|
|||||||
//go:embed assets/*
|
//go:embed assets/*
|
||||||
var AssetsFS embed.FS
|
var AssetsFS embed.FS
|
||||||
|
|
||||||
|
//go:embed static/robots.txt
|
||||||
|
var RobotsFS embed.FS
|
||||||
|
|
||||||
|
13
main.go
13
main.go
@ -135,6 +135,19 @@ func main() {
|
|||||||
handler.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.FS(PublicFS))))
|
handler.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.FS(PublicFS))))
|
||||||
handler.Handle("/assets/", http.FileServer(http.FS(AssetsFS)))
|
handler.Handle("/assets/", http.FileServer(http.FS(AssetsFS)))
|
||||||
|
|
||||||
|
handler.HandleFunc(
|
||||||
|
"/robots.txt",
|
||||||
|
func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
robotsFile, err := RobotsFS.ReadFile("static/robots.txt")
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err.Error())
|
||||||
|
w.WriteHeader(500)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
w.Write(robotsFile)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
handler.HandleFunc(
|
handler.HandleFunc(
|
||||||
"/download",
|
"/download",
|
||||||
func(w http.ResponseWriter, r *http.Request) {
|
func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
1
static/robots.txt
Normal file
1
static/robots.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
# Go carzy
|
@ -11,7 +11,12 @@
|
|||||||
<title>Viddle your fiddle</title>
|
<title>Viddle your fiddle</title>
|
||||||
</head>
|
</head>
|
||||||
<main class="container">
|
<main class="container">
|
||||||
<h1>Viddle your fiddle</h1>
|
<div class="headings">
|
||||||
|
<h3>
|
||||||
|
Viddle your fiddle
|
||||||
|
<h4>Grab your videos for safe keeping!</h4>
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
<form hx-post="/download" hx-target="#get-btn" hx-swap="outerHTML" hx-indicator="#progress">
|
<form hx-post="/download" hx-target="#get-btn" hx-swap="outerHTML" hx-indicator="#progress">
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<div hx-target="this" hx-swap="outerHTML">
|
<div hx-target="this" hx-swap="outerHTML">
|
||||||
|
Loading…
Reference in New Issue
Block a user