update
This commit is contained in:
parent
340fccdf46
commit
d4a025fadd
@ -185,32 +185,32 @@ async function newCheck() {
|
||||
// }));
|
||||
// }
|
||||
|
||||
async function updateAccounts(userAccount, streamURLS) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
await streamURLS.forEach(async streamURL => {
|
||||
process.stdout.write('.')
|
||||
let url = await buildURL(streamURL, userAccount.username, userAccount.passwordDecryped)
|
||||
console.log('tested url ' + url)
|
||||
let t = await gotRequest(url)
|
||||
let body = t.body
|
||||
if (t.statusCode == 200 && body !== "") {
|
||||
try {
|
||||
body = JSON.parse(body)
|
||||
if (body.user_info.auth) {
|
||||
var date = new Date(body.user_info.exp_date * 1000).toLocaleDateString(undefined, { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })
|
||||
// process.stdout.write('\n')
|
||||
console.log(`${userAccount.username} - ${userAccount.stream} - ${streamURL} - Expires ${date}.`)
|
||||
await updateStreamData(userAccount, streamURL, body.user_info.exp_date)
|
||||
resolve(true)
|
||||
}
|
||||
} catch (error) {
|
||||
}
|
||||
} else {
|
||||
}
|
||||
})
|
||||
reject(userAccount)
|
||||
})
|
||||
}
|
||||
// async function updateAccounts(userAccount, streamURLS) {
|
||||
// return new Promise(async (resolve, reject) => {
|
||||
// await streamURLS.forEach(async streamURL => {
|
||||
// process.stdout.write('.')
|
||||
// let url = await buildURL(streamURL, userAccount.username, userAccount.passwordDecryped)
|
||||
// console.log('tested url ' + url)
|
||||
// let t = await gotRequest(url)
|
||||
// let body = t.body
|
||||
// if (t.statusCode == 200 && body !== "") {
|
||||
// try {
|
||||
// body = JSON.parse(body)
|
||||
// if (body.user_info.auth) {
|
||||
// var date = new Date(body.user_info.exp_date * 1000).toLocaleDateString(undefined, { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })
|
||||
// // process.stdout.write('\n')
|
||||
// console.log(`${userAccount.username} - ${userAccount.stream} - ${streamURL} - Expires ${date}.`)
|
||||
// await updateStreamData(userAccount, streamURL, body.user_info.exp_date)
|
||||
// resolve(true)
|
||||
// }
|
||||
// } catch (error) {
|
||||
// }
|
||||
// } else {
|
||||
// }
|
||||
// })
|
||||
// reject(userAccount)
|
||||
// })
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
@ -21,7 +21,7 @@ router.post('/', async function (req, res, next) {
|
||||
if (a) {
|
||||
res.send('Account ' + postData.username + ' Added successfully to ' + req.auth.user)
|
||||
} else {
|
||||
res.send(500);
|
||||
res.sendStatus(500);
|
||||
}
|
||||
// }
|
||||
});
|
||||
|
@ -16,4 +16,13 @@ router.get('/', async function (req, res, next) {
|
||||
res.send(data)
|
||||
});
|
||||
|
||||
router.get('/count', async function (req, res, next) {
|
||||
try {
|
||||
let data = await getUserAccounts(await getUserId(req.auth.user))
|
||||
res.json({"streamCount": data.length})
|
||||
} catch (error) {
|
||||
res.sendStatus(500)
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
Loading…
x
Reference in New Issue
Block a user