OpenWrt Forum Archive

Topic: Web Interface Minimal Standard

The content of this topic has been archived on 10 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hey,

have followed the discussion in the Web-Devel wanted-Thread so far and evaluated the MBM proposal too.  I think there is a minimal standard necessary to give ipk devels a guideline how to integrate their IPK in the web UI. Here is what I do presently (my stuff does not rely on third party packets, no php, no httpd-xxx, no libs just plain shell):

In /www and in /www/cgi-bin/ there are a lot of small files, e.g.:

/www/cgi-bin/11-password
/www/cgi-bin/22-password
/www/cgi-bin/33-system

These files hold HTML snippets to be integrated in a navigation bar, may be this way:

<TR><TD><A HREF="password.html">Change PW</A></TD></TR>

Every page (here password.html) integrates Navigation and Layout by ash script commands. In real life you will have to make a plain XHTML page without layout and replace the <body> tag with a "/www/cgi-bin/pre.sh" in the file header. The pre.sh will call this:

for inc in /www/cgi-bin/[0-9][0-9]-*;do cat $inc;done

A new IPK can add its own status page to /www and its own administration page in /www/cgi-bin. The new page is automatically integrated in the navigation and instantly visible afer "ipkg install".

An IPK devel has to do 3 things:

a) Make a simple XHTML page for Administration of the IPK and maybe one for Status. No Layout.
b) Include the necessary ash-script-logic to make the config changes when the page is called with POST
c) Add those stuff together with the navbar snippets to his IPK.

Comments?

I think this is a bit too simple.

My webif code is a lot more complex for several reasons:
- I want to move as much common code as possible into a single script that can be used from the modules
- Running an awk script is faster than using shell code to do processing, which involves several variable comparisons, etc. This is because busybox does a fork/exec on /bin/busybox every time the script calls echo, [], cat and other applets built into busybox.
- I want to make it as simple as possible to write the web interface modules. There's a lot of abstraction code in my webif, but if you try it, you will see that it still runs pretty fast.

As soon as I've implemented more stuff (and added common code for input validation), I will document the 'API' that my webif package provides, and I'd like it to become the standard for OpenWrt packages.

nbd is right about the speed of cgi pages when you only use shell script.  The interfaces that I have run and tested that only use shell script load very slowly.  I think this is a big deal.

The interface that nbd is doing (webif) is very fast.  It has my vote.

I think that nbd's work would make a great standard.  It seems very complete and you can tell that a lot of for thought has been put into the work.

nbd, spence,

thanks for replying. I have a different opinion here - because I did not receive any complaints about speed, GUI refresh rates and the like in the last year. But a lot of complaints about not beeing ready, not offering specific settings or doing settings wrong or (last but not least) the windows like reboot-to-change-settings. I'am KISS fanatic. But I may be able to adapt my HTML-> ShellCGI converter to whatever the future provides here.

Just do it smile Sven-Ola

The discussion might have continued from here.