Skip to content

Commit

Permalink
removed dependency on echo.php for evaling outside sandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
koto committed Jun 23, 2012
1 parent f27ed0a commit 8291514
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
8 changes: 2 additions & 6 deletions console.html
Original file line number Diff line number Diff line change
Expand Up @@ -844,8 +844,6 @@ <h3>Saved screenshots <small>(experimental)</small></h3>
hook_url += '?' + hook_params.replace(/^&/, '');
}

var echo_js_url = document.location.href.replace(/\/console.html.*?/, '/echo.php');

$('.hook-url').each(function() {$(this).text($(this).text().replace(/__HOOK_URL__/g, hook_url)) });

$('#do-screenshot').click(function() {
Expand All @@ -856,12 +854,10 @@ <h3>Saved screenshots <small>(experimental)</small></h3>
var wrapper = "(function() {\n\
var d=document;\n\
var s = d.createElement('script');\n\
s.src = '__CODE__';\n\
s.textContent = unescape('__CODE__');\n\
d.body.appendChild(s);\n\
})();";
url = echo_js_url + '?c=' + encodeURIComponent(code) + '&t=' + Math.random();
var wrapped_code = wrapper.replace('__CODE__', url);

var wrapped_code = wrapper.replace('__CODE__', escape(code));
sendCmd('eval', wrapped_code, {id: tab_id});
}

Expand Down
5 changes: 0 additions & 5 deletions echo.php

This file was deleted.

11 changes: 1 addition & 10 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,7 @@ var server = http.createServer(function(request, response) {
response.end(getSnippetsXML());
return;
}

if (request.url.match(/\/echo\?/) || request.url.match(/\/echo\.php\?/)) {
var params = url.parse(request.url, true);
response.writeHead(200, {'content-type' : 'text/javascript'});
response.end(params.query.c);
return;
}


if (request.url == '/' || request.url == '/console.html') {
response.statusCode = 302;
response.setHeader('Location', '/console.html?ws_host=' + request.headers.host);
Expand All @@ -135,8 +128,6 @@ var server = http.createServer(function(request, response) {
}

fileserver.serve(request, response);
//response.writeHead(404);
//response.end();
});

var commandStorage = {}
Expand Down

0 comments on commit 8291514

Please sign in to comment.