diff --git a/.vscode/launch.json b/.vscode/launch.json index 89becdb..052c32b 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -18,6 +18,8 @@ "DBPASS": "Grd555269", "DATABASE": "BBLB_DNS", "DBPORT": "3306", + "TORSSRV": "localhost", + "TORSPWD": "KarlMax", } }, { diff --git a/docker-compose.yml b/docker-compose.yml index f3dbfe2..813be1e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/lib/checker.js b/lib/checker.js index 65a9670..377656b 100644 --- a/lib/checker.js +++ b/lib/checker.js @@ -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 diff --git a/lib/otherURLs.json b/lib/otherURLs.json index 05ad5ef..edae669 100644 --- a/lib/otherURLs.json +++ b/lib/otherURLs.json @@ -1,7 +1,13 @@ -[ - "https://trippy.pro:443", - "https://itty.in:443", - "https://tictacs.win", - "http://sting.ltd:25461", - "http://37723998.to:2052" -] \ No newline at end of file +{ + "using": [ + "https://trippy.pro:443", + "https://itty.in:443", + "http://sting.ltd:25461", + "http://37723998.to:2052", + "https://tictacs.win" + + ], + "notUsing": [ + "https://blackpud475.xyz" + ] +} \ No newline at end of file diff --git a/routes/getStreams.js b/routes/getStreams.js index 0e29a45..b77ef64 100644 --- a/routes/getStreams.js +++ b/routes/getStreams.js @@ -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. */