get p2pServers without using eval
parent
290541b976
commit
4f1df193a0
|
@ -69,15 +69,19 @@ module.exports = function(s,config,lang,app){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// get latest
|
|
||||||
fetch('https://cdn.shinobi.video/configs/p2pServers.js')
|
fetch('https://cdn.shinobi.video/configs/p2pServers.js')
|
||||||
.then(res => res.text())
|
.then(res => res.text())
|
||||||
.then((text) => {
|
.then((text) => {
|
||||||
try {
|
try {
|
||||||
eval(`config.p2pServerList = ` + text)
|
const parsedData = new Function(`return ${text}`)();
|
||||||
|
config.p2pServerList = parsedData;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
s.debugLog(err)
|
s.debugLog(`Failed to parse server list: ${err.message}`);
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
s.debugLog(`Fetch error: ${error.message}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if(!config.p2pHostSelected)config.p2pHostSelected = config.useBetterP2P ? 'paris-1-v2' : 'paris-1'
|
if(!config.p2pHostSelected)config.p2pHostSelected = config.useBetterP2P ? 'paris-1-v2' : 'paris-1'
|
||||||
|
|
Loading…
Reference in New Issue