From 783903e4ba6a046b9bab8648ea9036d750d6b952 Mon Sep 17 00:00:00 2001 From: ayntgl Date: Fri, 15 Oct 2021 23:25:50 +0400 Subject: [PATCH] Extract default user agent as constant --- config.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/config.go b/config.go index 3a2676d..e556b90 100644 --- a/config.go +++ b/config.go @@ -6,6 +6,11 @@ import ( "github.com/BurntSushi/toml" ) +const userAgent = "" + + "Mozilla/5.0 (X11; Linux x86_64) " + + "AppleWebKit/537.36 (KHTML, like Gecko) " + + "Chrome/92.0.4515.131 Safari/537.36" + var conf *config type keybindingsChannelsTree struct { @@ -82,7 +87,8 @@ func loadConfig() *config { panic(err) } - configPath = configPath + "/discordo.toml" + configPath += "/discordo.toml" + var c config if _, err = os.Stat(configPath); os.IsNotExist(err) { f, err := os.Create(configPath) @@ -93,10 +99,7 @@ func loadConfig() *config { c.Mouse = true c.Notifications = true - c.UserAgent = "" + - "Mozilla/5.0 (X11; Linux x86_64) " + - "AppleWebKit/537.36 (KHTML, like Gecko) " + - "Chrome/92.0.4515.131 Safari/537.36" + c.UserAgent = userAgent c.GetMessagesLimit = 50 c.Theme = theme{ Border: "white",