Rovio WebServer (URLs, JavaScript and tech stuff)

60 posts / 0 new
Last post
Tom B
Tom B's picture
Roschler,

Roschler,

OK, now I get what you are saying. Yes, the VB control I'm using is based on IE for sure.

The biggest problem of all is that my web programming skills are minimal, I was lucky to get the web control working at all in VB and now this. Arrgh. Going into Delphi or other environment is impossible, I'm building on top of an existing VB application and no way to port into other languages, and have a couple days at most to fix this...

I might be screwed!

Nocturnal
Nocturnal's picture
I had a similar issue when I

I had a similar issue when I wrote a program to poll rovio for sensor information repeatedly. The web library I was using doesn't handle authentication. So I had to do it manually.

Essentially, what you are doing at the moment is sending a something like the following

GET /whatever.cgi

What you need to be sending is something like

GET /whatever.cgi HTTP/1.1
Authorization: Basic YWRtaW46YWRtaW4=

where "YWRtaW46YWRtaW4=" is username:password base64 encoded (you can use http://gtools.org/tool/base64-encode-decode/ to encode the string). So, if your library doesn't support authentication, or allow you to set the headers being sent, you are screwed.

roel018
roel018's picture
RoboBrain said: If anyone

RoboBrain said: If anyone wishes to mess around with the JS or craft their own html files for manipulating their rovio (without disabling XSS in IE) and/or using Firefox, you could use a reverse proxy to override specific files.  I've implemented one for my own testing using Perlbal (Perl Load Balancer).   You just need to install perl and the Perlbal module from CPAN.  It works fairly well, I've done the same with Squid+Apache in the past, but Perlbal is quick and easy with this config below.  The options you need to change for your environment should be self explanatory. As you can see the config serves some files from a local directory and proxies all others to rovio.  I pulled down all the *.js files in this case because I've identfied bugs in there I needed to fix.  You could remove the .js pattern if you only want to create *.html files.  (Rovio's files are .htm, so I can see both with this setup..)  Enjoy... ...RB # ------------ perlbal-proxy.conf LOAD vpaths CREATE SERVICE site   SET role           = web_server   SET docroot        = /srv/www/htdocs/rovio   SET dirindexing    = 0 ENABLE site CREATE POOL rovio        POOL rovio ADD 192.168.[YOUR_NETWORK].18 CREATE SERVICE rovio_proxy        SET role            = reverse_proxy        SET pool            = rovio        SET persist_backend = off        SET verify_backend  = off CREATE SERVICE proxy   SET listen         = 0.0.0.0:8000   SET role           = selector   SET plugins        = vpaths   SET persist_client = on   VPATH /.*\.html       = site   VPATH /.*\.js         = site   VPATH .*             = rovio_proxy ENABLE proxy

 

Hi !!!
I'm looking for a solution you describe here.. However, I don't entirely get it. What I'm trying to accomplisch is this: I'm want to access Rovio's secured .CGI scripts using javascript on a shared hosting account. Now, where do I install this reverse-proxy file?? On this remote shared hosting server? Or on the Rovio's build-in webserver????..

You see, this page will be public, so I need to find a way to A) control Rovio on a cross-domain level, and B) hide any username/password used for Basic Authentication...

Any help is REALLY appreciated!

Thanks in advance!

Kind regards,

Roel

roel018
roel018's picture
Nocturnal said: I had a

Nocturnal said: I had a similar issue when I wrote a program to poll rovio for sensor information repeatedly. The web library I was using doesn't handle authentication. So I had to do it manually. Essentially, what you are doing at the moment is sending a something like the following GET /whatever.cgi What you need to be sending is something like GET /whatever.cgi HTTP/1.1 Authorization: Basic YWRtaW46YWRtaW4= where "YWRtaW46YWRtaW4=" is username:password base64 encoded (you can use http://gtools.org/tool/base64-encode-decode/ to encode the string). So, if your library doesn't support authentication, or allow you to set the headers being sent, you are screwed.

Hi!
How did you manage to do this??? How can it be done in javascript? I want my public webpage to communicate with Rovio's Basic Authenticated CGI scripts by using javascript ..  Is this even possible?? (See my post above as well)..

Thanks for the insights!!!!!

Regards,

Roel

 

roel018
roel018's picture
Hi guys.. It's a pitty this

Hi guys.. It's a pitty this forum seems to be dieing, since there are hardly any recent posts, at least not in this previously very active thread.

Anyways, I am struggling to get the next thing to work:

I'm trying to give a .cgi command to: my Rovio, from: my webserver. This works locally when I type the following line in my browser's address bar: http://roelie.mywebdomain.com:8080/rev.cgi?Cmd=nav&action1

It returns a string with all kinds of info about my Rovio.

However, when I try to get this same info using an ASP proxy file OR a PHP proxy file, I'm getting back exactly nothing (actually I'm getting a invalid URLmessage - which is strange since the exact same URL works in my browsers address bar).

This is weird since both proxy files (both the ASP and the PHP version) work with other, cross-domain located files which return stuff.

I even disabled user security on my Rovio so I don't have to work around the Basic Authentication problem... I just don't understand it. I can access ANY remote file located on ANY server, using one of the two proxy files, but I can't access the Rovio files this way (while calling the files direcly from my address bar does work.)

These are the proxy files I'm using to request the file outputs:

