ipn,tailfs: tie TailFS share configuration to user profile

Previously, the configuration of which folders to share persisted across
profile changes. Now, it is tied to the user's profile.

Updates tailscale/corp#16827

Signed-off-by: Percy Wegmann <percy@tailscale.com>
This commit is contained in:
Percy Wegmann
2024-03-07 10:56:11 -06:00
committed by Percy Wegmann
parent 16ae0f65c0
commit 6c160e6321
16 changed files with 330 additions and 120 deletions
+5 -3
View File
@@ -13,6 +13,7 @@ import (
"os"
"path"
"path/filepath"
"slices"
"sync"
"testing"
"time"
@@ -206,13 +207,14 @@ func (s *system) addShare(remoteName, shareName string, permission tailfs.Permis
r.shares[shareName] = f
r.permissions[shareName] = permission
shares := make(map[string]*tailfs.Share, len(r.shares))
shares := make([]*tailfs.Share, 0, len(r.shares))
for shareName, folder := range r.shares {
shares[shareName] = &tailfs.Share{
shares = append(shares, &tailfs.Share{
Name: shareName,
Path: folder,
}
})
}
slices.SortFunc(shares, tailfs.CompareShares)
r.fs.SetShares(shares)
r.fileServer.SetShares(r.shares)
}