I builded a package for Wifidog in the packages directory. When I want to submit my configuration, index.sh can not easily handle the data.
My first try was that : I set subsection=wifidog_set in the form, the file will be out of the wifidog in /www/openwrt/packages/wifidog_set and all will work as expected. But this is not really usefull for single dir package files add-on.
So I did some modification to index.sh : I added read STDIN in the file and modified this code :
[...]
if [ "$section" = "packages" ] && [ -d $pkg_dir/$subsection ]; then
if [ "$(post_var submit)" = "Apply+Changes" ]; then
. "$section/$subsection/submit"
else
. "$section/$subsection/index"
fi
else
. "$section/$subsection"
fi
[...]
and added the name field for the submit button to my script of wifidog :
<input type="submit" value="Apply Changes" class="submit" name="submit" />
With this code if the submit button is defined by Apply Changes, the submit file is sourced instead of the index file.
What do you think of my modifications ?
And I want to know why you are not reading STDIN in index.sh and remove all read STDIN of the beginning of all submit files ? I did not read all the script and I want to know if I am not breaking some code or going in futur design trouble.
Many scripts did no data input validation. What is the best, javascript validation before submitting data or shell validation before doing any modifications ?
Also, If some people ask for small documentation I can write something. It's easy to understand how all things work, but it will provide rapid overview and standard code creation and validation.
I take a look of the needs of Ile Sans Fil and I will had support for :
- httpd : done, need some minor changes before releasing code
- ez-ipupdate (package) : In progress
- rdate : In progress
- Wifidog (package) : Basic config done and tested
- pppoe : To do
- Maybe some basic support for openvpn (package)
Thanks