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')
|
||||
.then(res => res.text())
|
||||
.then((text) => {
|
||||
try{
|
||||
eval(`config.p2pServerList = ` + text)
|
||||
}catch(err){
|
||||
s.debugLog(err)
|
||||
try {
|
||||
const parsedData = new Function(`return ${text}`)();
|
||||
config.p2pServerList = parsedData;
|
||||
} catch (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'
|
||||
|
|
Loading…
Reference in New Issue