Prechádzať zdrojové kódy

Extract default user agent as constant

ayntgl 4 rokov pred
rodič
commit
783903e4ba
1 zmenil súbory, kde vykonal 8 pridanie a 5 odobranie
  1. 8 5
      config.go

+ 8 - 5
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",