From 4fca210846b28caf1372edb5ec0abe8193d3ff8b Mon Sep 17 00:00:00 2001 From: "kali kaneko (leap communications)" Date: Wed, 24 Nov 2021 16:18:51 +0100 Subject: [feat] hook motd during bootstrap some refactor, plus fix docs --- pkg/backend/init.go | 6 ++++-- pkg/backend/status.go | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'pkg/backend') diff --git a/pkg/backend/init.go b/pkg/backend/init.go index 70a3582..c6d713b 100644 --- a/pkg/backend/init.go +++ b/pkg/backend/init.go @@ -17,8 +17,10 @@ func initializeContext(opts *InitOpts) { var st status = off // TODO - now there's really no need to dance between opts and config anymore - // but this was the simplest transition. We should probably keep the multi-provider config in the backend too, and just - // switch the "active" here in the ctx, after the user has selected one in the combobox. + // but this was the simplest transition. We should probably keep the + // multi-provider config in the backend too, and just + // switch the "active" here in the ctx, after the user has selected one + // in the combobox. ctx = &connectionCtx{ AppName: opts.ProviderOptions.AppName, Provider: opts.ProviderOptions.Provider, diff --git a/pkg/backend/status.go b/pkg/backend/status.go index 79b70ff..f21fddd 100644 --- a/pkg/backend/status.go +++ b/pkg/backend/status.go @@ -54,6 +54,8 @@ type connectionCtx struct { UseUDP bool `json:"udp"` ManualLocation bool `json:"manualLocation"` IsReady bool `json:"isReady"` + CanUpgrade bool `json:"canUpgrade"` + Motd string `json:"motd"` bm bitmask.Bitmask autostart bitmask.Autostart cfg *config.Config @@ -72,6 +74,8 @@ func (c *connectionCtx) toJson() ([]byte, error) { c.Transport = transport c.UseUDP = c.cfg.UDP // TODO initialize bitmask too c.ManualLocation = c.bm.IsManualLocation() + c.CanUpgrade = c.bm.CanUpgrade() + c.Motd = c.bm.GetMotd() } defer statusMutex.Unlock() b, err := json.Marshal(c) -- cgit v1.2.3