Skip to content

Instantly share code, notes, and snippets.

@chelovekula
Created August 21, 2019 12:43
Show Gist options
  • Save chelovekula/0f6f9474a1285aa1a110edeca590e81a to your computer and use it in GitHub Desktop.
Save chelovekula/0f6f9474a1285aa1a110edeca590e81a to your computer and use it in GitHub Desktop.
api-h
app.post("/api/buy_fb_accounts", async (req, res) => {
let auth = req.headers.authorization;
let ip = req.connection.remoteAddress;
let n = req.body.n;
let set_login = req.body.set_login;
if (auth = "SUPER-PASSWORD - SHOW IN TELEGRAM") {
const collection = req.app.locals.fbAccounts;
let before = collection.count({username: set_login});
let i = n;
while ( i-- ) {
collection.update({username : ""},{$set:{username: set_login}}, {upsert:false, multi:false})
}
let after = collection.count({username: set_login});
if (n == after - before) {
res.send({result: true});
console.log("Set " + n + " FB accounts for " + set_login + " in " + Date() + " ip address " + ip);
} else {
return console.log('error');
}
} else {
res.send('need_auth');
console.log("Failed to access api(save_user_profile), need_auth " + Date() + " ip address " + ip);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment