Add asset generation.

This commit is contained in:
Justin Hawkins 2020-03-20 05:49:12 +10:30
parent 1ef062d19c
commit 752ff42a19
2 changed files with 7 additions and 5 deletions

4
dau.go
View File

@ -1,5 +1,7 @@
package main package main
//go:generate go-bindata -pkg assets -o assets/static.go -prefix data/ data
import ( import (
"bytes" "bytes"
"encoding/json" "encoding/json"
@ -25,7 +27,7 @@ import (
"github.com/skratchdot/open-golang/open" "github.com/skratchdot/open-golang/open"
"golang.org/x/image/font/inconsolata" "golang.org/x/image/font/inconsolata"
"discord-auto-upload/web" "github.com/tardisx/discord-auto-upload/web"
) )
const currentVersion = "0.7" const currentVersion = "0.7"

View File

@ -1,11 +1,11 @@
package web package web
import ( import (
"discord-auto-upload/asset"
"encoding/json" "encoding/json"
"fmt" "fmt"
"log" "log"
"net/http" "net/http"
"github.com/tardisx/discord-auto-upload/assets"
) )
// DAUWebServer - stuff for the web server // DAUWebServer - stuff for the web server
@ -31,13 +31,13 @@ var wsConfig DAUWebServer
// } // }
func getIndex(w http.ResponseWriter, r *http.Request) { func getIndex(w http.ResponseWriter, r *http.Request) {
data, err := asset.Asset("index.html") data, err := assets.Asset("index.html")
if err != nil { if err != nil {
// Asset was not found. // Asset was not found.
fmt.Fprintln(w, err) fmt.Fprintln(w, err)
} }
w.Write(data) w.Write(data)
//
} }
func getSetWebhook(w http.ResponseWriter, r *http.Request) { func getSetWebhook(w http.ResponseWriter, r *http.Request) {