The DoDWAN Webapp repository plugin allows to run a HTTP server that hosts web applications that act as clients of the DoDWAN Websocket Network API (aka DoDWAN webapps). DoDWAN webapps are self-contained ; they should function without any access to the Internet, communicating solely through DoDWAN.
Please refer to the installation documentation for details about how to install and start the plugin.
The DoDWAN Webapp repository plugin hosts DoDWAN webapps. The repository itself is a RESTFul web application that offers the following operations:
GET /repo
Obtain the list of installed (hosted) webapps.
The list is a JSON array of strings, each string being the name of the webapp.
GET /repo/<app>
Obtain webapp <app>
. The response contains the webapp in DWAR format.
POST /repo/<app>
Install webapp <app>
, that is, add it to the repository. The request should contain the webapp in DWAR format.
If the webapp was already present in the repository, it is overwritten.
DELETE /repo/<app>
Remove webapp <app>
from the repository.
The DoDWAN Webapp repository plugin makes the installed webapps accessible in
the /apps
directory. For example, assuming dodwand runs on localhost, the
vote
application is accessible at http://localhost/apps/vote
.
In addition to providing the REST operations described above, the HTTP server
run by the DoDWAN Webapp repository plugin also serves content at the root
directory. The is no constraint on this content (apart from the fact that it
should not include an apps
or repo
directory. For example, this root
content could be a web aplication that plays the role of a graphical webapp
manager, allowing a user to easily manage the repository.
A DoDWAN webapp is intended to be hosted in a directory whose name (basename) is the name of the webapp. This directory should include a traditional index file (e.g. index.html).
For webapp <app>
, this directory should also include
<app>.txt
that contains a textual description of the webapp (a few lines max).<app>.png
that contains the webapp logo (square picture of at least 32x32 pixels)For ease of storage and transmission, DoDWAN webapps are packed in archives
following the DWAR (Dodwan Webapp ARchive) format. A DWAR document follows the
JSONP format to bypass same origin policy. It is an ASCII text that consists in
a Javascript call to the dwar
function with an object as argument. This
object has two string properties :
name
the name of the webapp data
the webapp directory zipped and encoded in base64. Note that the top-level directory itself (whose name is the webapp name) is included.For example, the following tree describes a DoWDAN webapp name vote that is packaged in the given DWAR document (the base64 data are shortened for sake of clarity).
vote
|__ index.tml
|__ style.css
|__ main.js
|__ vote.png
|__ vote.txt
|__ images
|__ background.jpg
dwar({'name':'vote','data':'UEsDBAoAAAAAAAxyhU4AAAAAAAAAAAAAAAAFABwAdm9...SwUGAAAAAAQABABNAQAAjwYAAAAA'});