Skip to content

Commit bb0e8be

Browse files
authored
feat: add support for embedded view mode in apps (#5432)
1 parent 6f9a148 commit bb0e8be

File tree

5 files changed

+19
-4
lines changed

5 files changed

+19
-4
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Enhancement: add support for embedded view mode in apps
2+
3+
https://github.com/cs3org/reva/pull/5432

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ require (
1414
github.com/coreos/go-oidc/v3 v3.17.0
1515
github.com/creasty/defaults v1.8.0
1616
github.com/cs3org/cato v0.0.0-20200828125504-e418fc54dd5e
17-
github.com/cs3org/go-cs3apis v0.0.0-20251111143439-85e49afa696e
17+
github.com/cs3org/go-cs3apis v0.0.0-20251211091140-ea69016c2473
1818
github.com/dgraph-io/ristretto v0.2.0
1919
github.com/dolthub/go-mysql-server v0.14.0
2020
github.com/glpatcern/go-mime v0.0.0-20221026162842-2a8d71ad17a9

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,8 @@ github.com/cs3org/cato v0.0.0-20200828125504-e418fc54dd5e h1:tqSPWQeueWTKnJVMJff
899899
github.com/cs3org/cato v0.0.0-20200828125504-e418fc54dd5e/go.mod h1:XJEZ3/EQuI3BXTp/6DUzFr850vlxq11I6satRtz0YQ4=
900900
github.com/cs3org/go-cs3apis v0.0.0-20251111143439-85e49afa696e h1:pV4sb1gX9zmihJzmNtFILwSZy+sAqPXrYfujDc0laaM=
901901
github.com/cs3org/go-cs3apis v0.0.0-20251111143439-85e49afa696e/go.mod h1:DedpcqXl193qF/08Y04IO0PpxyyMu8+GrkD6kWK2MEQ=
902+
github.com/cs3org/go-cs3apis v0.0.0-20251211091140-ea69016c2473 h1:VJcXFu3RPqJMiHVKA4N4bFfAB3xxbc3spbZzRl71QF8=
903+
github.com/cs3org/go-cs3apis v0.0.0-20251211091140-ea69016c2473/go.mod h1:DedpcqXl193qF/08Y04IO0PpxyyMu8+GrkD6kWK2MEQ=
902904
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
903905
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
904906
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

pkg/app/provider/wopi/wopi.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,17 @@ func (p *wopiProvider) GetAppURL(ctx context.Context, resource *provider.Resourc
234234
}
235235
q.Add("usertype", string(ut))
236236

237+
access := "view"
238+
if viewMode == appprovider.ViewMode_VIEW_MODE_EMBEDDED {
239+
access = "embedview"
240+
}
237241
var viewAppURL string
238-
if viewAppURLs, ok := p.appURLs["view"]; ok {
242+
if viewAppURLs, ok := p.appURLs[access]; ok {
239243
if viewAppURL, ok = viewAppURLs[ext]; ok {
240244
q.Add("appviewurl", viewAppURL)
241245
}
242246
}
243-
var access = "edit"
247+
access = "edit"
244248
if resource.GetSize() == 0 {
245249
if _, ok := p.appURLs["editnew"]; ok {
246250
access = "editnew"
@@ -429,11 +433,13 @@ func getAppURLs(c *config) (map[string]map[string]string, error) {
429433
appURLs = make(map[string]map[string]string)
430434
appURLs["view"] = make(map[string]string)
431435
appURLs["edit"] = make(map[string]string)
436+
appURLs["embedview"] = make(map[string]string)
432437
for _, m := range c.MimeTypes {
433438
exts := mime.GetFileExts(m)
434439
for _, e := range exts {
435440
appURLs["view"]["."+e] = c.AppURL
436441
appURLs["edit"]["."+e] = c.AppURL
442+
appURLs["embedview"]["."+e] = c.AppURL
437443
}
438444
}
439445
}
@@ -474,7 +480,7 @@ func parseWopiDiscovery(body io.Reader) (map[string]map[string]string, error) {
474480
for _, app := range netzone.SelectElements("app") {
475481
for _, action := range app.SelectElements("action") {
476482
access := action.SelectAttrValue("name", "")
477-
if access == "view" || access == "edit" || access == "editnew" {
483+
if access == "view" || access == "edit" || access == "editnew" || access == "embedview" {
478484
ext := action.SelectAttrValue("ext", "")
479485
urlString := action.SelectAttrValue("urlsrc", "")
480486

pkg/utils/utils.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,8 @@ func GetViewMode(viewMode string) gateway.OpenInAppRequest_ViewMode {
369369
return gateway.OpenInAppRequest_VIEW_MODE_READ_WRITE
370370
case "preview":
371371
return gateway.OpenInAppRequest_VIEW_MODE_PREVIEW
372+
case "embedded":
373+
return gateway.OpenInAppRequest_VIEW_MODE_EMBEDDED
372374
default:
373375
return gateway.OpenInAppRequest_VIEW_MODE_INVALID
374376
}
@@ -385,6 +387,8 @@ func GetAppViewMode(viewMode string) appprovider.ViewMode {
385387
return appprovider.ViewMode_VIEW_MODE_READ_WRITE
386388
case "preview":
387389
return appprovider.ViewMode_VIEW_MODE_PREVIEW
390+
case "embedded":
391+
return appprovider.ViewMode_VIEW_MODE_EMBEDDED
388392
default:
389393
return appprovider.ViewMode_VIEW_MODE_INVALID
390394
}

0 commit comments

Comments
 (0)