diff --git a/access/account/types.go b/access/account/types.go index 11b2dfb..f92f9f6 100644 --- a/access/account/types.go +++ b/access/account/types.go @@ -72,7 +72,7 @@ func (u *User) MayUseSPN() bool { // MayUsePrioritySupport returns whether the user may currently use the priority support. func (u *User) MayUsePrioritySupport() bool { - return u.MayUse(FeaturePrioritySupport) + return u.MayUse(FeatureSafingSupport) } // MayUse returns whether the user may currently use the feature identified by @@ -120,11 +120,11 @@ type FeatureID string // A list of all supported features. const ( - FeatureSPN = FeatureID("spn") - FeaturePrioritySupport = FeatureID("support") - FeatureHistory = FeatureID("history") - FeatureBWVis = FeatureID("bw-vis") - FeatureVPNCompat = FeatureID("vpn-compat") + FeatureSPN = FeatureID("spn") + FeatureSafingSupport = FeatureID("support") + FeatureHistory = FeatureID("history") + FeatureBWVis = FeatureID("bw-vis") + FeatureVPNCompat = FeatureID("vpn-compat") ) // Plan describes an SPN subscription plan. diff --git a/access/api.go b/access/api.go index 95e8214..12ccc44 100644 --- a/access/api.go +++ b/access/api.go @@ -78,19 +78,19 @@ func registerAPIEndpoints() error { } if err := api.RegisterEndpoint(api.Endpoint{ - Path: `account/features/{id:[A-Za-z0-9_]+}/icon`, + Path: `account/features/{id:[A-Za-z0-9_-]+}/icon`, Read: api.PermitUser, ReadMethod: http.MethodGet, Name: "Returns the image of the featuare", MimeType: "image/svg+xml", DataFunc: func(ar *api.Request) (data []byte, err error) { - featureId, ok := ar.URLVars["id"] + featureID, ok := ar.URLVars["id"] if !ok { return nil, fmt.Errorf("invalid feature id") } for _, feature := range features { - if feature.ID == featureId { + if feature.ID == featureID { return []byte(feature.icon), nil } } diff --git a/access/features.go b/access/features.go index 1c5c583..ddcda61 100644 --- a/access/features.go +++ b/access/features.go @@ -4,15 +4,15 @@ import "github.com/safing/spn/access/account" // Feature describes a notable part of the program. type Feature struct { - ID string Name string + ID string + RequiredFeatureID account.FeatureID ConfigKey string ConfigScope string - RequiredFeatureID account.FeatureID // FIXME: can more than one be required? InPackage *Package Comment string Beta bool - CommingSoon bool + ComingSoon bool icon string } @@ -42,8 +42,8 @@ var ( } features = []Feature{ { - ID: "secure_dns", Name: "Secure DNS", + ID: "dns", ConfigScope: "dns/", InPackage: packageFree, icon: ` @@ -54,8 +54,8 @@ var ( `, }, { - ID: "privacy_filter", Name: "Privacy Filter", + ID: "filter", ConfigScope: "filter/", InPackage: packageFree, icon: ` @@ -65,12 +65,12 @@ var ( `, }, { - ID: "network_history", Name: "Network History", + ID: string(account.FeatureHistory), + RequiredFeatureID: account.FeatureHistory, ConfigKey: "history/enable", ConfigScope: "history/", InPackage: packagePlus, - RequiredFeatureID: account.FeatureHistory, Beta: true, icon: ` @@ -80,11 +80,11 @@ var ( `, }, { - ID: "bandwith_vis", Name: "Bandwidth Visibility", - InPackage: packagePlus, + ID: string(account.FeatureBWVis), RequiredFeatureID: account.FeatureBWVis, - CommingSoon: true, + InPackage: packagePlus, + Beta: true, icon: `