working latest bits
This commit is contained in:
parent
bbe88b1d94
commit
e8a5a1b17e
@ -30,7 +30,7 @@ let axiosOptions = {
|
||||
}
|
||||
|
||||
|
||||
const delay = ms => new Promise(res => setTimeout(res, ms));
|
||||
// const delay = ms => new Promise(res => setTimeout(res, ms));
|
||||
|
||||
|
||||
async function buildURL(streamURL, username, password) {
|
||||
@ -63,7 +63,6 @@ async function updateAccounts(userAccounts, data, url) {
|
||||
"password": account.password,
|
||||
"userId": account.userId
|
||||
}, urlData.extractedUrl, data.user_info.exp_date)
|
||||
var date = new Date(data.user_info.exp_date * 1000).toLocaleDateString(undefined, { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })
|
||||
console.log(`${urlData.extractedUrl}.`)
|
||||
|
||||
await updateOtherURLs(account.stream, urlData.extractedUrl)
|
||||
@ -89,54 +88,6 @@ async function addNewAccount(userAccount, data, url) {
|
||||
}
|
||||
}
|
||||
|
||||
// async function urlChecker(userAccounts) {
|
||||
// let ip = await inst.get('http://api.ipify.org')
|
||||
// console.log(ip.data);
|
||||
|
||||
// let updateCount = 0
|
||||
|
||||
// for (let index = 0; index < userAccounts.length; index++) {
|
||||
// const userAccount = userAccounts[index];
|
||||
// let count = index + 1
|
||||
// console.log(count + ' of ' + userAccounts.length + ' ' + userAccount.username)
|
||||
// for (let index2 = 0; index2 < userAccount.urls.length; index2++) {
|
||||
// const url = userAccount.urls[index2];
|
||||
// // console.log('url ' + index2 + 1 + ' of ' + userAccount.urls.length)
|
||||
// console.log('.')
|
||||
// try {
|
||||
// let response = await inst.get(url, axiosOptions)
|
||||
// if (response.data.user_info.auth) {
|
||||
// await updateAccounts(userAccounts, response.data, url)
|
||||
// updateCount++
|
||||
// break
|
||||
// }
|
||||
// } catch (error) {
|
||||
// try {
|
||||
// if (error.response.status == 403) {
|
||||
// let response2 = await axios.get(url, axiosOptions)
|
||||
// if (response2.data.user_info.auth) {
|
||||
// try {
|
||||
// await updateAccounts(userAccounts, response2.data, url)
|
||||
// updateCount++
|
||||
// break
|
||||
// } catch (error) {
|
||||
// continue
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } catch (error) {
|
||||
// continue
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// syncApache()
|
||||
// return {
|
||||
// "updatedCount": updateCount,
|
||||
// "totalAccounts": userAccounts.length
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
async function urlChecker(userAccounts) {
|
||||
let ip = await inst.get('http://api.ipify.org')
|
||||
@ -151,7 +102,7 @@ async function urlChecker(userAccounts) {
|
||||
for (let index2 = 0; index2 < userAccount.urls.length; index2++) {
|
||||
const url = userAccount.urls[index2];
|
||||
// console.log('url ' + index2 + 1 + ' of ' + userAccount.urls.length)
|
||||
console.log('.')
|
||||
// console.log('.')
|
||||
try {
|
||||
let response = await inst.get(url, axiosOptions)
|
||||
if (response.data.user_info.auth) {
|
||||
@ -233,7 +184,9 @@ async function accountChecker(accountData, urlList) {
|
||||
let response = await inst.get(url, axiosOptions)
|
||||
if (response.data.user_info.auth) {
|
||||
addNewAccount(accountData, data, url)
|
||||
break
|
||||
console.log('New Account Added')
|
||||
syncApache()
|
||||
return true
|
||||
}
|
||||
} catch (error) {
|
||||
try {
|
||||
|
@ -68,7 +68,7 @@ function getAllUniqueAccounts() {
|
||||
}
|
||||
|
||||
function getUserUniqueAccounts(userid) {
|
||||
let data = sql.query(`SELECT DISTINCT(userAccounts.stream), userAccounts.username, userAccounts.password, userAccounts.stream , userAccounts.streamURL FROM userAccounts
|
||||
let data = sql.query(`SELECT DISTINCT(userAccounts.streamURL), userAccounts.username, userAccounts.password, userAccounts.stream , userAccounts.streamURL FROM userAccounts
|
||||
WHERE userAccounts.expiaryDate != '0' AND
|
||||
userAccounts.userId = ${userid}
|
||||
GROUP BY userAccounts.stream
|
||||
|
Loading…
x
Reference in New Issue
Block a user