How to set properly QPKG_WEBUI variable in QNAP

时间:2017-07-12 08:02:22

标签: 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

1 个答案:

答案 0 :(得分:1)

在仔细研究了问题之后,在尝试了同样问题的其他应用程序之后,我发现问题不是QPKG_WEBUI变量的结论。

问题是我的QNAP网络界面(我不知道它是否适用于每个QNAP或仅在我的情况下)具有默认端口8080,但WEBUI具有默认端口80.

然后,似乎Web浏览器阻止QNAP界面内的iframe中的WEBUI,以便跟随Same Origin Policy。在新窗口中打开时,WEBUI正常工作。

设置QPKG_USE_PROXY = 1变量让iframe也能正常工作。