Nextcloud is a niche software and supporting documents docx,pptx,xls,etc creation and editing by leveraging collabora or onlyoffice. Onlyoffice is the one most used due mimick MS Office function and interface best, when it used to be can do mobile edit, but for some reason onlyoffice this a premium feature.

Screenshot_2022-10-26-13-47-31-225_com.nextcloud.client

Onlyoffice sold license for Home and Enterprise, for me personally it pretty hefty price, $149 for just enabling editing on mobile.

2022-10-26-190958_1067x795_scrot

captured 26 Oct 2022

Please buy if you feel you can buy the premium license

The price itself for 10 users, i dont know how it count, 10 pararel users? or 10 users that specifically added by license owner? then single server deployment? Im not sure really sure how it works or what the license capable of. I'm thinking that this price onlyoffice suites, rather than the only documentserver part only that we usually use with nextcloud combo. Because onlyoffice itself had many products documentserver, communityserver, mailserver, and etc.

Lets put my grumble at rest, focusing with enabling the mobile edit for document server. Assuming the onlyoffice/documentserver already deployed you likely had these compose or probably lookalike.

version: 3.8
services:
  app:
    image: onlyoffice/documentserver:7.0
    restart: unless-stopped
    environment:
       - USE_UNAUTHORIZED_STORAGE=true
       - JWT_ENABLED=true
       - JWT_SECRET=onlyoffice
    ports:
      - 5080:80
    restart: unless-stopped
    networks:
      - nextcloud

The container then up and running, next step is to check these three files

/var/www/onlyoffice/documentserver/web-apps/apps/spreadsheeteditor/mobile/dist/js/app.js
/var/www/onlyoffice/documentserver/web-apps/apps/documenteditor/mobile/dist/js/app.js
/var/www/onlyoffice/documentserver/web-apps/apps/presentationeditor/mobile/dist/js/app.js

Inside file listed, there is this code isSupportEditFeature=function(){return!1} you can use grep to find it, essentially we replace the code to isSupportEditFeature=function(){return 1} for that three files. You can nano manually inside container and edit the code, this method will lost if the container redeployed again. Another way is to copy out the js and bind mount it.

docker copy documentserver-container-name:/var/www/onlyoffice/documentserver/web-apps/apps/spreadsheeteditor/mobile/dist/js/app.js spreadsheet-app.js

Then edit the code manually, lastly modify our compose to mount the app.js

version: 3.8
services:
    app:
      image: onlyoffice/documentserver:7.0
      restart: unless-stopped
      environment:
          - USE_UNAUTHORIZED_STORAGE=true
          - JWT_ENABLED=true
          - JWT_SECRET=onlyoffice
      mounts:
          # Do this for every file we edit
          - ./spreadsheet-app.js:/var/www/onlyoffice/documentserver/web-apps/apps/spreadsheeteditor/mobile/dist/js/app.js
      ports:
        - 5080:80
      restart: unless-stopped
      networks:
        - nextcloud

Last method is by overriding entrypoint, on default onlyoffice entrypoint was ENTRYPOINT ["/app/ds/run-document-server.sh"]. Luckyly compose support overriding entrypoint, and the tool we need to execute the magic is sed, by override entrypoint to bash -c "sed -i 's/isSupportEditFeature=function(){return!1}/isSupportEditFeature=function(){return 1}/g' /var/www/onlyoffice/documentserver/web-apps/apps/*/mobile/dist/js/app.js;/app/ds/run-document-server.sh;" we tell it to replace the code then run the document server.

This is how it looks in compose:

version: 3.8
services:
    app:
        image: onlyoffice/documentserver:7.0
        entrypoint: bash -c "sed -i 's/isSupportEditFeature=function(){return!1}/isSupportEditFeature=function(){return 1}/g'  /var/www/onlyoffice/documentserver/web-apps/apps/*/mobile/dist/js/app.js;/app/ds/run-document-server.sh;"
        restart: unless-stopped
        environment:
     https://hub.docker.com/layers/onlyoffice/documentserver/7.0/images/sha256-ea97f3ed8f7e9f7024a6bdc61676211201a944bdbb4f7174901f910c8b057419?context=explore   - USE_UNAUTHORIZED_STORAGE=true
          - JWT_ENABLED=true
          - JWT_SECRET=onlyoffice
        ports:
          - 5080:80
        restart: unless-stopped
        networks:
          - nextcloud

After modifying the compose, now we recreate the container. The code will replaced directly without us fussing edit, copy and mounts.

This modification incompatible with documentserver 7.1 forward

sources:

Previous Post Next Post

Add a comment