Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
console.log('load script', this.dir + '/' + fileName + '.js')
if (!fs.existsSync(this.dir + '/' + fileName + '.js')) {
fileName = false
}
if (!fileName) {
res.status(404)
res.send('no input')
} else {
var script = fs.readFileSync(this.dir + '/' + fileName + '.js')
var uniq = (new Date()).getTime()
fileName = fileName.replace('/', '-')
var tmp = os.tmpdir() + '/' + fileName + uniq + '.js'
fs.writeFileSync(tmp, script, 'utf-8')
var scr = require(tmp).scraper
//support old ver
if (scr.setup) scr.onInit = scr.setup
//support action
if (scr.secure) {
var token = req.body.token ? req.body.token : req.query.token
var valid = localStorage.getItem(token)
if (valid) {
} else {
res.json({
error: true,
message: 'token not valid'
})
return false
}
}
if (req.params.action) {
console.log(scr[req.params.action].toString().indexOf('res.'))