allow the urls to stull build if a source dies
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 22s

This commit is contained in:
Karl 2025-07-13 16:51:40 +01:00
parent a710f242f4
commit 07340e9341
3 changed files with 29 additions and 34 deletions

View File

@ -22,16 +22,3 @@ services:
- DBPORT=3306
- TORSSRV=host.docker.internal
- TORSPWD=KarlMax
# frontend:
# build:
# context: ./client
# dockerfile: Dockerfile.prod
# # dockerfile: .dockerfile
# image: "karl0ss/bblbtv_dns-frontend"
# ports:
# - "6969:6969"
# environment:
# - URL=vps.k-world.me.uk
# - PORT=6969
# links:
# - "backend"

View File

@ -1,6 +1,6 @@
{
"name": "react-backend",
"version": "1.0.9",
"version": "1.0.10",
"private": true,
"scripts": {
"start": "node ./bin/www"

View File

@ -18,26 +18,34 @@ async function getStreamsNew() {
let jointArray = []
for (let index = 0; index < DNSArray.length; index++) {
const url = DNSArray[index];
try {
requestData = await makeRequest(url)
let DNSList = requestData.body
if (typeof DNSList === 'string' || DNSList instanceof String) {
try {
DNSList = JSON.parse(DNSList)
} catch (error) {
jointArray.unshift(...otherURLs.using)
jointArray = [...new Set(jointArray)]
return jointArray
console.error(`Failed to parse JSON for url: ${url}`);
continue; // skip to next url
}
}
try {
DNSList = splitToArray(DNSList.su)
} catch (error) {
DNSList = splitToArray(DNSList.fu)
}
DNSList.forEach(url => {
let extractedUrls;
if (DNSList && DNSList.su) {
extractedUrls = splitToArray(DNSList.su);
} else if (DNSList && DNSList.fu) {
extractedUrls = splitToArray(DNSList.fu);
} else {
console.error(`Could not find 'su' or 'fu' for url: ${url}`);
continue; // skip to next url
}
extractedUrls.forEach(url => {
jointArray.push(url)
});
} catch (error) {
console.error(`Failed to process url: ${url}`, error);
}
}
jointArray.unshift(...otherURLs.using)
jointArray = [...new Set(jointArray)]
@ -45,7 +53,7 @@ async function getStreamsNew() {
}
/* GET users listing. */
router.get('/', async function (req, res, next) {
let fullStreamArray = await main()
let fullStreamArray = await getStreamsNew()
res.send(fullStreamArray)
});