summaryrefslogtreecommitdiff
path: root/grimtube.go
diff options
context:
space:
mode:
authorJulian Hurst <julian.hurst92@gmail.com>2021-07-08 12:54:05 +0200
committerJulian Hurst <julian.hurst92@gmail.com>2021-07-08 12:54:05 +0200
commit513b1f4d83d8267f9b8c7299822c40e9d4d77196 (patch)
treea2b6d0f1c74bf2a8741977beb7c27bdf0380b10b /grimtube.go
parent124be83ec299a4b9502a469cef75b7b9fe971756 (diff)
downloadgrimtube-513b1f4d83d8267f9b8c7299822c40e9d4d77196.tar.gz
Add video download server support
Diffstat (limited to 'grimtube.go')
-rw-r--r--grimtube.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/grimtube.go b/grimtube.go
index c635418..bd700fb 100644
--- a/grimtube.go
+++ b/grimtube.go
@@ -14,6 +14,7 @@ import (
)
var docPath string
+var dlsrv string
func getLangs() []string {
return []string{"en", "fr", "de", "ja", "ru"}
@@ -67,6 +68,7 @@ func index(w http.ResponseWriter, r *http.Request) {
Items []ytparser.Item
Page int
Lang string
+ Dlsrv string
}{
getLangs(),
getOrders(),
@@ -75,6 +77,7 @@ func index(w http.ResponseWriter, r *http.Request) {
items,
page,
lang,
+ dlsrv,
}
serve(w, "templates/search.html", data)
}
@@ -118,6 +121,7 @@ func search(w http.ResponseWriter, r *http.Request) {
Langs []string
Order string
Orders []string
+ Dlsrv string
}{
items,
term,
@@ -126,6 +130,7 @@ func search(w http.ResponseWriter, r *http.Request) {
getLangs(),
order,
getOrders(),
+ dlsrv,
}
serve(w, "templates/search.html", data)
}
@@ -150,8 +155,10 @@ func favicon(w http.ResponseWriter, r *http.Request) {
func main() {
port := flag.Int("p", 8080, "The port to bind to.")
dir := flag.String("d", "", "Location of the templates and static resources.")
+ dl := flag.String("dlsrv", "", "Link to a download server.")
flag.Parse()
docPath = *dir
+ dlsrv = *dl
fs := http.FileServer(http.Dir("static"))
http.Handle("/static/", http.StripPrefix(path.Join(docPath, "/static/"), fs))
http.HandleFunc("/favicon.ico", favicon)