client.js
// searchOnAllCells get the list of the ips and call searchVideoByTitle for each of them, returning, as a promise, the response of that query
searchOnAllCells get the list of the ips and call searchVideoByTitle for each of them, returning, as a promise, the response of that query
searchOnAllCells get the list of the ips and call searchVideoByTitle for each of them returning as a promise the response of that query
async function searchOnAllCells({title, videoId, description, isPublic, searchOnlyId}={}) {
    var promises = []
    for (const [cellName, ipscell] of Object.entries(ips)) {
        for (let i = 0; i < ipscell.length - 1; ++i) {
            let ip = "https://" + ipscell[i] + "/"
            promises.push(
                new Promise((resolve) => {
                    searchVideoByTitle({
                        title, 
                        videoId, 
                        description, 
                        ip, 
                        cellName, 
                        isPublic, 
                        startRequest: performance.now(), 
                        searchOnlyId
                    })
                        .then((data) => {
                            data = {
                                success: data[0],
                                time: data[1],
                                title,
                                description,
                                videoId,
                                ip,
                                cellName,
                                isPublic,
                            }
                            resolve(data)
                        })
                        .catch((err) => {
                            console.log(err)
                        })
                })
            )
        }
    }
    return Promise.all(promises)
}
async function searchOnAllCells ( { title , videoId , description , isPublic , searchOnlyId } = { } ) { var promises = [ ] for ( const [ cellName , ipscell ] of Object . entries ( ips ) ) { for ( let i = 0 ; i < ipscell . length - 1 ; ++ i ) { let ip = "https://" + ipscell [ i ] + "/" promises . push ( new Promise ( ( resolve ) => { searchVideoByTitle ( { title , videoId , description , ip , cellName , isPublic , startRequest : performance . now ( ) , searchOnlyId } ) . then ( ( data ) => { data = { success : data [ 0 ] , time : data [ 1 ] , title , description , videoId , ip , cellName , isPublic , } resolve ( data ) } ) . catch ( ( err ) => { console . log ( err ) } ) } ) ) } } return Promise . all ( promises ) }
searchOnAllCells get the list of the ips and call searchVideoByTitle for each of them, returning, as a promise, the response of that query
searchOnAllCells get the list of the ips and call searchVideoByTitle for each of them returning as a promise the response of that query