Topic: NeTV internal web server

I assume that NeTVServer is the internal web server.  Is it based on Apache.  Is there a cgi-bin directory and can I call server scripts.

Any PHP support or only shell scripts supported?

thanks
dan

2 (edited by ChumbyLurker 2011-10-22 05:10:37)

Re: NeTV internal web server

Hi dlovy,

The internal web server is available at http://git.chumby.com.sg/git/chumby-sg/chumby-netvserver.git.  It's written in Qt.  Many of the commands the web browser calls are outright shell scripts located under /usr/share/netvserver/

No PHP support, but it should be easy enough to compile Apache and/or Lighttpd with PHP support.

Re: NeTV internal web server

Thanks, 

One more question.  Are cookies supported?  If so, where are they stored.

d.

4 (edited by dlovy 2011-10-22 06:02:48)

Re: NeTV internal web server

I think I found the cookies directory.  Will test. (oops, they don't appear to be stored in the cookies directory.  cookies seem to work just can't find where they are stored)

Is it easy to add scripts to /usr/share/netvserver/docroot/scripts directory and add the command to bridge that will generate the response?

thanks again.

5 (edited by torinnguyen 2011-10-22 09:37:26)

Re: NeTV internal web server

Cookies is sort-of working, but we have not fully tested it yet.
A simple demo is located at http://xxx.xxx.xxx.xxx/session
Alternatively, you can use GetParam & SetParam commands.

You can add a new script to, for eg. /usr/share/netvserver/docroot/scripts/myscript.sh (remember to chmod +x)
And call http://xxx.xxx.xxx.xxx/bridge?cmd=myscript
It will give you the output from the script.
Note that the returned XML might not be well-formed since the shell's output is neither XML-escaped nor URI-encoded.

Alternatively, if you like it raw, just call http://xxx.xxx.xxx.xxx/scripts/myscript.sh

Re: NeTV internal web server

I'll try that as well.  How do I pass parameters to the shell script?

thanks,

dan

7 (edited by torinnguyen 2011-10-22 18:37:44)

Re: NeTV internal web server

You can pass data to the scripts in this manner
http://10.0.88.1/scripts/myscript.sh?pa … ram3=ccccc
---------------------
#!/bin/bash
uname -a
chumby_version -f
echo "\$1 = $1"
echo "\$2 = $2"
echo "\$3 = $3"
echo "num = $#"
# you can really kill yourself too
#killall NeTVServer
#reboot
---------------------
will give you this response:
Linux localhost.localdomain 2.6.28 #1 Mon Oct 10 17:17:41 SGT 2011 armv5tejl GNU/Linux
19
$1 = ccccc
$2 = bbbbbb
$3 = aaaaaa
num = 3

Notice the reversed order of the parameters.
Since shell script parameters doesn't use key=value pair like POST/GET, the name (param1,2,3) doesn't really matter. You can have it anything you like, eg. This has the same meaning: blah1=aaaaaa&blah2=bbbbbb&blah3=ccccc

However, the lexicon order of the names are used when passed to the shell script.
So, the following will give you the opposite order
http://10.0.88.1/scripts/myscript.sh?zz … ;xxx=ccccc
$1 = aaaaaa
$2 = bbbbbb
$3 = ccccc
num = 3

Wiki page has been updated with this
http://wiki.chumby.com/index.php/NeTV_w … om_scripts

Re: NeTV internal web server

This is great!
this should give us everything we need.

Thanks for all your help

dan

9 (edited by torinnguyen 2011-10-23 21:34:33)

Re: NeTV internal web server

You might find the newly documented Key, NeCommand, Uploadfile, UnlinkFile commands very interesting too.
Particularly the almighty powerful NeCommand command.
"With great power, comes great responsibility" big_smile

They are already available in your current firmware (fwver=19).

Note that they are still in development, the input & output might be changed slightly in next release.

Re: NeTV internal web server

so I could in fact upload a .swf file and run it all from a web page?

cool.  saves a lot of work.

dan