diff --git a/.gitm.toml b/.gitm.toml
new file mode 100644
index 0000000..091896b
--- /dev/null
+++ b/.gitm.toml
@@ -0,0 +1,4 @@
+[repos]
+origin = "ssh://git@192.168.100.62:2222/Arsen6331/simpledash.git"
+gitlab = "git@gitlab.com:moussaelianarsen/simpledash.git"
+github = "git@github.com:Arsen6331/simpledash.git"
diff --git a/resources/templates/cards/api.html b/resources/templates/cards/api.html
index 3b6de65..21a591a 100644
--- a/resources/templates/cards/api.html
+++ b/resources/templates/cards/api.html
@@ -29,5 +29,8 @@
document.getElementById("{{printf `APIElement%d_%s` $index $randID}}").innerHTML = `{{unescJS (trim $fmtStr)}}`
{{end}}
}
+ {{range $key, $value := .Data.headers}}
+ request.setRequestHeader("{{$key}}", "{{$value}}")
+ {{end}}
request.send()
\ No newline at end of file
diff --git a/resources/templates/cards/weather.html b/resources/templates/cards/weather.html
index 7bb7f4c..4f7fa97 100644
--- a/resources/templates/cards/weather.html
+++ b/resources/templates/cards/weather.html
@@ -24,10 +24,10 @@
diff --git a/routes.go b/routes.go
index 4f16cfe..ab7bd78 100644
--- a/routes.go
+++ b/routes.go
@@ -205,6 +205,7 @@ func registerRoutes(app App) {
}
// Create new HTTP client with 5 second timeout
client := http.Client{Timeout: 5 * time.Second}
+ proxyReq.Header = req.Header
// Use client to do request created above
proxyRes, err := client.Do(proxyReq)
if err != nil {
@@ -214,6 +215,24 @@ func registerRoutes(app App) {
}
// Close proxy response body at end of function
defer proxyRes.Body.Close()
+ /*
+ var proxyReader io.Reader
+ switch proxyRes.Header.Get("Content-Type") {
+ case "application/x-gzip":
+ gzReader, err := gzip.NewReader(proxyRes.Body)
+ if err != nil {
+ httpError(res, app.Templates["error"], app.Config, http.StatusInternalServerError, "Decompressing response failed")
+ Log.Warn().Err(err).Msg("Error executing request for proxy")
+ return
+ }
+ proxyReader = gzReader
+ } else {
+ proxyReader = proxyRes.Body
+ }
+ */
+ for key := range proxyRes.Header {
+ res.Header().Set(key, proxyRes.Header.Get(key))
+ }
// Copy data from proxy response to response
io.Copy(res, proxyRes.Body)
} else {