qnap

How to set properly QPKG_WEBUI variable in QNAP


I am trying to developing an App for QNAP. I am really noob about QNAP, so please help me!

I succeeded in creating a qpkg package and installing it correctly, and it works. But the problem arises when I want to give my app a web interface.

I have just a index.html file that just has an helloworld text inside.

I create the environment with the QDK and I have the /share/XXX_DATA/.qpkg/QDK/MyApp folder

Now, a part of the other files, I create

/share/XXX_DATA/.qpkg/QDK/MyApp/Web

and put there my index.html with my HelloWorld message.

Ok now, I modify the /share/XXX_DATA/.qpkg/QDK/MyApp/qpkg.cfg file and set the variable

QPKG_WEBUI="/MyApp/Web"

From the documentation, for example https://edhongcy.gitbooks.io/qdk-qpkg-development-kit/content/qpkg-configuration-file.html , I can see

QPKG_WEBUI Relative path to installed application's web interface (the specified path is relative the configured location of web server data; usually /share/Web or /share/Qweb.) The specified path must start with a '/'. The displayed link can only be accessed when the QPKG is enabled. A default value of '/' is set automatically at installation if QPKG_WEB_PORT has been given a value and QPKG_WEBUI is empty.

Then I also create a link in /share/XXX_DATA/Web folder to my web folder. (the /share/Web is just a link to /share/XXX_DATA/Web) That is:

ln -s /share/XXX_DATA/.qpkg/QDK/MyApp/shared/Web /share/XXX_DATA/Web/MyApp/Web

Well, what happens that now, I can open a Window in my QNAP when I click on "open" in my app but it is completely blank. I tried a lot of different variants but my window is allways blank.

Must I modify something more a part from the qpkg.cfg file? Do you have some documentation with sample codes?

Is QPKG_WEBUI the correct variable to modify?

Thanks very much to everyone


Solution

  • After a carefully study of the problem, and after trying other applications with the same problem, I found the conclusion that the problem was not the QPKG_WEBUI variable.

    The problem was that my QNAP web interface (I do not know if it is a general thing for every QNAP or only in my case) has as default port 8080, but the WEBUI have as default port 80.

    Then it seems that the web browser blocks the WEBUI in the iframe inside the QNAP interface in order to follow the Same Origin Policy. When opened in a new window, the WEBUI works correctly.

    Setting the QPKG_USE_PROXY=1 variable let the iframe work too.