Trouble getting allowUnsafeEval to work


#1

Hi, I’m trying to write a package for Atom that causes the Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'" error.

I’m trying to use loophole to get it to work:

allowUnsafeEval(function() { 
    var client = new pg.Pool(config);
    client.connect(function(err) {
        console.log("Connected!!!");
        client.query("Select * From stuff Limit 1", [], function(err, result) {
            console.log(result, err);
        });
    });		
});

but it still results in the error, anyone know what i’m doing wrong here.


#2

I do not know anything about loophole but if you edit the app.asar index.html and remove the CSP headers you shouldnt have a problem. Do so at your own risk ofcourse