PHP VERSION:

$Cmd = $_POST['Cmd'];
$Action = $_POST['action'];
$TheURL = "roelie.mywebdomain.com:8080/rev.cgi";
$CompleteURL = "http://".$TheURL."?Cmd=".$Cmd."&action=".$Action;

$fh = fopen($CompleteURL,'rb');
$output = '';
while(!feof($fh)){
$output .= fread($fh,4068);
}
echo $output;

ASP VERSION:

Response.Buffer=True
TheURL = roelie.mywebdomain.com:8080/rev.cgi"
'TheURL = "http://www.roelkrottje.nl/test.asp" // WORKS!

Cmd = Request("Cmd")
Action = Request("action")

CompleteURL = "http://" & TheURL & "?Cmd=" & Cmd & "&action=" & Action

Set MyConnection = Server.CreateObject("Microsoft.XMLHTTP")
MyConnection.Open "POST", CompleteURL, False
MyConnection.Send
TheData = MyConnection.responseText
Response.Write (TheData)
Set MyConnection = Nothing

Why can I not access my Rovio like I can access any other webserver???

Hope someone outhere can help me out.

THNX!
Roel.

macegr
macegr's picture
I haven't seen this mentioned

I haven't seen this mentioned before, and maybe it's ignorant to think that no one discovered this over the past two years: the Gumstix Verdex (now discontinued) used a PXA270 processor. I don't know if the Rovio would be able to run a full Linux kernel but this page has links to development tools and full datasheets on the processor: http://docwiki.gumstix.org/Verdex

milw
milw's picture
macegr- that url doesn't work

macegr- that url doesn't work- is there a typo in it somewhere?

Rudolph
Rudolph's picture
Interestingly enough that

Interestingly enough that link worked yesterday. Odd. Anyway, this one should work http://docwiki.gumstix.org/index.php/Verdex

RoboaRovio
RoboaRovio's picture
RobosapienPet said: Rovio

RobosapienPet said: Rovio acts like a web server. Your computer's browser connects to that web server and the Rovio provides web pages for the user interface (with changing content, like the current camera image)  The default main webpage provides the full screen user interface using JavaScript "http://{IP_ADDRESS}/index.htm" (replace {IP_ADDRESS} with your Rovio's IP address, eg: 10.x.y.z or 192.168.x.y typically) For mobile devices, iPhone/iPod/WinCE, it automatically redirects to "http://{IP_ADDRESS}/mobile/index.htm" This is a stripped down version for smaller screens The webpage is selfcontained on the web server (Rovio), including all images (eg: "http://{IP_ADDRESS}/img/titlebar/titlebar_left.gif") NOTE: The current camera image can be accessed directly by: http://{IP_ADDRESS}/Jpeg/CamImg.jpg ---- The rovio.js JavaScript explains how much of the glue works http://{IP_ADDRESS}/lib/rovio.js (edit with any text editor) It uses something called "Prototype and Scriptaculous", a combination of useful JavaScript libraries http://www.stevekallestad.com/blog/prototype_and_scriptaculous_compressed.html ("combined prototype and scriptaculous" version) Most of the functionality is performed in .CGI scripts (see rovio.js), some with URL args (eg: "&blah=1") or http request POSTed args. Camera features: "http://{IP_ADDRESS}/Cmd.cgi + POSTED_ARGS" is the main one, which can call other .CGI functions Functionality is VERY similar to this camera: http://www.canvision.net/product/product_pt300_eng.html http://www.canvision.net/support/pt300-cgi/CmdList.htm (some don't apply) There are others, "GetData.cgi" for getting camera data, "Change???.cgi" for changing settings (resolution, frame rate, volume, etc), "Reboot.cgi" to reboot, "GetWlan.cgi" for settings, ... (there are others, look at the "index.htm" source as well as "rovio.js") Robot features (movement etc) "http://{IP_ADDRESS}/rev.cgi + POSTED_ARGS" is for robot control. See "rovio.js" I could go into more detail, but it is relatively easy to figure out by examining the two HTML files (regular and mobile) and the "rovio.js" file. ----- More advanced hackability: The web server on the Rovio does not support browsing folders, or provide 'ftp'. This means there is no (easy) way to browse the entire file system. There is a firmware update feature. Since there hasn't been a firmware update, the format used and the possibilities of hacking it are TBD. Bottom line, it looks like they joined their robot control to an existing web cam (not unlike the way RS Media was put together)

 

After a bit of thought I was wondering firstly if you could find time to edit your original Thread intro to take into account all the information we are gathering here.

I get the feeling that your/this Thread could become vital in the future development of Rovio itself. Together the Rovio community seems to have amassed just about everything there is to allow hardware and software development/hacking of this cool little robot. There is however a bit of a gap regarding the base station and beacon despite this excellent report by Peter Redmer and hack by Thingverse or DIY beacon by ScribbleJ. There is also a brilliant thread (Inside Rovio) by tome. It would therefore be particularly advantageous for us all to co-ordinate our online community to take Rovio forward now that the manufacturers have backed out.

Any ideas or propositions here would be much appreciated. For instance could we bring together a development team which is funded by everyone in some way rather than highly knowledgeable individuals making a quick buck with bespoke software (roviocommander etc)?

The crux of this post is community co-ordination so any ideas or proposals are very much appreciated.

RoboaRovio

Pages