Migrate desktop OnlyOffice configuration between web-apps

Hello!

I have a how-to question. I have a free desktop/Docker OnlyOffice instance what use on two web applications. I has a problem with migrate a configuration of OnlyOffice. Each apps use a views with iframe and JS configuration method to open a document. Django-based Web API project open and save document successful but it is very old project and will not support. Yii2-based Web API project will replace previous API. But I see warning message about ‘The document could not be saved’ if open file in Yii2-based project.
Each of project use similar views with iframe and generate config. Python project genered configuration like this:

var connectEditor = function () {

        config = {
"type": "desktop", 
"documentType": "slide", 
"document": {
  "title": "filename.pptx", 
  "url": "https://storage.yandexcloud.net/ligarobotov-methodical-test/documents/3/8/9/zagriaznenie_musorom_lsh2020__552d2dd6-0bb6-4b48-9d06-2ca6849faec4.pptx?AWSAccessKeyId=<KeyId?&Signature=<Signature>&Expires=1699353409", 
  "fileType": "pptx", 
  "key": "-7879767301923523783", 
  "info": {
    "owner": "Unknown", 
    "uploaded": "07.11.2023 10:31:49"
  }, 
  "permissions": {
    "comment": true, 
    "download": true, 
    "edit": true, 
    "fillForms": true, 
    "modifyFilter": true, 
    "modifyContentControl": true, 
    "review": true
  }
}, "editorConfig": {
  "actionLink": null, 
  "mode": "edit", 
  "lang": "ru", 
  "region": "ru-RU", 
  "callbackUrl": "https://delta.ligarobotov.ru/api/methodology/onlyoffice/track/?key=documents/3/8/9/filename.pptx&file_secret=<S3 Secret>&token=Bearer%<JWT-bearer>",
  "user": {
    "id": "1", 
    "name": "login 1"
  }, 
  "embedded": {
    "saveUrl": "https://storage.yandexcloud.net/path/filename.pptx?AWSAccessKeyId=<KeyId>&Signature=<Signature>&Expires=1699353409",
    "embedUrl": "https://storage.yandexcloud.net/path/filename.pptx?AWSAccessKeyId=<KeyId>&Signature=<Signature>&Expires=1699353409",
    "shareUrl": "https://storage.yandexcloud.net/path/filename.pptx?AWSAccessKeyId=<KeyId>&Signature=<Signature>&Expires=1699353409",
    "toolbarDocked": "top"
  },
  "customization": {
    "about": true, 
    "feedback": true, 
    "compactHeader": true, 
    "plugins": true, 
    "compactToolbar": true, 
    "goback": {
      "url": "https://delta.ligarobotov.ru/franchise/methodology/admin/lessons/9"
    }
   }
  }
}
            config.width = "100%";
        config.height = "100%";
        config.events = {
            'onAppReady': onAppReady,
            'onDocumentStateChange': onDocumentStateChange,
            'onRequestEditRights': onRequestEditRights,
            'onError': onError,
            'onOutdatedVersion': onOutdatedVersion,
            'onMakeActionLink': onMakeActionLink,
        };

        
        console.log(config)
        docEditor = new DocsAPI.DocEditor("iframeEditor", config);

        fixSize();
    };

PHP project generate configuration like this:

var connectEditor = function () {
var config = {
  "type": "desktop",
  "documentType": "word",
  "parentOrigin": "https://127.0.0.1:10075/",
  "document": {
    "title": "41f8d18a-ee2d-4c28-874f-7b2a875afb74.docx",
    "url": "https://storage.yandexcloud.net/delta-is-methodology-v2/documents/doc.docx?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=<Credential>&X-Amz-Date=20231107T074832Z&X-Amz-SignedHeaders=host&X-Amz-Expires=1200&X-Amz-Signature=<Signature>",
    "fileType": "docx",
    "key": "<Key>",
    "info": {
      "owner": "Unknown",
      "uploaded": "07.11.2023 07:48:32"
    },
    "permissions": {
      "comment": true,
      "download": true,
      "edit": true,
      "fillForms": true,
      "modifyFilter": true,
      "modifyContentControl": true,
      "review": true
    }
  },
  "editorConfig": {
    "mode": "edit",
    "lang": "ru",
    "region": "ru-RU",
    "callbackUrl": "https://dev-delta.ligarobotov.ru/methodology/editor/track/?key=documents/doc.docx&type=2&token=<JWT Bearer>",
    "user": {
      "id": "102",
      "name": "doc"
    },
    "embedded": {
      "saveUrl": "https://storage.yandexcloud.net/delta-is-methodology-v2/documents/doc.docx?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=<Credential>&X-Amz-Date=20231107T074832Z&X-Amz-SignedHeaders=host&X-Amz-Expires=1200&X-Amz-Signature=<Signature>",
      "embedUrl": "https://storage.yandexcloud.net/delta-is-methodology-v2/documents/doc.docx?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=<Credential>&X-Amz-Date=20231107T074832Z&X-Amz-SignedHeaders=host&X-Amz-Expires=1200&X-Amz-Signature=<Signature>",
      "shareUrl": "https://storage.yandexcloud.net/delta-is-methodology-v2/documents/doc.docx?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=<Credential>&X-Amz-Date=20231107T074832Z&X-Amz-SignedHeaders=host&X-Amz-Expires=1200&X-Amz-Signature=<Signature>",
      "toolbarDocked": "top"
    },
    "customization": {
      "about": true,
      "feedback": true,
      "compactHeader": true,
      "plugins": true,
      "compactToolbar": true,
      "goBack": {
        "url": "http://127.0.0.1:10075/methodology/admin/documents/view/1"
      }
    }
  }
};
        config.width = "100%";
        config.height = "100%";
        config.events = {
            'onAppReady': onAppReady,
            'onDocumentStateChange': onDocumentStateChange,
            'onRequestEditRights': onRequestEditRights,
            'onError': onError,
            'onOutdatedVersion': onOutdatedVersion,
            'onMakeActionLink': onMakeActionLink,
        };

        console.log(config)
        docEditor = new DocsAPI.DocEditor("iframeEditor", config);

        fixSize();
    };

I’m not see a critical difference between this configurations. Can you?

Thanks for any help,
Dmitry

I use the Postman for testing each API and browser for test Python project. I watch a something with using it:

console.log(config)

I see a correct URL if I use browser to test a Django project. And I see

"parentOrigin": "file://"

if I use Postman (for test a new Yii2 API project).

Is can it be a critical difference?

Thanks for any help,
Dmitry

I upload editor configurator into the dev server and try again. But problem with saving is not leaved.

Hello, @DEMo :handshake:
First, please check the spelling of the ‘goback’ parameter.
JavaScript is a case-sensitive language.

P.S.
Why did you add the theme/tag “Desktop Editors”?

Hello, Nikolas.

Sorry for late answer. I add “Desktop” tag because I think what a free docker image is desktop editor. I ill be glad for correct if I’m understood something wrong.

Thanks for reply,
Dmitry

Hi!

I check a “goback” param. It’s fixed before, but it’s not solve my problem.

hey @DEMo :handshake:
Docker refers to the ONLYOFFICE Docs Community Edition for Docker

While ONLYOFFICE Desktop is a desktop application for Windows/Linux/MacOS.

Understood.

@DEMo
What errors are occurring with the new configuration?
Could you provide logs from the document server?

Hi!

Thanks for answers. I had fault is old URL for new service in callback. It’s cannot be a work. Fix of URL was fix of saving.

Dmitry

1 Like