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

Support for LibreOffice Online #388

Open
lmtoo opened this issue Oct 16, 2020 · 11 comments
Open

Support for LibreOffice Online #388

lmtoo opened this issue Oct 16, 2020 · 11 comments

Comments

@lmtoo
Copy link

lmtoo commented Oct 16, 2020

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

@paulcwarren
Copy link
Owner

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.

@paulcwarren
Copy link
Owner

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.

@lmtoo
Copy link
Author

lmtoo commented Jan 14, 2021

Hi, @paulcwarren , I found a document about to intergration, but I have a little confusing about it , How web app to intergration libreOffice online

@paulcwarren
Copy link
Owner

paulcwarren commented Jan 19, 2021

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.

@paulcwarren
Copy link
Owner

I've had some success today. Here is what I did.

  1. I created a sample Spring Boot webapp and added a host html page based on this example.

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

  1. I also added a couple of WOPI endpoints:
    @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!";
        }
    }
  1. I started this server on port 8080. I made sure I knew the IP address of my machine. 192.168.0.242 in my case.
  2. I ran the collabora code docker container as follows:

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

  1. I requested http://localhost:9980/index.html in my browser. I can see it hit my wopi endpoints and serves the content.
  2. I can see libre office attempts to start-up but seems to get stuck:

Screen Shot 2021-01-19 at 11 15 47 PM

) 6. If I inspect the collabora code logs (`docker logs -f `) 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

@paulcwarren
Copy link
Owner

Made some more progress.

I think I have a good idea how to implement this now.

@lmtoo
Copy link
Author

lmtoo commented Jan 21, 2021

Great, I have tried this out , thanks so much

@paulcwarren
Copy link
Owner

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.

@anuragpathak21
Copy link

Any Plans to implement this in near future ?

@paulcwarren
Copy link
Owner

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?

@anuragpathak21
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants