Ran formatter and fixed some lint issues

This commit is contained in:
Stash Dev
2019-02-14 14:53:32 -08:00
parent 14df7b0700
commit 1d00b2b36f
97 changed files with 709 additions and 642 deletions

View File

@@ -83,7 +83,7 @@ func Start() {
// Serve the setup UI
r.HandleFunc("/setup*", func(w http.ResponseWriter, r *http.Request) {
ext := path.Ext(r.URL.Path)
if ext == ".html" || ext == "" {
if ext == ".html" || ext == "" {
data := setupUIBox.Bytes("index.html")
_, _ = w.Write(data)
} else {
@@ -126,9 +126,9 @@ func Start() {
_ = os.Mkdir(downloads, 0755)
config := &jsonschema.Config{
Stash: stash,
Metadata: metadata,
Cache: cache,
Stash: stash,
Metadata: metadata,
Cache: cache,
Downloads: downloads,
}
if err := manager.GetInstance().SaveConfig(config); err != nil {
@@ -142,7 +142,7 @@ func Start() {
// Serve the angular app
r.HandleFunc("/*", func(w http.ResponseWriter, r *http.Request) {
ext := path.Ext(r.URL.Path)
if ext == ".html" || ext == "" {
if ext == ".html" || ext == "" {
data := uiBox.Bytes("index.html")
_, _ = w.Write(data)
} else {
@@ -151,12 +151,12 @@ func Start() {
})
httpsServer := &http.Server{
Addr: ":"+httpsPort,
Handler: r,
Addr: ":" + httpsPort,
Handler: r,
TLSConfig: makeTLSConfig(),
}
server := &http.Server{
Addr: ":"+httpPort,
Addr: ":" + httpPort,
Handler: r,
}
@@ -187,13 +187,14 @@ func makeTLSConfig() *tls.Config {
return tlsConfig
}
type contextKey struct {
name string
}
var (
BaseURLCtxKey = &contextKey{"BaseURL"}
)
func BaseURLMiddleware(next http.Handler) http.Handler {
fn := func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
@@ -225,4 +226,4 @@ func ConfigCheckMiddleware(next http.Handler) http.Handler {
}
next.ServeHTTP(w, r)
})
}
}