diff --git a/LICENCE b/LICENCE new file mode 100644 index 0000000..715a65a --- /dev/null +++ b/LICENCE @@ -0,0 +1,31 @@ +The files in this directory and elsewhere which refer to this LICENCE +file are part of blash, the library for the high-level management of +network sockets. + + Copyright (C) 2010 BlackLight + +blash is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3 or (at your option) any later +version. + +blash is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License along +with blash; if not, write to the Free Software Foundation, Inc., +59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +As a special exception, if other files instantiate templates or use +macros or inline functions from these files, or you compile these +files and link them with other works to produce a work based on these +files, these files do not by themselves cause the resulting work to be +covered by the GNU General Public License. However the source code for +these files must still be made available in accordance with section (3) +of the GNU General Public License. + +This exception does not invalidate any other reasons why a work based on +this file might be covered by the GNU General Public License. + diff --git a/README b/README new file mode 100644 index 0000000..da372ce --- /dev/null +++ b/README @@ -0,0 +1,77 @@ +blash - BlackLight's shell +An AJAX CMS for browsing your web site through a shell-oriented interface +by BlackLight, , http://0x00.ath.cx + +Q.: What is blash? +A.: blash is a tiny CMS developed in AJAX that allows you to browse your website +through a shell-oriented interface. The way to use it is quite simple and +inspired from software like bash and zsh, you can see an example running at the +address http://0x00.ath.cx/blash/index.html. + +Q.: How can a web site be represented like a filesystem browsable from a terminal? +A.: A directory is fundamentally a `container' of logically correlated items (for +example, a directory could be blog/, or forum/, or news/, and so on). A page in your +web site is represented as file inside of its directory (for example, the 4th post +in a blog may be represented as the file `4' in directory `blog/'). Then you can +simply browse the web site in the following way: + +- ls for viewing the content of a certain directory +- cd for changing the current directory +- cat for opening a certain file + +A `file' can be a container of static stuff (in this case `cat' simply prints +its content on the pseudo-terminal) or the link to another page (in this case +`cat' opens that link in a new window or tab, be sure you allow your web site to +open popup windows). The pages having static content printed to the +pseudo-terminal are represented in normal font, the files that links to an +external content is instead represented as an `executable' file (by default, in +colour green). + +Q.: Which browsers are compatible with blash? +A.: So far blash has been successfully tested with the following browsers: + +- Mozilla Firefox ( >= 3.5) +- Opera ( >= 11.0 ) +- Google Chrome (despite the auto-completion feature is a bit buggy) +- Konqueror >= 4.x +- Flock +- uzbl +- surf +- vimprobable +- jumanji + +However, any browser with a decent JavaScript engine should give no problem with +blash. Internet Explorer is currently NOT working with blash, at least any +release <= 8. I'm sorry, choose a decent browser. + +Q.: How do I add the contents for my web site in blash? +A.: Open the file blash.json. This JSON file contains the preferences for your +shell (banner, prompt style, default user, escape sequences recognized in the +prompt string...), the commands to be used, and the array "directories". This +array is the container of your web site data. Each element can have the +following fields: + +- path (MANDATORY), the full absolute path that identifies that resource +- type (MANDATORY), the resource type (directory or file) +- href (for files only), if the file is a link to an external page, the link it +should point to +- content (for files only), if the file has static content that should be +printed in the pseudo-terminal window, this field contains its content + +Q.: Can I add more commands? +A.: Sure you can. Take a look at directory `commands' for seeing the definition +of default commands. Each commands is represented as a JSON file containing the +following fields: + +- "name", name of the command +- "info", array containing the fields "syntax" and "brief", used for showing the +syntax of the command when you type `man blash' and the full description when +you type `man ' +- "action": a function taking as parameter the argument passed to the command +and executing the command itself. This function returns the string that should +be printed by the command to the terminal. You can also access and/or modify +blash's variables and settings accessing them through the object shell.* take a +look at the file `blash.js' for a brief description of the fields of this object +or to the sample commands in `commands/' directory for seeing how to access +them. + diff --git a/blash.css b/blash.css index 31926fb..da09cb0 100644 --- a/blash.css +++ b/blash.css @@ -14,12 +14,12 @@ input.promptInput color : #888; font-family : Terminus, courier, monospace, fixed; font-size : 13px; - width : 400px; + width : 500px; } div#blashWindow { - width : 600px; + width : 800px; height : 400px; margin : auto; padding : 10px; @@ -28,12 +28,6 @@ div#blashWindow tabindex : -1; } -a.bannerLink -{ - color : white; - tabindex : -1; -} - span.directory { color : #2553ee; diff --git a/blash.js b/blash.js index d840cad..0db9bba 100644 --- a/blash.js +++ b/blash.js @@ -1,3 +1,13 @@ +/***************************************************************** + * * + * blash - An AJAX CMS for browsing your web site like a shell * + * * + * by BlackLight , (C) 2010 * + * Web: http://0x00.ath.cx * + * Released under GPL licence v.3 * + * * + *****************************************************************/ + var shell = null; function blash () diff --git a/blash.json b/blash.json index 1c07349..37229d9 100644 --- a/blash.json +++ b/blash.json @@ -1,9 +1,16 @@ +/** + * Sample configuration and contents + */ + { "banner" : "blash version 0.1
" + "Copyright (C) 2010 BlackLight <blacklight@autistici.org>" + "
Licence GPLv3+: GNU GPL version 3 or later " + - "<" + - "http://gnu.org/licences/gpl.html>

" + + "<" + + "http://gnu.org/licences/gpl.html>
" + + "Source code available at " + + "https://github.com/BlackLight/blash

" + "This is free software; you are free to change and " + "redistribuite it.
There is NO WARRANTY, to the " + "extent permitted by law.
" + @@ -70,6 +77,7 @@ "commands" : [ "cat", "cd", + "eval", "find", "ls", "man", diff --git a/commands/eval.json b/commands/eval.json new file mode 100644 index 0000000..b913eb2 --- /dev/null +++ b/commands/eval.json @@ -0,0 +1,26 @@ +{ + "name" : "eval", + + "info" : { + "syntax" : "eval <javascript expression>", + "brief" : "Executes a certain JavaScript expression", + }, + + "action" : function ( arg ) + { + var out = ''; + + if ( !arg || arg.length == 0 ) + { + return "Argument required
\n"; + } + + out = eval ( arg ); + + if ( out ) + return out; + else + return ''; + }, +} +