summaryrefslogtreecommitdiff
path: root/src/server.go
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-04-20 16:22:07 +0200
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-04-20 16:22:07 +0200
commitb73e1489b06fd4546da6ba32697331584db02e71 (patch)
tree3893b79958b551d2552efb6d20e729d916346ec6 /src/server.go
parent63dfe633c7e62f570d44af6e0ea17967155cb5db (diff)
Refactor: Eliminate most uses of pointers in structs
Diffstat (limited to 'src/server.go')
-rw-r--r--src/server.go19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/server.go b/src/server.go
index b7d55cb..7e323f6 100644
--- a/src/server.go
+++ b/src/server.go
@@ -6,11 +6,11 @@ import (
)
type Server struct {
- BaseURL string `json:"base_url"`
- Endpoints *ServerEndpoints `json:"endpoints"`
- OAuth *OAuth `json:"oauth"`
- Profiles *ServerProfileInfo `json:"profiles"`
- ProfilesRaw string `json:"profiles_raw"`
+ BaseURL string `json:"base_url"`
+ Endpoints ServerEndpoints `json:"endpoints"`
+ OAuth OAuth `json:"oauth"`
+ Profiles ServerProfileInfo `json:"profiles"`
+ ProfilesRaw string `json:"profiles_raw"`
}
type ServerProfile struct {
@@ -56,12 +56,7 @@ func (server *Server) Initialize(url string) error {
}
func (server *Server) NeedsRelogin() bool {
- // Server has no oauth tokens
- if server.OAuth == nil || server.OAuth.Token == nil {
- return true
- }
-
- // Server has oauth tokens, check if they need a relogin
+ // Check if OAuth needs relogin
return server.OAuth.NeedsRelogin()
}
@@ -73,7 +68,7 @@ func (server *Server) GetEndpoints() error {
return bodyErr
}
- endpoints := &ServerEndpoints{}
+ endpoints := ServerEndpoints{}
jsonErr := json.Unmarshal(body, &endpoints)
if jsonErr != nil {