Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getProfile(token) {
// retreive the user profile from Auth0
$.post('https://' + config.auth0Domain + '/tokeninfo', { id_token: token })
.done((profile) => {
this.userLoggedIn(token, profile)
})
}
runMutipleQuery(queries, previous_valueQuery, updateView){
var valueQuery = queries[queries.length-1];
queries.pop();
//Submits a web query for a list of terms, e.g. 'ebola disease'
var session =this.props.session;
session['search_engine']=this.state.search_engine;
session['pagesCap'] = this.state.pages_search_engine;
var concat_valueQuery = (previous_valueQuery!=='')?previous_valueQuery:valueQuery;
if(updateView==1) {
session = this.resetAllFilters(session);
this.props.getQueryPages(concat_valueQuery);
}
updateView=updateView+1;
if(valueQuery!==""){
$.post(
'/queryWeb',
{'terms': valueQuery, 'session': JSON.stringify(session)},
function(data) {
if(queries.length==0) this.props.queryPagesDone();
this.props.updateStatusMessage(false, 'Searching: Web query "' + valueQuery + '" is completed');
if(queries.length>0) this.runMutipleQuery(queries, concat_valueQuery, updateView);
}.bind(this)).fail(function() { console.log("Something is wrong. Try again.");
this.props.updateStatusMessage(false, 'Searching: Web query "' + valueQuery + '" has failed');
if(queries.length>0){
this.runMutipleQuery(queries, previous_valueQuery, updateView);
}
}.bind(this));
this.props.updateStatusMessage(true, 'Searching: Web query "' + valueQuery + '"');
}
else{
if(queries.length>0) this.runMutipleQuery(queries, previous_valueQuery, updateView);
sendQuickReplyForUser(senderID: string, text: string, payload: string): void {
const url = this._baseURL + '/localChat/quickReply';
$.post(url, {senderID: senderID, text: text, payload: payload})
.fail((res: Object) => {
console.log(res);
});
}
getAnnotatedTerms(){
$.post(
'/getAnnotatedTerms',
{'session': JSON.stringify(this.props.session)},
function(terms) {
var selected_aterms = [];
if(this.props.session['selected_aterms'] !== undefined && this.props.session['selected_aterms'] !== ""){
selected_aterms = this.props.session['selected_aterms'].split(",");
}
this.setState({currentATerms: terms, session:this.props.session, checked:selected_aterms});
}.bind(this)
);
}
async auth() {
const key = openpgp.key.readArmored(this.user.publicKey).keys[0];
const res = await $.get(`${this.options.api}/token/${this.user.username}`);
const signature = await this.createSignature(res);
log('signature is', {signature});
const data = {
signature,
fingerprint : key.primaryKey.fingerprint,
username : this.user.username,
};
return $.post(`${this.options.api}/auth`, data);
}
create: function (alias, target) {
if (ajax) {
ajax.abort();
}
ajax = jQuery.post(AppConstants.ALIAS_API_ENDPOINT, {alias: alias, target: target}).done(function (data) {
AddAliasModalServerActions.receivedAliasCreationResult(data);
}).fail(function (error) {
AddAliasModalServerActions.failedToCreateAlias(error.responseJSON);
});
}
};
$(document).ready(() => {
const dateSlider = document.getElementById('date-slider')
$.post('/analytics', data => {
if (data.length == 0) {
window.alert('No data!')
}
/**
* Initialize the c3 charts on the page with the analytics data.
*/
const trafficChart = c3.generate({
bindto: '#traffic',
axis: {
x: { padding: 0, type: 'timeseries' },
y: { label: 'Requests', min: 0, padding: 0 }
},
data: {
x: 'date',
columns: getTrafficData(data)
},
resynchronize() {
this.getCachedEl('.js-resync').addClass('processing');
this.getCachedEl('.js-resyncComplete').addClass('hide');
this.resync = $.post(app.getServerUrl('wallet/resyncblockchain'))
.always(() => {
this.getCachedEl('.js-resync').removeClass('processing');
})
.fail((xhr) => {
if (xhr.statusText === 'abort') return;
const failReason = xhr.responseJSON && xhr.responseJSON.reason || '';
openSimpleMessage(
app.polyglot.t('settings.advancedTab.server.resyncError'),
failReason);
})
.done(() => {
this.getCachedEl('.js-resyncComplete').removeClass('hide');
});
}
private onUpdateVideoButtonClick(video: IVideoEntry, group: string): void {
let found = _.find(this.state.searchResults, { ytid: video.ytid });
if (found !== undefined) {
found.isArchived = true;
found.title = video.title;
$.post({
url: "/api/videos/update",
data: {
title: video.title,
ytid: video.ytid,
group: group !== undefined ? group : "misc"
}
});
}
}
private onDeleteVideoButtonClick(video: IVideoEntry): void {