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