From 5b456afb49bfa6ff1567510bc1d9362377d32216 Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Sun, 4 Oct 2020 22:58:03 +0200 Subject: New config format and new features We're now using json as a config format instead of our weird own format. The weather icon is now optional, simply don't define WeatherPlace in your config. You can now specify which subreddit to get background images from. The default is still /r/EarthPorn. --- http_getter/http_getter.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 http_getter/http_getter.go (limited to 'http_getter') diff --git a/http_getter/http_getter.go b/http_getter/http_getter.go new file mode 100644 index 0000000..5df3ac2 --- /dev/null +++ b/http_getter/http_getter.go @@ -0,0 +1,19 @@ +package http_getter + +import ( + "net/http" +) + +// Get is like http.Get, but we're sending our own user agent. +func Get(url string) (*http.Response, error) { + client := &http.Client{} + + req, err := http.NewRequest("GET", url, nil) + if err != nil { + return nil, err + } + + req.Header.Add("User-Agent", "github.com/slivasur/startpage") + + return client.Do(req) +} -- cgit v1.2.3-70-g09d2