04.30.07
POW 0.1.2 Preview Available
POW 0.1.2 is available. It allows modules from developers to be loaded. Here’s how to create the “hello world” module.
hello.sjs:
<html>
<head>
<title>Hello World!</title>
</head>
<body>
<?sjs
var a = Math.floor(Math.random()*2);
if(a < 1) {
document.writeln("¡Hola, mundo!");
} else {
document.writeln("Hello World!");
}
?>
</body>
</html>
hello.install.sjs
<html>
<head>
<title>Hello POW Module</title>
</head>
<body>
<script>
var pow_installer = {
version: "1.0.0",
name: "hello",
location: "http://localhost/~davidkellogg/xul/pow/modules/hello.zip"
};
</script>
<center>Downloading Pow Module will begin now.</center>
<br/>
If this does not happen, please go directly to <a href="hello.zip">hello.zip</a>.
Once completed please see <a href="http://localhost:6670/modules/hello/hello.sjs">Hello Mundo!</a>.
</body>
</html>
zip hello.zip hello.sjs
Place the hello.install.html file in the same directory as hello.zip.
That’s it!
A few extra notes:
1. Files ending in .install.sjs and .install.html both work as installers.
2. The installer Javascript is never executed by the chrome for security reasons, so formatting counts. Use the pow_installer formatting as shown.
3. File extensions are whitelisted (.js, .html, .sjs, .gif, .jpg, .png). All others must be copied manually. This is a security restriction.
4. Please document your module. We need to keep minimum standards.
5. Further restrictions on eval and file writes may occur. Both may result in security alerts or files that must be copied by hand.
Tell me if there any problems with your modules.
Dave
David Watson said,
November 7, 2007 at 1:42 pm
If your location field of your install.html file is using ~localhost, isn’t this going to screw up my install of pow from trying to load the zip from your server? Shouldn’t you use the absolute url?
I just tried this on your server and after I clicked ‘yes’ nothing happened. But when I moved it on my server and made the location value absolute it worked.
David Kellogg said,
November 7, 2007 at 8:34 pm
Good find. I changed it on the server.