Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use only the app name in order to name the lock #10447

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion services/collaboration/pkg/config/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ type App struct {
Product string `yaml:"product" env:"COLLABORATION_APP_PRODUCT" desc:"The WebOffice app, either Collabora, OnlyOffice, Microsoft365 or MicrosoftOfficeOnline" introductionVersion:"%%NEXT%%"`
Description string `yaml:"description" env:"COLLABORATION_APP_DESCRIPTION" desc:"App description" introductionVersion:"6.0.0"`
Icon string `yaml:"icon" env:"COLLABORATION_APP_ICON" desc:"Icon for the app" introductionVersion:"6.0.0"`
LockName string `yaml:"lockname" env:"COLLABORATION_APP_LOCKNAME" desc:"Name for the app lock" introductionVersion:"6.0.0"`

Addr string `yaml:"addr" env:"COLLABORATION_APP_ADDR" desc:"The URL where the WOPI app is located, such as https://127.0.0.1:8080." introductionVersion:"6.0.0"`
Insecure bool `yaml:"insecure" env:"COLLABORATION_APP_INSECURE" desc:"Skip TLS certificate verification when connecting to the WOPI app" introductionVersion:"6.0.0"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ func DefaultConfig() *config.Config {
Product: "Collabora",
Description: "Open office documents with Collabora",
Icon: "image-edit",
LockName: "com.github.owncloud.collaboration",
Addr: "https://127.0.0.1:9980",
Insecure: false,
ProofKeys: config.ProofKeys{
Expand Down
8 changes: 4 additions & 4 deletions services/collaboration/pkg/connector/fileconnector.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func (f *FileConnector) Lock(ctx context.Context, lockID, oldLockID string) (*Co
Ref: wopiContext.FileReference,
Lock: &providerv1beta1.Lock{
LockId: lockID,
AppName: f.cfg.App.LockName + "." + f.cfg.App.Name,
AppName: f.cfg.App.Name,
Type: providerv1beta1.LockType_LOCK_TYPE_WRITE,
Expiration: &typesv1beta1.Timestamp{
Seconds: uint64(time.Now().Add(lockDuration).Unix()),
Expand All @@ -235,7 +235,7 @@ func (f *FileConnector) Lock(ctx context.Context, lockID, oldLockID string) (*Co
Ref: wopiContext.FileReference,
Lock: &providerv1beta1.Lock{
LockId: lockID,
AppName: f.cfg.App.LockName + "." + f.cfg.App.Name,
AppName: f.cfg.App.Name,
Type: providerv1beta1.LockType_LOCK_TYPE_WRITE,
Expiration: &typesv1beta1.Timestamp{
Seconds: uint64(time.Now().Add(lockDuration).Unix()),
Expand Down Expand Up @@ -378,7 +378,7 @@ func (f *FileConnector) RefreshLock(ctx context.Context, lockID string) (*Connec
Ref: wopiContext.FileReference,
Lock: &providerv1beta1.Lock{
LockId: lockID,
AppName: f.cfg.App.LockName + "." + f.cfg.App.Name,
AppName: f.cfg.App.Name,
Type: providerv1beta1.LockType_LOCK_TYPE_WRITE,
Expiration: &typesv1beta1.Timestamp{
Seconds: uint64(time.Now().Add(lockDuration).Unix()),
Expand Down Expand Up @@ -518,7 +518,7 @@ func (f *FileConnector) UnLock(ctx context.Context, lockID string) (*ConnectorRe
Ref: wopiContext.FileReference,
Lock: &providerv1beta1.Lock{
LockId: lockID,
AppName: f.cfg.App.LockName + "." + f.cfg.App.Name,
AppName: f.cfg.App.Name,
},
}

Expand Down
5 changes: 2 additions & 3 deletions services/collaboration/pkg/connector/fileconnector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ var _ = Describe("FileConnector", func() {
OcisURL: "https://ocis.example.prv",
},
App: config.App{
LockName: "testName_for_unittests", // Only the LockName is used
Name: "test",
Product: "Microsoft",
Name: "test",
Product: "Microsoft",
},
Wopi: config.Wopi{
WopiSrc: "https://ocis.server.prv",
Expand Down