This commit is contained in:
Karl 2021-09-23 17:25:44 +00:00
parent d2b90240da
commit 334ccf268e
5 changed files with 41 additions and 14 deletions

2
.vscode/launch.json vendored
View File

@ -18,6 +18,8 @@
"DBPASS": "Grd555269",
"DATABASE": "BBLB_DNS",
"DBPORT": "3306",
"TORSSRV": "localhost",
"TORSPWD": "KarlMax",
}
},
{

View File

@ -6,6 +6,8 @@ services:
context: .
dockerfile: .dockerfile
image: "karl0ss/bblbtv_dns-backend"
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- ./SQL/:/docker-entrypoint-initdb.d
ports:
@ -16,6 +18,8 @@ services:
- DBPASS=Grd555269
- DATABASE=BBLB_DNS
- DBPORT=3306
- TORSSRV=host.docker.internal
- TORSPWD=KarlMax
# frontend:
# build:
# context: ./client

View File

@ -7,12 +7,14 @@ const { storeAccountToDB } = require('../lib/Accounts')
const axios = require('axios')
const tor_axios = require('tor-axios');
const tor = tor_axios.torSetup({
ip: 'localhost',
ip: process.env.TORSSRV,
port: 9050,
controlPort: '9051',
controlPassword: 'KarlMax',
controlPassword: process.env.TORSPWD,
})
// axios.defaults.timeout = 10000;
// tor.defaults.timeout = 10000
const delay = ms => new Promise(res => setTimeout(res, ms));
@ -79,19 +81,30 @@ async function urlChecker(userAccounts, urlList) {
console.log(ip.data);
await Promise.all(urlList.map(async (url) => {
try {
const response = await tor.get(url)
let response
url
if (url.includes('https')) {
try {
response = await axios.get(url)
} catch (error) {
// console.log(error)
}
} else {
response = await tor.get(url)
}
if (response.status == 200 && response.data !== "") {
try {
let data = response.data
if (data.user_info.auth) {
console.log(url)
// console.log(url)
updateAccounts(userAccounts, data, url)
return true
}
} catch {
}
}
} catch {
} catch (error) {
// console.log(error)
}
})).then((values) => {
endresponse = values
@ -129,6 +142,7 @@ async function userCheck(accountData) {
return value === true;
}).length
console.log('true ' + updatedCount)
return endresponse = {
"update": true,
"count": updatedCount

View File

@ -1,7 +1,13 @@
[
"https://trippy.pro:443",
"https://itty.in:443",
"https://tictacs.win",
"http://sting.ltd:25461",
"http://37723998.to:2052"
]
{
"using": [
"https://trippy.pro:443",
"https://itty.in:443",
"http://sting.ltd:25461",
"http://37723998.to:2052",
"https://tictacs.win"
],
"notUsing": [
"https://blackpud475.xyz"
]
}

View File

@ -24,7 +24,8 @@ async function getStreamsNew() {
try {
DNSList = JSON.parse(DNSList)
} catch (error) {
jointArray.unshift(...otherURLs)
jointArray.unshift(...otherURLs.using)
jointArray = [...new Set(jointArray)]
return jointArray
}
}
@ -34,7 +35,7 @@ async function getStreamsNew() {
});
}
jointArray.unshift(...otherURLs)
jointArray = [...new Set(jointArray)]
return jointArray
}
/* GET users listing. */