Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getFileList(dirPath) {
const encodedPath = encodeURIComponent(dirPath);
const files = [];
let count = 0;
request.get(`/files?path=${encodedPath}`, (err, res) => {
if (err) throw err;
files.push(<li>
<a>PiZilla</a>
</li>);
// previous directory
if (path.resolve(dirPath) !== path.resolve(this.props.path))
files.push(<li>
<a data-path="..">
<i></i>..
</a>
</li>);
res.body.forEach(file => {
files.push(<li><div></div></li>);
init() {
var that = this;
request
.get("/api/webgold/get_balance")
.set("X-Requested-With", "XMLHttpRequest")
.withCredentials()
.end((err, data) => {
if (err) {
throw new Error("Can't get balance");
}
console.log(data.body);
that.balance = data.body.balance;
Actions.Balance.trigger(that.balance);
});
request
.get("/add_funds_data")
.set("X-Requested-With", "XMLHttpRequest")
.withCredentials()
.end((err, data) => {
getBadgeDetails: function (badgeId, callback) {
request
.get(this.credlyURL('/badge/' + badgeId))
.withCredentials()
.accept('json')
.end(function (err, res) {
if (err) {
console.log('error', err);
return callback(err, res);
}
callback(false, res.body);
});
},
return (dispatch, getState) => {
request
.get('/api/projects')
.end(function (err, res) {
if (err || !res.ok) {
console.error('get projects error')
} else {
dispatch(setProjects(res.body))
}
})
}
}
async function getVideosWithViewFromBrightCove(_videoIds) {
try {
let videoData = [];
const dividedVideoIds = divideArrayInSubArrays(_videoIds, 5);
for (const videoIds of dividedVideoIds) {
const brightcoveVideosWithViewApiUrl = brightcoveDimensionApiUrl + `?accounts=${BRIGHTCOVE_ACCOUNT_ID}&dimensions=${dimensions}&where=video==${videoIds.join(",")}`;
const retrieveVideos = await superagent.get(brightcoveVideosWithViewApiUrl).set({
[authHeader]: await getAccessTokenAuthHeader()
}).send().then(function (res) {
return res.body.items;
});
videoData = videoData.concat(retrieveVideos);
}
return videoData.reduce((videosMap, video) => {
videosMap[video.video] = video.video_view;
return videosMap;
}, {});
} catch (error) {
console.log('get', error)
}
}
loadSoundcloud () {
request
.get(`http://api.soundcloud.com/resolve?url=${this.props.soundcloud}&format=json&consumer_key=${CONSUMER_KEY}&callback=?`)
.set('Accept', 'application/json')
.end(::this.soundcloudLoaded);
}
function fetch(name, file, options) {
var url = 'https://raw.github.com/' + name + '/master/' + file;
var dst = options.to + '/' + path.basename(file);
log('fetch', file);
request
.get(url)
.end(function(res){
if (res.error) return error(name, res, url);
fs.writeFile(dst, res.text, function(err){
if (err) throw err;
log('write', dst + ' - ' + bytes(res.text.length));
});
});
}
onSelectList(page) {
return firekylin.request(superagent.get('/admin/api/page?page='+page)).then(
data => this.trigger(data, 'getPageList')
);
},
async function compileLibrary(name, arch, url) {
if (fs.existsSync(path.resolve('deps', arch, name))) return;
fs.mkdirSync(path.resolve('deps', arch, name));
const stream = tar.x({
strip: 1,
cwd: path.resolve('deps', arch, name),
});
await get(url);
get(url).pipe(stream);
await new Promise(r => stream.on('finish', r));
let cross = '';
if (arch === 'ia32') {
cross = '--build=x86_64-pc-linux-gnu --host=i686-pc-linux-gnu';
} else if (arch === 'arm') {
cross = '--build=x86_64-pc-linux-gnu --host=arm-linux-gnueabihf';
} else if (arch === 'arm64') {
cross = '--build=x86_64-pc-linux-gnu --host=aarch64-linux-gnu';
}
execSync(`./configure ${cross} --disable-shared --disable-pie --prefix=${path.resolve('deps', arch, 'install')}`, {
stdio: 'inherit',
return new Promise((resolve, reject) => {
http.get(geturl(url))
//传参用query,不然传不过去
.query(params)
.end((error, res) => {
if(error){
reject(error)
} else {
resolve(res)
}
})
})
},