After the huge amount of emails asking to add support for a certain type of router, I have stopped taking these kinds of requests. I am a full time student and barely have any free time. If you do add support for your router, consider contributing the parser back to this project so it can be added to the main release.
Using The RegExp Parser
Starting with version 0.1.7.2, there is a new RegExp parser which allows you to add support for any router with a web interface that uses basic HTTP authentication.
To use it, right click on the status bar icon, then go to Options->Other. There you will see a text box where you can specify a custom parser.
Enter: generic/regexp?[options]
You must then specify the [options]. Each piece of status information requires a URL and a regular expression. The syntax of the options is name=value[|name=value]. Everything must be URI encoded.
Adding Status Information
The name of the options for status information are "item_[id]" and "item_[id]_[type]". The [id] can be anything and is used to link the information located on a single page together. The value for "item_[id]" is the URL of the page with the status information without the hostname and port. The [type] can be anything, but there are some predefined values you can also use:
- hostname=Hostname
- lanip=Local IP
- wanip=External IP
- clients=Clients
- load=Load Average
- uptime=Uptime
- memory=Memory Usage
- ssid=SSID
- channel=Channel
- speed=Speed
- connections=Connections
- bandwidth=Bandwidth Usage
- error=Error
The value of that RegExp is the URL encoded regular expression whose first match is the value that you want to display. You can have as many regexp values as you want, just make sure to use unique [type] values. For example, to display an error with the index page's title you would use item_foo=%2F|item_foo_error=%3Ctitle%3E(.*%3F)%3C%2Ftitle%3E.
Adding Actions
Each action consists of 1 required and 1 optional value. The required value is the URL to request. It is called "action_[name]". The [name] can be:
- cp=Page to open when "Router Control Panel" is clicked. Defaults to "/".
- dhcprenew=DHCP Renewal Action URL
- dhcprelease=DHCP Release Action URL
- reboot=Reboot Action URL
If the URL requires a POST request, you must specify "action_[type]_post". Its value is the POST data that is sent along with the request.
For example: action_reboot=%2Freboot.cgi|action_reboot_post=reboot%3D1
So the full value would be:
generic/regexp?item_foo=%2F|item_foo_error=%3Ctitle%3E(.*%3F)%3C%2Ftitle%3E|action_reboot=%2Freboot.cgi|action_reboot_post=reboot%3D1
Creating Your Own Parser
If you know JavaScript it should not be too hard to figure out how to do it. Find the example files in routerstatus.jar/content/parsers/.
Basic Template
({
defaults: {
host: "Default IP Of Router",
username: "Default Username",
password: "Default Password"
},
// Optional Paths To Be Called For Actions. They Must Have The Leading Slash. Ex: "/index.html"
// If *_post Is Specified, The Request Will Be A POST Instead Of A GET.
// These May Also Be Functions Which Will Be Called Instead Of Strings.
action_reboot: "",
action_reboot_post: "",
action_dhcprenew: "",
action_dhcprenew_post: "",
action_dhcprelease: "",
action_dhcprelease_post: "",
update: function () {
// Called On Update
},
parse_status: function (aRequest) {
// aRequest is the XMLHTPRequest Object
// Parse It However You Want
// this.data["Information Key/Name"] = Value;
},
login: function (aCallback) {
// Optional Function That Is Called Before Update/Actions
// aCallback Is A Reference To The Action/Update Being Called And Needs To Be Called After Login Is Complete
}
});
Utility Functions
From within the parser, you have access to |this.service|. It is a reference to the main Router Status service. It has several methods you can use within the parser. They include |request|, |loadpage|, and |parsehtmltodom|. Look at some example parsers to figure out how to use them.
Getting Me To Add Your Router
I no longer have time to add support for random routers in my free time (which is almost non-existent anymore). If you really want your router added, pay me some $ and provide access to the web interface of your router for a few hours so I can figure out how to add it. If you don't want to give a random stranger access to your router (any person in their right mind wouldn't), then don't complain that your router isn't supported since I am not going to go out and buy a $100 router every time someone wants a router added.