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", "DBPASS": "Grd555269",
"DATABASE": "BBLB_DNS", "DATABASE": "BBLB_DNS",
"DBPORT": "3306", "DBPORT": "3306",
"TORSSRV": "localhost",
"TORSPWD": "KarlMax",
} }
}, },
{ {

View File

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

View File

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

View File

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

View File

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