bump reva

Signed-off-by: jkoberg <jkoberg@owncloud.com>
This commit is contained in:
jkoberg
2023-06-16 14:56:02 +02:00
parent 99559f5ea2
commit 48325b9991
8 changed files with 31 additions and 82 deletions
+12 -8
View File
@@ -69,6 +69,7 @@ type config struct {
JWTSecret string `mapstructure:"jwt_secret" docs:";The JWT secret to be used to retrieve the token TTL."`
AppDesktopOnly bool `mapstructure:"app_desktop_only" docs:"false;Specifies if the app can be opened only on desktop."`
InsecureConnections bool `mapstructure:"insecure_connections"`
AppDisableChat bool `mapstructure:"app_disable_chat"`
}
func parseConfig(m map[string]interface{}) (*config, error) {
@@ -246,20 +247,23 @@ func (p *wopiProvider) GetAppURL(ctx context.Context, resource *provider.Resourc
return nil, err
}
appFullURL := result["app-url"].(string)
url, err := url.Parse(result["app-url"].(string))
if err != nil {
return nil, err
}
urlQuery := url.Query()
if language != "" {
url, err := url.Parse(appFullURL)
if err != nil {
return nil, err
}
urlQuery := url.Query()
urlQuery.Set("ui", language) // OnlyOffice
urlQuery.Set("lang", language) // Collabora
urlQuery.Set("UI_LLCC", language) // Office365
url.RawQuery = urlQuery.Encode()
appFullURL = url.String()
}
if p.conf.AppDisableChat {
urlQuery.Set("dchat", "1") // OnlyOffice disable chat
}
url.RawQuery = urlQuery.Encode()
appFullURL := url.String()
// Depending on whether wopi server returned any form parameters or not,
// we decide whether the request method is POST or GET
@@ -43,8 +43,7 @@ const tracerName = "providercache"
// Cache holds share information structured by provider and space
type Cache struct {
lockMapLock sync.Mutex
lockMap map[string]*sync.Mutex
lockMap sync.Map
Providers map[string]*Spaces
@@ -106,16 +105,9 @@ func (s *Shares) UnmarshalJSON(data []byte) error {
// LockSpace locks the cache for a given space and returns an unlock function
func (c *Cache) LockSpace(spaceID string) func() {
lock := c.lockMap[spaceID]
if lock == nil {
c.lockMapLock.Lock()
lock = c.lockMap[spaceID]
if lock == nil {
c.lockMap[spaceID] = &sync.Mutex{}
lock = c.lockMap[spaceID]
}
c.lockMapLock.Unlock()
}
v, _ := c.lockMap.LoadOrStore(spaceID, &sync.Mutex{})
lock := v.(*sync.Mutex)
lock.Lock()
return func() { lock.Unlock() }
}
@@ -126,7 +118,7 @@ func New(s metadata.Storage, ttl time.Duration) Cache {
Providers: map[string]*Spaces{},
storage: s,
ttl: ttl,
lockMap: map[string]*sync.Mutex{},
lockMap: sync.Map{},
}
}
@@ -44,8 +44,7 @@ const tracerName = "receivedsharecache"
// It functions as an in-memory cache with a persistence layer
// The storage is sharded by user
type Cache struct {
lockMapLock sync.Mutex
lockMap map[string]*sync.Mutex
lockMap sync.Map
ReceivedSpaces map[string]*Spaces
@@ -79,21 +78,14 @@ func New(s metadata.Storage, ttl time.Duration) Cache {
ReceivedSpaces: map[string]*Spaces{},
storage: s,
ttl: ttl,
lockMap: map[string]*sync.Mutex{},
lockMap: sync.Map{},
}
}
func (c *Cache) lockUser(userID string) func() {
lock := c.lockMap[userID]
if lock == nil {
c.lockMapLock.Lock()
lock = c.lockMap[userID]
if lock == nil {
c.lockMap[userID] = &sync.Mutex{}
lock = c.lockMap[userID]
}
c.lockMapLock.Unlock()
}
v, _ := c.lockMap.LoadOrStore(userID, &sync.Mutex{})
lock := v.(*sync.Mutex)
lock.Lock()
return func() { lock.Unlock() }
}
@@ -43,8 +43,7 @@ const tracerName = "sharecache"
// It functions as an in-memory cache with a persistence layer
// The storage is sharded by user/group
type Cache struct {
lockMapLock sync.Mutex
lockMap map[string]*sync.Mutex
lockMap sync.Map
UserShares map[string]*UserShareCache
@@ -69,16 +68,9 @@ type SpaceShareIDs struct {
}
func (c *Cache) lockUser(userID string) func() {
lock := c.lockMap[userID]
if lock == nil {
c.lockMapLock.Lock()
lock = c.lockMap[userID]
if lock == nil {
c.lockMap[userID] = &sync.Mutex{}
lock = c.lockMap[userID]
}
c.lockMapLock.Unlock()
}
v, _ := c.lockMap.LoadOrStore(userID, &sync.Mutex{})
lock := v.(*sync.Mutex)
lock.Lock()
return func() { lock.Unlock() }
}
@@ -91,7 +83,7 @@ func New(s metadata.Storage, namespace, filename string, ttl time.Duration) Cach
namespace: namespace,
filename: filename,
ttl: ttl,
lockMap: map[string]*sync.Mutex{},
lockMap: sync.Map{},
}
}
@@ -294,37 +294,6 @@ func ReadNode(ctx context.Context, lu PathLookup, spaceID, nodeID string, canLis
}
return nil, errtypes.InternalError("Missing parent ID on node")
}
// TODO why do we stat the parent? to determine if the current node is in the trash we would need to traverse all parents...
// we need to traverse all parents for permissions anyway ...
// - we can compare to space root owner with the current user
// - we can compare the share permissions on the root for spaces, which would work for managers
// - for non managers / owners we need to traverse all path segments because an intermediate node might have been shared
// - if we want to support negative acls we need to traverse the path for all users (but the owner)
// for trashed items we need to check all parents
// - one of them might have the trash suffix ...
// - options:
// - move deleted nodes in a trash folder that is still part of the tree (aka freedesktop org trash spec)
// - shares should still be removed, which requires traversing all trashed children ... and it should be undoable ...
// - what if a trashed file is restored? will child items be accessible by a share?
// - compare paths of trash root items and the trashed file?
// - to determine the relative path of a file we would need to traverse all intermediate nodes anyway
// - recursively mark all children as trashed ... async ... it is ok when that is not synchronous
// - how do we pick up if an error occurs? write a journal somewhere? activity log / delta?
// - stat requests will not pick up trashed items at all
// - recursively move all children into the trash folder?
// - no need to write an additional trash entry
// - can be made more robust with a journal
// - same recursion mechanism can be used to purge items? sth we still need to do
// - flag the two above options with dtime
if !skipParentCheck {
_, err = os.Stat(n.ParentPath())
if err != nil {
if errors.Is(err, fs.ErrNotExist) {
return nil, errtypes.NotFound(err.Error())
}
return nil, err
}
}
if revisionSuffix == "" {
n.BlobID = attrs.String(prefixes.BlobIDAttr)