| I wanted a quick and easy means to talk to the arc server on my SheevaPlug (from the web). Thought I'd share the fun. Not as fancy as conanites' Rainbow or palsecams' Evserv project, but it works :) Steps: 1. Download -> http://wterminal.appspot.com/downloads/wterm-0.0.3.tar.gz (jQuery + plugin named wterm)
2. Get these 3 files out (jquery.min.js, wterm.jquery.js, wterm.css);
Put them somewhere and make sure your arc server can serve them out.
3. Make your service or HTML file and serve it from Arc.
Result should look like so... (make sure file paths are correct):
<html><head>
<link rel="stylesheet" type="text/css" href="css/wterm.css">
<title>Ajaxified Arc Terminal</title>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/wterm.jquery.js"></script>
<script type="text/javascript">
$(document).ready(function (){
$('#terminal').wterm({WIDTH: '100%', HEIGHT: '100%', WELCOME_MESSAGE: 'AJAX Terminal. To Begin Using type <strong>help</strong>'});
$.register_command('arc',{PS1:'arc $',START_HOOK: function(){set_prompt;},DISPATCH:'arc-handler'});});
</script>
</head>
<body style="margin:0; background-color: #000000;">
<div id="terminal" style="font-size: 1.3em; margin:10px; overflow:hidden;"></div>
</body></html>
4. Create and load an arc handler service:
(defop arc-handler req
(withs (exps (arg req "tokens")
return (on-err [prn "Error: " (details _)]
(fn () (eval (list 'eval (list 'quote (read exps)))))))
(write return)))
5. In your browser, go to your service or html file from step 3 and you
should see a prompt. Type "arc" to start arc mode.
Type "exit" to get back to the mainline.
"clear" works on the mainline.
Notes: If you want to send commands to the underlying server
just use (system "whatever") or (read (pipe-from "whatever")).
You could easily add python or ruby or other services
then use wterm as the gateway to each.
T. |