diff --git a/python_aternos/atjsparse.py b/python_aternos/atjsparse.py index bb6cf46..88bd065 100644 --- a/python_aternos/atjsparse.py +++ b/python_aternos/atjsparse.py @@ -135,12 +135,15 @@ class Js2PyInterpreter(Interpreter): super().__init__() ctx = js2py.EvalJs({'atob': atob}) - ctx.execute('window.document = { };') - ctx.execute('window.Map = function(_i){ };') - ctx.execute('window.setTimeout = function(_f,_t){ };') - ctx.execute('window.setInterval = function(_f,_t){ };') - ctx.execute('document.getElementById = function(_a) { };') - ctx.execute('window.encodeURIComponent = function(_s){ };') + ctx.execute(''' + window.Map = function(_i){ }; + window.setTimeout = function(_f,_t){ }; + window.setInterval = function(_f,_t){ }; + window.encodeURIComponent = function(_s){ }; + window.document = { }; + document.doctype = { }; + document.getElementById = function(_s){ }; + ''') self.ctx = ctx diff --git a/python_aternos/data/server.js b/python_aternos/data/server.js index 72f4ed9..f33af11 100644 --- a/python_aternos/data/server.js +++ b/python_aternos/data/server.js @@ -14,9 +14,13 @@ const vm = new VM({ atob: atob, setTimeout: (_a, _b) => {}, setInterval: (_a, _b) => {}, + document: { + getElementById: (_i) => {}, + doctype: {}, + }, }, }) -vm.run('var window = global; var document = {}') +vm.run('var window = global') const listener = (req, res) => {