Open lmtoo opened 3 years ago
Hi @lmtoo, this is cool. I have created several webdav implementations over the years so this one is more familiar to me but might be quite involved.
But WOPI might be more focussed API and therefore easier to implement. I wonder if we could get away with implementing just GetFile
, PutFile
and DeleteFile
?
Either way though this may look a lot like the CMIS support whereby the developer would decorate his entity model/repository/stores with @Webdav or @Wopi annotations that would drive the integration.
Looking at this C# example it doesnt look too hard at all to implement actually so this might be completely dooable - at least for a very simple GetFile, PutFile and we can iterate on it from there.
Hi, @paulcwarren , I found a document about to intergration, but I have a little confusing about it , How web app to intergration libreOffice online
I'm also having trouble parsing all of this too. The documentation is definitely not great. I was looking at NextCloud and Collabora Code.
What i have worked out so far...
I think NextCloud would be like our web apps. It has an iframe in it that hosts a document editor. I think Collabora is a distribution/variant of LibreOffice. It is the document editor and a WOPI client. Spring Content would be a WOPI host (server).
I think the way it works is that the webapp calls a "discovery" endpoint (unclear to me what serves this endpoint) that returns an XML document that tells the webapp about the WOPI host and the URLs for each type of document and each type of operation. This allows the webapp to invoke an editing session on a document.
I've had some success today. Here is what I did.
form action: http://localhost:9980/loleaflet/eec532f/loleaflet.html?WOPISrc=http%3A%2F%2F192.168.0.242%3A8080%2Fwopi%2Ffiles%2Fabcdef0123456789 access_token=12345 access_token_ttl=31536000
@RestController
public static class WopiController {
@RequestMapping(method=RequestMethod.GET, value="/wopi/files/{fileId}", produces="application/json")
public String wopiFile() {
return
"{" +
"\"BaseFileName\":\"helloworld.txt\"," +
"\"OwnerId\":\"me\"," +
"\"Size\":\"12\"," +
"\"UserId\":\"me\"" +
"}";
}
@RequestMapping(method=RequestMethod.GET, value="/wopi/files/{fileId}/contents")
public String wopiFileContent() {
return "Hello World!";
}
}
docker run -t -d -p 9980:9980 -e "domain=192\\.168\\.0\\.242:8080" -e "username=admin" -e "password=secret" --restart always -e "extra_params=--o:ssl.enable=false" --cap-add MKNOD collabora/code
)
docker logs -f <container-id>
) I see a suspicious error:
kit-00041-00034 2021-01-20 07:15:23.061148 [ kitbroker_002 ] ERR Failed to get LoKitDocument instance for [file:///tmp/user/docs/XR3dpjeX975SKzQE/helloworld.txt].| kit/ChildSession.cpp:634
So, maybe almost there? Anyway, some progress in understanding how this all works.
HTH
Made some more progress.
I think I have a good idea how to implement this now.
Great, I have tried this out , thanks so much
So, I have a pretty good idea how to build this now.
I think it will look like the CMIS module. From a Developer perspective you'll be able to decorate your entity classes with an @WopiDoc
annotation and SC will provide the WOPI endpoints that will expose those documents.
Thinking we'll implement files only at this point.
Any Plans to implement this in near future ?
We can certainly consider adding some level of experimental support for this in the near term @anuragpathak21. I only figured out individual file access. Would that be sufficient for you?
We can certainly consider adding some level of experimental support for this in the near term @anuragpathak21. I only figured out individual file access. Would that be sufficient for you?
Individual file will work
Hi, @paulcwarren , I found LibreOffice Online support office web preview and edit, but this required wopi or webdav protocol, there is also a docker image
docker pull collabora/code:latest
which can quickly startup with Nextcloud , is spring-content can support this with new wopi or webdav module?There is WOPI REST API Reference