diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2023-05-15 11:52:20 +0200 |
|---|---|---|
| committer | Jeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com> | 2023-09-25 09:43:37 +0200 |
| commit | 76e709193614b3668d3c31a078e667473af20369 (patch) | |
| tree | 66f0e6caf03e19b5034c687e3b4c3cbd904be03a /internal/server | |
| parent | c1847c9cf76cb17e5b027ac4c0aea99d15852d45 (diff) | |
Initial i18n implementation
Diffstat (limited to 'internal/server')
| -rw-r--r-- | internal/server/server.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/internal/server/server.go b/internal/server/server.go index c34158a..45d6ccd 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -77,7 +77,7 @@ func CurrentProfile(srv Server) (*profile.Profile, error) { return nil, errors.Errorf("profile not found: " + pID) } -func ValidProfiles(srv Server, wireguardSupport bool) (*[]profile.Profile, error) { +func ValidProfiles(srv Server, wireguardSupport bool) (*profile.Info, error) { // No error wrapping here otherwise we wrap it too much b, err := srv.Base() if err != nil { @@ -87,7 +87,12 @@ func ValidProfiles(srv Server, wireguardSupport bool) (*[]profile.Profile, error if len(ps) == 0 { return nil, errors.Errorf("no profiles found with supported protocols") } - return &ps, nil + return &profile.Info{ + Current: b.Profiles.Current, + Info: profile.ListInfo{ + ProfileList: ps, + }, + }, nil } func Profile(srv Server, id string) error { @@ -190,6 +195,7 @@ func HasValidProfile(ctx context.Context, srv Server, wireguardSupport bool) (bo } } + // there are multiple profiles and no selection has been made if len(b.Profiles.Info.ProfileList) != 1 && b.Profiles.Current == "" { return false, nil } |
