No longer hide the web UI controls for the new untrusted/encrypted device feature. Testing hasn't been very widespread, but there has been some and quite a few bugs have been caught and fixed. I believe its time to not hide it anymore, and cautiously recommend usage. E.g. mention that the feature hasn't been widely used yet and anyone using it is an early adopter, but drop the bit about not using it with production data. We can maybe stress the need for backups in general and especially using this.
This commit is contained in:
+1
-6
@@ -65,7 +65,6 @@ const (
|
||||
EventSubBufferSize = 1000
|
||||
defaultEventTimeout = time.Minute
|
||||
httpsCertLifetimeDays = 820
|
||||
featureFlagUntrusted = "untrusted"
|
||||
)
|
||||
|
||||
type service struct {
|
||||
@@ -105,7 +104,7 @@ func New(id protocol.DeviceID, cfg config.Wrapper, assetDir, tlsDefaultCommonNam
|
||||
return &service{
|
||||
id: id,
|
||||
cfg: cfg,
|
||||
statics: newStaticsServer(cfg.GUI().Theme, assetDir, cfg.Options().FeatureFlag(featureFlagUntrusted)),
|
||||
statics: newStaticsServer(cfg.GUI().Theme, assetDir),
|
||||
model: m,
|
||||
eventSubs: map[events.EventType]events.BufferedSubscription{
|
||||
DefaultEventMask: defaultSub,
|
||||
@@ -461,10 +460,6 @@ func (s *service) CommitConfiguration(from, to config.Configuration) bool {
|
||||
// No action required when this changes, so mask the fact that it changed at all.
|
||||
from.GUI.Debugging = to.GUI.Debugging
|
||||
|
||||
if untrusted := to.Options.FeatureFlag(featureFlagUntrusted); untrusted != from.Options.FeatureFlag(featureFlagUntrusted) {
|
||||
s.statics.setUntrusted(untrusted)
|
||||
}
|
||||
|
||||
if to.GUI == from.GUI {
|
||||
// No GUI changes, we're done here.
|
||||
return true
|
||||
|
||||
+1
-31
@@ -30,17 +30,15 @@ type staticsServer struct {
|
||||
mut sync.RWMutex
|
||||
theme string
|
||||
lastThemeChange time.Time
|
||||
untrusted bool
|
||||
}
|
||||
|
||||
func newStaticsServer(theme, assetDir string, untrusted bool) *staticsServer {
|
||||
func newStaticsServer(theme, assetDir string) *staticsServer {
|
||||
s := &staticsServer{
|
||||
assetDir: assetDir,
|
||||
assets: auto.Assets(),
|
||||
mut: sync.NewRWMutex(),
|
||||
theme: theme,
|
||||
lastThemeChange: time.Now().UTC(),
|
||||
untrusted: untrusted,
|
||||
}
|
||||
|
||||
seen := make(map[string]struct{})
|
||||
@@ -62,10 +60,6 @@ func newStaticsServer(theme, assetDir string, untrusted bool) *staticsServer {
|
||||
}
|
||||
}
|
||||
|
||||
if untrusted {
|
||||
l.Infoln(`Feature flag "untrusted":`, untrusted)
|
||||
}
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
@@ -94,7 +88,6 @@ func (s *staticsServer) serveAsset(w http.ResponseWriter, r *http.Request) {
|
||||
s.mut.RLock()
|
||||
theme := s.theme
|
||||
modificationTime := s.lastThemeChange
|
||||
untrusted := s.untrusted
|
||||
s.mut.RUnlock()
|
||||
|
||||
// If path starts with special prefix, get theme and file from path
|
||||
@@ -112,37 +105,21 @@ func (s *staticsServer) serveAsset(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// Check for an override for the current theme.
|
||||
if untrusted && s.serveFromAssetDir(file, theme+"/untrusted", w, r) {
|
||||
l.Debugln("serving", file, "from override untrusted")
|
||||
return
|
||||
}
|
||||
if s.serveFromAssetDir(file, theme, w, r) {
|
||||
return
|
||||
}
|
||||
|
||||
// Check for a compiled in asset for the current theme.
|
||||
if untrusted && s.serveFromAssets(file, theme+"/untrusted", modificationTime, w, r) {
|
||||
l.Debugln("serving", file, "from compiled untrusted")
|
||||
return
|
||||
}
|
||||
if s.serveFromAssets(file, theme, modificationTime, w, r) {
|
||||
return
|
||||
}
|
||||
|
||||
// Check for an overridden default asset.
|
||||
if untrusted && s.serveFromAssetDir(file, config.DefaultTheme+"/untrusted", w, r) {
|
||||
l.Debugln("serving", file, "from override untrusted")
|
||||
return
|
||||
}
|
||||
if s.serveFromAssetDir(file, config.DefaultTheme, w, r) {
|
||||
return
|
||||
}
|
||||
|
||||
// Check for a compiled in default asset.
|
||||
if untrusted && s.serveFromAssets(file, config.DefaultTheme+"/untrusted", modificationTime, w, r) {
|
||||
l.Debugln("serving", file, "from compiled untrusted")
|
||||
return
|
||||
}
|
||||
if s.serveFromAssets(file, config.DefaultTheme, modificationTime, w, r) {
|
||||
return
|
||||
}
|
||||
@@ -189,13 +166,6 @@ func (s *staticsServer) setTheme(theme string) {
|
||||
s.mut.Unlock()
|
||||
}
|
||||
|
||||
func (s *staticsServer) setUntrusted(enabled bool) {
|
||||
s.mut.Lock()
|
||||
l.Infoln(`Feature flag "untrusted":`, enabled)
|
||||
s.untrusted = enabled
|
||||
s.mut.Unlock()
|
||||
}
|
||||
|
||||
func (s *staticsServer) String() string {
|
||||
return fmt.Sprintf("staticsServer@%p", s)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user