Skip to content
Browse files

Adding URL handler for "/do=cmd" which executes 'cmd'.

  • Loading branch information...
1 parent 1384246 commit e83118a7c2229985ae6b79a33f013ed4abcfe365 @akoprow akoprow committed Mar 29, 2012
Showing with 11 additions and 3 deletions.
  1. +11 −3 src/webshell.opa
View
14 src/webshell.opa
@@ -78,7 +78,7 @@ function login_box() {
<span class=userbox>{content}</>
}
-function page() {
+function page(cmd) {
topbar =
WB.Navigation.fixed_navbar(
WB.Layout.fixed(
@@ -96,10 +96,16 @@ function page() {
</>
</>
)
+ function onready(_) {
+ match (cmd) {
+ case {some: cmd}: readevalwrite(cmd)
+ default: void
+ }
+ }
Resource.html("webshell",
<>
{topbar}
- {html}
+ <span onready={onready}>{html}</>
<div id="status"/>
</>
)
@@ -117,8 +123,10 @@ dispatcher = parser {
connect(TwitterConnect.login(twitter.fun_executor), data)
case "/connect/dropbox?" data=(.*) ->
connect(DropboxConnect.login(dropbox.fun_executor), data)
+ case "/do=" cmd=(.*) ->
+ page(some(Text.to_string(cmd)))
case .* ->
- page()
+ page(none)
}
Server.start(Server.http,

0 comments on commit e83118a

Please sign in to comment.
Something went wrong with that request. Please try again.