How to set properly QPKG_WEBUI variable in QNAP - 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

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.

Related

can't open fossil repo over web

I've been strugling for a couple of days with this problem, but can't seem to fix it, I think I'm almost there.... but... not quite :(
This is where I am at.
I'm on a headless debian server, running virtualmin / webmin for creating my domains / users etc. I don't know if this will mess things up, but I'm happy to modify the config files manually (via webmin or via ssh/vim).
I am attempting to run fossil as a cgi service over apache.
its an internal site, named as homeserver.net I can reach the default pages just fine, and add in and create links etc as I want to.
Please note that the solution to my problem is at the end of the question.
so the files are located on disk at, which tallys up with my apache document root
/home/homeserver/www
I would like to run fossil to have both the internal site, and later on and dev work that I practice on in separate files. So I created a new directory for these repositories.
/home/homeserver/repos/web/site.fossil
/home/homeserver/repos/dev/ [no repository yet!]
reading the instructions on the fossil page I have inserted a short cgi file called 'fos_repo.cgi' that reads as.
#!/usr/bin/fossil
directory: /home/homeserver/repos
notfound: http://www.homeserver.net/site404.htm
when I open the link to
www.homeserver.net/cgi-bin/fos_repo.cgi
I get redirected to the 404 page that I have written. So the script is clearly being read and working.
From reading the fossil pages I understand that I should be able to use the following link to open/access the repo.
www.homeserver.net/cgi-bin/repos/web/site
I'm not sure why this isn't working...
so far I have tried the following.
I opened the repository from the cli, and had the server run in the background
fossil server site.fossil &
I though maybee the file should have been inside the main repo directory, not inside a sub directory, so I moved it... it now lives in
/home/homeserver/repos/site.fossil
I tried creating an alias to the file in apache
Alias /home/homeserver/repos/web/site.fossil /home/homeserver/www/repos
When I browse to
www.homeserver.net/repos/site
I get nothing, but going to
www.homeserver.net/repos/site.fossil
will attempt to downloaded the file (which is a binary)
so I think I'm getting somewhere, but I'm not sure what I'm missing.
I've used fossil before, but I ran it as a local server, and started it up as and when I needed it.
I'm running it like this so as I can eventually push the site out to a live VPS (maybe even finish up hosting the fossil site on the VPS also).
ps I really liked fossil when I used it before, and loved the whole integrated wiki and bug tracker, and the fact I could simply copy the file to my external drive to do a backup. Personally don't really want to change to something else, but if I have to....
thanks in advance.
David
Edit: trying other options.
So I thought I would try the single repository method shown on the fossil page, so adjusted my cgi script accordingly.
Now when I navitage to : www.homeserver.net/cgi-bin/fos_repo.cgi I get the following message returned
SQLITE_CANTOPEN: cannot open file at line 30276 of [f5b5a13f73]
SQLITE_CANTOPEN: os_unix.c:30276: (21) open(/home/homeserver/repos)
however if I ssh to the server an start it manually with
fossil server site.fossil
I can get to the server with www.homeserver.net:8081
So I either have a problem with my SQLite usage in apache or something else wrong. Plesse help
Solution
So for reasons of simplicity I've decided that using a single cgi file for each repo is what I am going to go with.
My initial directory structure was as follows:
/home/homeserver/www
/home/homeserver/www/repos
/home/homeserver/www/repos/web # for web site development
/home/homeserver/www/repos/dev # for other development
I think part of my problem was that I was hoping that having the directory: pont to my repos/ location fossil would find the site.fossil file (located in repos/web) and the dev.fossil file (located in repos/deb).
Obviously this didn't work.
The reason I wanted it too look like this was for separation of the information on my system.
For some reason I had decided that pointing fossil as repos/ would give me a nice fossil style front page and links to my repositories automatically. However After having used the directory: version and getting the following error message
Unable to find or open the project repository
I realised that I was still going to need to write my front page to the repositories, and that my expectation was a little too much.
So I've decided to run with a single cgi file pointing to each repo that i need to make.
Instead of
www.homeserver.net/cgi-bin/repos/web/site
try
www.homeserver.net/cgi-bin/repos.cgi/index
Reading your ( very long ) question again, I suggest trying
www.homeserver.net/cgi-bin/fos_repos.cgi/index

Issues with intern-runner and proxyUrl that contains subfolders

