working at the moment
This commit is contained in:
parent
6eb118ca87
commit
53d150b64e
@ -139,9 +139,9 @@ async function test(userAccount, streamURLS) {
|
||||
})
|
||||
}
|
||||
|
||||
function updateAccountDNS(userAccount, streamURLS) {
|
||||
return new Promise((resolve, reject) => {
|
||||
streamURLS.forEach(async streamURL => {
|
||||
async function updateAccountDNS(userAccount, streamURLS) {
|
||||
// return new Promise(async (resolve, reject) => {
|
||||
await Promise.all(streamURLS.map(async (streamURL) => {
|
||||
process.stdout.write('.')
|
||||
let url = await buildURL(streamURL, userAccount.username, userAccount.passwordDecryped)
|
||||
// console.log('tested url ' + url)
|
||||
@ -158,13 +158,10 @@ function updateAccountDNS(userAccount, streamURLS) {
|
||||
resolve(true)
|
||||
}
|
||||
} catch (error) {
|
||||
// break
|
||||
}
|
||||
} else {
|
||||
// resolve(false)
|
||||
}
|
||||
})
|
||||
})
|
||||
}));
|
||||
}
|
||||
|
||||
async function updateAccounts(userAccount, streamURLS) {
|
||||
@ -205,20 +202,22 @@ async function newUserCheck(accountData) {
|
||||
return user
|
||||
})
|
||||
|
||||
try {
|
||||
// try {
|
||||
for (let i = 0; i < userAccounts.length; ++i) {
|
||||
const userAccount = userAccounts[i];
|
||||
if (userAccount.expiaryDate != 123 && Math.round(Date.now() / 1000) > userAccount.expiaryDate) {
|
||||
setExpired(userAccount)
|
||||
} else {
|
||||
await updateAccountDNS(userAccount, streamURLS)
|
||||
// console.log(a)
|
||||
}
|
||||
}
|
||||
console.log(Date.now())
|
||||
return true
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
// } catch (error) {
|
||||
// return true
|
||||
// console.error(error);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@ -326,7 +325,7 @@ async function newSingleCheck(accountData) {
|
||||
// "username": 'Karl0ss1709',
|
||||
// "password": 'YEfbZskEH2Zu',
|
||||
// "stream": "Badger",
|
||||
// "userId": 1
|
||||
// "userId": 5
|
||||
// })
|
||||
|
||||
|
||||
|
@ -5,6 +5,7 @@ const gotRequest = async (url) => {
|
||||
let options = {
|
||||
timeout: 2000
|
||||
}
|
||||
return new Promise(async (resolve, reject) => {
|
||||
await got(url, options)
|
||||
.then((response) => {
|
||||
returnResponse = response;
|
||||
@ -17,7 +18,8 @@ const gotRequest = async (url) => {
|
||||
}
|
||||
});
|
||||
|
||||
return returnResponse;
|
||||
resolve(returnResponse);
|
||||
})
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,6 +9,7 @@ const { newUserCheck } = require('../lib/checker')
|
||||
router.get('/', async function (req, res, next) {
|
||||
let postData = req.body
|
||||
postData.userId = getUserId(req.auth.user)
|
||||
// postData.userId = 5
|
||||
a = await newUserCheck(postData)
|
||||
if (a) {
|
||||
res.send(200)
|
||||
|
Loading…
x
Reference in New Issue
Block a user