aboutsummaryrefslogtreecommitdiff
path: root/cmd/web/download.go
diff options
context:
space:
mode:
authorMitch Riedstra <mitch@riedstra.us>2021-03-04 18:50:47 -0500
committerMitch Riedstra <mitch@riedstra.us>2021-03-04 18:50:47 -0500
commit3b6f5647b0689abf04be73c3cf00297051753435 (patch)
tree3de6871abf37849c1e9f86dfc90ee2b3ed74c66e /cmd/web/download.go
parenteaf02771d767e4745572d9b00e71e138ee030e60 (diff)
downloadsteam-export-3b6f5647b0689abf04be73c3cf00297051753435.tar.gz
steam-export-3b6f5647b0689abf04be73c3cf00297051753435.tar.xz
Refactor. Pull most of the functions into methods off of an App struct.
Kill most global variables.
Diffstat (limited to 'cmd/web/download.go')
-rw-r--r--cmd/web/download.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/cmd/web/download.go b/cmd/web/download.go
index f8ba057..0238c8c 100644
--- a/cmd/web/download.go
+++ b/cmd/web/download.go
@@ -9,13 +9,13 @@ import (
"github.com/gorilla/mux"
)
-func gameDownloader(w http.ResponseWriter, r *http.Request) {
+func (a *App) HandleDownload(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
game := vars["game"]
- Lib.Lock()
- g, ok := Lib.Games[game]
- Lib.Unlock()
+ a.Library.Lock()
+ g, ok := a.Library.Games[game]
+ a.Library.Unlock()
if !ok {
Logger.Printf("Missing: %s", game)
http.Error(w, "Game is missing", 404)