Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = f;
var phin = require('phin').defaults({'headers': { 'User-Agent': 'evewho.com' } });
async function f(app) {
let promises = [];
let chars = await app.mysql.query('select character_id, corporation_id, alliance_id, faction_id from ew_characters where lastUpdated > 0 and lastAffUpdated < date_sub(now(), interval 1 day) order by lastAffUpdated limit 1000');
if (chars.length == 0) return;
let char_array = [];
let map = {};
for (let i =0; i < chars.length; i++) {
char_array.push(chars[i].character_id);
map[chars[i].character_id] = chars[i];
}
await app.mysql.query('update ew_characters set lastAffUpdated = now() where character_id in (' + char_array.join() + ')');
let url = 'https://esi.evetech.net/v1/characters/affiliation/'
},{"../package.json":"../package.json"}],"../config/phin.config.js":[function(require,module,exports) {
const p = require("phin");
const store = require("./store.config");
let options = {
parse: "json",
core: {
headers: {
"Content-Type": "application/json"
}
}
};
if (store.has("token")) options.core.headers.Authorization = "Token " + store.get("token");
module.exports = p.defaults(options);
},{"./store.config":"../config/store.config.js"}],"../components/loader.js":[function(require,module,exports) {
"use strict";
#!/usr/bin/env node
var Database = require('../classes/Database.js');
var getJSON = require('get-json');
var redis = require('async-redis').createClient();
var phin = require('phin').defaults({'method': 'get', 'headers': { 'User-Agent': 'evewho.com' } });
const app = {};
app.debug = false;
app.bailout = false;
app.error_count = 0;
app.phin = phin;
app.fetch = async function(url, parser, failure, options) {
try {
return await parser(app, await phin(url), options);
} catch (e) {
return failure(app, e);
}
};
app.redis = redis;
app.mysql = new Database({
},{"../package.json":"../package.json"}],"../config/phin.config.js":[function(require,module,exports) {
const p = require("phin");
const store = require("./store.config");
let options = {
parse: "json",
core: {
headers: {
"Content-Type": "application/json"
}
}
};
if (store.has("token")) options.core.headers.Authorization = "Token " + store.get("token");
module.exports = p.defaults(options);
},{"./store.config":"../config/store.config.js"}],"../components/loader.js":[function(require,module,exports) {
"use strict";
},{"../package.json":"../package.json"}],"../config/phin.config.js":[function(require,module,exports) {
const p = require("phin");
const store = require("./store.config");
let options = {
parse: "json",
core: {
headers: {
"Content-Type": "application/json"
}
}
};
if (store.has("token")) options.core.headers.Authorization = "Token " + store.get("token");
module.exports = p.defaults(options);
},{"./store.config":"../config/store.config.js"}],"../components/loader.js":[function(require,module,exports) {
"use strict";