Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
feat: add wopi validator command
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepDiver1975 committed Nov 28, 2023
1 parent 7b5be7b commit ac27a21
Show file tree
Hide file tree
Showing 11 changed files with 375 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/cs3-wopi-server
/wopi-validator
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,25 @@
4. check that the office is running: http://localhost:8080/hosting/discovery
5. log in into oCIS
6. open / create office files

## WOPI Validator
To run [wopi-validator](https://hub.docker.com/r/owncloudci/wopi-validator) in this development setup follow these steps after starting ocis, collabora/onlyoffice and cs3-wopi-server

1. build with `go build ./cmd/wopi-validator`
2. run with `MICRO_REGISTRY=mdns ./wopi-validator admin admin`

Example output:
```
➭ MICRO_REGISTRY=mdns ./wopi-validator admin admin | more
Starting wopi-validation ....
Test group: CheckFileInfoSchema
Fail: FullCheckFileInfoSchema
) CheckFileInfo, response code: 200 OK
- Uri Expected: HostEditUrl, HostViewUrl
Property Required: Size
z Unknown Properties: CloseButtonClosesWindow, AllowErrorReportPrompt, SupportsGetFileWopiSrc, EnableOwnerTermination
Re-run command: .\wopivalidator.exe -n FullCheckFileInfoSchema -w http://172.17.0.1:6789/wopi/files/fd5f0f569b39c459077693abdaf03b2f69041cd0d0caa12d8349b859c544afcc -t eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJXb3BpQ29udGV4dCI6eyJBY2Nlc3NUb2tlbiI6Ilhzbnl1N0VQN1E3YnFuNzRJdW9PeUo1TmlsaE5FYkpLZ3BoTmktaERsYXllTVRmc3Y4VDNDYTc2dldTNkJPLTJhVWs1ZG5XRG1mcmR2SzQ4dTdkUm1Va3FNSU42U29ZVENEVWE1Q3NyclE5cFh2bFNaU3JLbWhmaUdHbWduVVNGSVNIeERxZDlCYW41Qk5ORVpFa0lobEppYTFGdWZpN3E1dlgycnYyVHdZOXVybnJKTDBPMENFWEQxSWtET0Vwel9ZN3hXdFB3ZGJlMTlZSGNSZkZOOTAzYlVEdkFHa1J0Vkh4eC1KSjVxNkhUYlVyaWw1ZlVWcWVra1hiMEFIbEhyN1RCLWliMXJHRzJjVU5VdmhKU3ZzWW5OUFBycnhVQTNhTzVUM1FfZnVrMEs2TzBweV94OWxHbjFfdEhaaXFqTlZmLXlHOHdOcVVTQlZYNTVTVHkwMW1kME1tT2xBZV92aXcwVEJ1NlN4NEw5Z1RHWlB6RWZRS2FJRmpza2pRWHprbkRQVU1mOEF0dDFwQVlKVzV1clFWQkJtUHZiZ2doRXJERllUUDNfeUpvQTZYSU9WRWthN3ZYUFpYaHl6cmNMMk9kR3JkdzVwbE83SEZrblVvQ3d3TmdWM3FfWGxyVFJDeUhKQlY0Z2hRZkx5OVNrc2ZqYnAzUUYzVFQ2MVNxU2xOanQ2b0tIM01yVTR0Y2ttTkZSUWxELXRlWVRJQkFRVkVLYlRVRklNZG1SenpySVlHWTE1OWpXZkI5T0NPcEhQcnhhaEIzSUtNX3FMaXZTMzhVZzNzQ0V6T2cxSGxTNjRUclh5ajhVdFRXNGVDZm16NU9kRHB3eDM3MGVQNmRWMHRWblhkZU13emhLRTRmamNQeG5GM0M5TGdYWmZFVVdwb3FRWGt2Nnd6X0pwTkdmNGQ4ZmZoZjRXNnlscFRkbmNRaHF2TjdqRGhBQUViNXZwVENIUmwyYkd5TUtiTkRNNXFmbUJ1N042Y0tuaDhpTUtDVnRiY05ybk9sUEI4Vllka244R0FWQjZyNDNJLVFJamEzLTFzPSIsIkZpbGVSZWZlcmVuY2UiOnsicmVzb3VyY2VfaWQiOnsic3RvcmFnZV9pZCI6ImQ1NmFlOTdjLWI2MWMtNDk1Mi04OGQ1LWZkZmNkYjYzMTYxOSIsIm9wYXF1ZV9pZCI6Ijg5MTFkYzM4LWEzY2ItNDYzZC1iMjVhLWMwZDA3MWU2OTVjMCIsInNwYWNlX2lkIjoiMzY2OTIzZGYtMGI4OC00MGJjLWFkMGQtZDQyZGExMjEzNWUxIn0sInBhdGgiOiIuIn0sIlVzZXIiOnsiaWQiOnsiaWRwIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6OTIwMCIsIm9wYXF1ZV9pZCI6IjM2NjkyM2RmLTBiODgtNDBiYy1hZDBkLWQ0MmRhMTIxMzVlMSIsInR5cGUiOjF9LCJ1c2VybmFtZSI6ImFkbWluIiwibWFpbCI6ImFkbWluQGV4YW1wbGUub3JnIiwiZGlzcGxheV9uYW1lIjoiQWRtaW4iLCJ1aWRfbnVtYmVyIjo5OSwiZ2lkX251bWJlciI6OTl9LCJWaWV3TW9kZSI6MywiRWRpdEFwcFVybCI6Ij9XT1BJU3JjPWh0dHAlM0ElMkYlMkYxNzIuMTcuMC4xJTNBNjc4OSUyRndvcGklMkZmaWxlcyUyRmZkNWYwZjU2OWIzOWM0NTkwNzc2OTNhYmRhZjAzYjJmNjkwNDFjZDBkMGNhYTEyZDgzNDliODU5YzU0NGFmY2MiLCJWaWV3QXBwVXJsIjoiP1dPUElTcmM9aHR0cCUzQSUyRiUyRjE3Mi4xNy4wLjElM0E2Nzg5JTJGd29waSUyRmZpbGVzJTJGZmQ1ZjBmNTY5YjM5YzQ1OTA3NzY5M2FiZGFmMDNiMmY2OTA0MWNkMGQwY2FhMTJkODM0OWI4NTljNTQ0YWZjYyJ9LCJleHAiOjE3MDEyNzA3Njd9.h-DL9EeJR5YmpVpAR6VL7lfMv-m9cSoukf_1gOGgfFQ -l 1701270767000
...
```
18 changes: 18 additions & 0 deletions cmd/wopi-validator/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package main

import (
"fmt"
"github.com/wkloucek/cs3-wopi-server/pkg/wopivalidator"
"os"
)

func main() {
if len(os.Args) != 3 {
fmt.Println("Usage: wopi-validator <username> <password>")
return
}
err := wopivalidator.Run(os.Args[1], os.Args[2])
if err != nil {
fmt.Println(err)
}
}
10 changes: 10 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ require (
)

require (
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect
github.com/KimMachineGun/automemlimit v0.2.6 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230626094100-7e9e0395ebec // indirect
Expand All @@ -33,6 +34,10 @@ require (
github.com/coreos/go-semver v0.3.1 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/distribution/reference v0.5.0 // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/docker v24.0.7+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/fatih/color v1.15.0 // indirect
Expand Down Expand Up @@ -72,10 +77,14 @@ require (
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/hashstructure v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/moby/term v0.0.0-20201216013528-df9cb8a40635 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/nats-io/nats.go v1.27.1 // indirect
github.com/nats-io/nkeys v0.4.4 // indirect
github.com/nats-io/nuid v1.0.1 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc2 // indirect
github.com/opencontainers/runtime-spec v1.1.0-rc.3 // indirect
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
Expand Down Expand Up @@ -112,6 +121,7 @@ require (
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.10.0 // indirect
google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect
Expand Down
26 changes: 26 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGB
cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA=
github.com/2403905/go-cs3apis v0.0.0-20230517122726-727045414fd1 h1:dOIG9lXUo5CAZbjlegvZpeTqfAlH+zn+0uXbtlZjCPY=
github.com/2403905/go-cs3apis v0.0.0-20230517122726-727045414fd1/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY=
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8=
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/KimMachineGun/automemlimit v0.2.6 h1:tQFriVTcIteUkV5EgU9iz03eDY36T8JU5RAjP2r6Kt0=
Expand Down Expand Up @@ -64,6 +66,7 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/cs3org/reva/v2 v2.16.2 h1:ZvbxOsogbPMaXP/XeP/Qt+WluMwZ60wt6/GZhcSFRmY=
github.com/cs3org/reva/v2 v2.16.2/go.mod h1:RvhuweTFqzezjUFU0SIdTXakrEx9vJlMvQ7znPXSP1g=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand All @@ -72,6 +75,14 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dchest/uniuri v1.2.0 h1:koIcOUdrTIivZgSLhHQvKgqdWZq5d7KdMEWF1Ud6+5g=
github.com/dchest/uniuri v1.2.0/go.mod h1:fSzm4SLHzNZvWLvWJew423PhAzkpNQYq+uNLq4kxhkY=
github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0=
github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk=
github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM=
github.com/docker/docker v24.0.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/elazarl/goproxy v0.0.0-20221015165544-a0805db90819 h1:RIB4cRk+lBqKK3Oy0r2gRX4ui7tuhiZq2SuTtTCi0/0=
Expand Down Expand Up @@ -156,6 +167,7 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z
github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4=
github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
Expand Down Expand Up @@ -267,10 +279,14 @@ github.com/mitchellh/hashstructure v1.1.0/go.mod h1:xUDAozZz0Wmdiufv0uyhnHkUTN6/
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/moby/term v0.0.0-20201216013528-df9cb8a40635 h1:rzf0wL0CHVc8CEsgyygG0Mn9CNCCPZqOPaz8RiiHYQk=
github.com/moby/term v0.0.0-20201216013528-df9cb8a40635/go.mod h1:FBS0z0QWA44HXygs7VXDUOGoN/1TV3RuWkLO04am3wc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/nats-io/jwt v1.2.2 h1:w3GMTO969dFg+UOKTmmyuu7IGdusK+7Ytlt//OYH/uU=
github.com/nats-io/jwt/v2 v2.4.1 h1:Y35W1dgbbz2SQUYDPCaclXcuqleVmpbRa7646Jf2EX4=
Expand All @@ -286,6 +302,10 @@ github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OS
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opencontainers/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034=
github.com/opencontainers/image-spec v1.1.0-rc2/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ=
github.com/opencontainers/runtime-spec v1.1.0-rc.3 h1:l04uafi6kxByhbxev7OWiuUv0LZxEsYUfDWZ6bztAuU=
github.com/opencontainers/runtime-spec v1.1.0-rc.3/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
github.com/owncloud/ocis/v2 v2.0.1-0.20231124123240-d6f4b24ffaaa h1:6cbsV39UqCJlhXsvkpaX4ynKdg/ztN8D0nEHL573FmM=
Expand Down Expand Up @@ -339,6 +359,7 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/skeema/knownhosts v1.1.1 h1:MTk78x9FPgDFVFkDLTrsnnfCJl7g1C/nnKvePgrIngE=
github.com/skeema/knownhosts v1.1.1/go.mod h1:g4fPeYpque7P0xefxtGzV81ihjC8sX2IqpAoNkjxbMo=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
Expand Down Expand Up @@ -470,6 +491,7 @@ golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand Down Expand Up @@ -517,6 +539,7 @@ golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGm
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
Expand Down Expand Up @@ -568,5 +591,8 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY=
gotest.tools/v3 v3.5.0/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
8 changes: 4 additions & 4 deletions pkg/internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ type Config struct {
}

type demoApp struct {
gwc gatewayv1beta1.GatewayAPIClient
grpcServer *grpc.Server
GatewayAPIClient gatewayv1beta1.GatewayAPIClient
grpcServer *grpc.Server

appURLs map[string]map[string]string

Expand Down Expand Up @@ -122,7 +122,7 @@ func (app *demoApp) GetCS3apiClient() error {
if err != nil {
return err
}
app.gwc = gwc
app.GatewayAPIClient = gwc

return nil
}
Expand Down Expand Up @@ -161,7 +161,7 @@ func (app *demoApp) RegisterDemoApp(ctx context.Context) error {
},
}

resp, err := app.gwc.AddAppProvider(ctx, req)
resp, err := app.GatewayAPIClient.AddAppProvider(ctx, req)
if err != nil {
app.Logger.Error().Err(err).Msg("AddAppProvider failed")
return err
Expand Down
2 changes: 1 addition & 1 deletion pkg/internal/app/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (app *demoApp) OpenInApp(
meReq := &gatewayv1beta1.WhoAmIRequest{
Token: req.AccessToken,
}
meResp, err := app.gwc.WhoAmI(ctx, meReq)
meResp, err := app.GatewayAPIClient.WhoAmI(ctx, meReq)
if err == nil {
if meResp.Status.Code == rpcv1beta1.Code_CODE_OK {
user = meResp.User
Expand Down
4 changes: 2 additions & 2 deletions pkg/internal/app/wopifilecontents.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func GetFile(app *demoApp, w http.ResponseWriter, r *http.Request) {
resp, err := helpers.DownloadFile(
ctx,
&wopiContext.FileReference,
app.gwc,
app.GatewayAPIClient,
wopiContext.AccessToken,
app.Config.CS3DataGatewayInsecure,
app.Logger,
Expand Down Expand Up @@ -55,7 +55,7 @@ func PutFile(app *demoApp, w http.ResponseWriter, r *http.Request) {
ctx,
r.Body,
&wopiContext.FileReference,
app.gwc,
app.GatewayAPIClient,
wopiContext.AccessToken,
r.Header.Get(HeaderWopiLock),
app.Config.CS3DataGatewayInsecure,
Expand Down
2 changes: 1 addition & 1 deletion pkg/internal/app/wopiinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func CheckFileInfo(app *demoApp, w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
wopiContext, _ := WopiContextFromCtx(ctx)

statRes, err := app.gwc.Stat(ctx, &providerv1beta1.StatRequest{
statRes, err := app.GatewayAPIClient.Stat(ctx, &providerv1beta1.StatRequest{
Ref: &wopiContext.FileReference,
})
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions pkg/internal/app/wopilocking.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func GetLock(app *demoApp, w http.ResponseWriter, r *http.Request) {
req := &providerv1beta1.GetLockRequest{
Ref: &wopiContext.FileReference,
}
resp, err := app.gwc.GetLock(
resp, err := app.GatewayAPIClient.GetLock(
ctx,
req,
)
Expand Down Expand Up @@ -76,7 +76,7 @@ func Lock(app *demoApp, w http.ResponseWriter, r *http.Request) {
}

app.Logger.Debug().Str("lock_id", lockID).Str("FileReference", wopiContext.FileReference.String()).Msg("Performing SetLock")
resp, err := app.gwc.SetLock(
resp, err := app.GatewayAPIClient.SetLock(
ctx,
req,
)
Expand All @@ -96,7 +96,7 @@ func Lock(app *demoApp, w http.ResponseWriter, r *http.Request) {
req := &providerv1beta1.GetLockRequest{
Ref: &wopiContext.FileReference,
}
resp, err := app.gwc.GetLock(
resp, err := app.GatewayAPIClient.GetLock(
ctx,
req,
)
Expand Down Expand Up @@ -162,7 +162,7 @@ func UnLock(app *demoApp, w http.ResponseWriter, r *http.Request) {
},
}

resp, err := app.gwc.Unlock(
resp, err := app.GatewayAPIClient.Unlock(
ctx,
req,
)
Expand Down
Loading

0 comments on commit ac27a21

Please sign in to comment.