I need to setup intern to test ajax calls from a different server. I set everything up sort of following the official wiki in this address
https://github.com/theintern/intern/wiki/Using-Intern-to-unit-test-Ajax-calls
My config file has proxyUrl set to http://localhost:8080/sub
and http://localhost:8080/sub is setup as a reverse proxy to inter-runner in http://localhost:9000
When I run ./node_modules/.bin/intern-runner -config=tests/config from the tests root folder, the browser opens up and is able to request several files, until it tries to request the config file. That's when it receives a 404, because it requests the wrong address - http://localhost:8080/tests/config.js - without the sub folder.
I'm wondering if I'm missing something inside the config file, or if intern is not able to use proxies with subfolders. I tried to set the baseUrl parameter, but it had no effect.
Any ideas?
Update:
It seems that sometimes intern-runner uses the path provided in the config param, and sometimes it uses the one in the proxyUrl parameter inside the config file. As a workaround, what I did was to place the config file and the tests on 2 folders (actually I made a symbolic link). The first on tests/ and the second on sub/tests/ and ran it using ./node_modules/.bin/intern-runner -config=sub/tests/config.
It works, but it's kind of stupid and I really wished there was a better way to do it.
This is indeed a limitation/bug of intern. It assumes that the proxy sits at the root of the absolute domain name, i.e. that it has a pathname of /.
An issue has been created on intern's github repository here and the corresponding pull request that fixes the problem is here. Hopefully this gets merged into the upcoming 2.1 release of intern.

Image available on server but failed to load the given URL

I have a scenario that the image is available on the server on the said path
the whole system is running on apache with https (ssl installed and configured properly)
In my application when i generate the path and assign the same to the output (Html) it dose not show the image. Infact it says like the resource could not be loaded. But the same code works on local and many other server but on this 1 server.
Secondly if i do a view source on the same, copy the url and open the same url in browser - it opens up properly - without any issue / trouble but cannot find the same into the out generated by the app..
Any clue as why such thing should be happening??
Sorry my mistake - i realized those were tagged under folder ads and were blocked by ad block plus. Got the resolution :)

Need to change the apache default home page

I am new to apache.I installed apache in my windows, I am having my own html page with css.I want to set this page as my default apache home page and instead of typing http://localhost:8080, i have to type http://vignesh to view my home page.
How to do this..Guide me
I think your question is split into 2 things: The ability to use http://vignesh as opposed to http://localhost:8080, and the option to change the default home page.
In order to get the url that you want working, you need to modify a file in windows (assuming you're on windows 7) do the following:
Launch notepad (or any other text editor) with administrative privileges
Open the hosts file located at: C:\Windows\System32\drivers\etc
Add the following entry to it: 127.0.0.1 vignesh
In order to change the default page you need to change the apache configuration.
Open httpd.conf in your favorite text editor
Locate the property called DirectoryIndex. Change it to the page that you want.
I hope that was helpful.
When you type an address in a browser, the browser relies on the operating system to resolve it. Only once it has been resolved, a request is sent to the actual server (in this case, your apache installation).
Because of this, you can't alter how the "server" part is resolved through apache itself: it is your Windows system which handles that and, if appropriate (this is, if it resolves to localhost at the port where your apache is listening), forwards it to apache.
So, you need to alter how Windows, rather than apache, resolves that address. Fortunately, for your situation, it's relatively easy to tweak, if you know what to look for (and I am telling you here, so you know ;) ):
Open the file %SystemRoot%\system32\drivers\etc\hosts on a plain text editor, such as notepad (%SystemRoot% is window's base installation path, such as C:\Windows or C:\WinNT), and add a line like this at the end:
127.0.0.1 vignesh

Resolving a remote $HOME directory via FTP/SFTP

In Objective-C, NSString has a method called
stringByExpandingTildeInPath
This method will take a string like "~/Documents" and resolve it to "/Users/Nick/Documents". The "~" tilde is resolved to the home directory of the current user of the machine the program is running on.
Now my question is this... I am writing a little FTP/SFTP utility using Cocoa and Objective-C. How could I resolve a tilde (~) path on remote machine via FTP/SFTP?
For example. A user wants to upload a file to
sftp://remote-host.com:~/
If remote-host.com is a Linux or OSX server, then this path is totally valid. However uploading a file only works when I specify the absolute path. I'm not sure if this is a limitation of the framework I'm using, ConnectionKit, or if this is something that I need to manually implement. I'm ok with the latter but, any suggestions on how?
You could try just removing the "~/" (and use the rest as a relative path) - generally the server should put you in the user's home directory by default when you connect.