Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
loginWithVerifier: function(xthrift, xconfig, callback) {
let reqx = new TTypes.LoginRequest();
console.info(config.Headers);
unirest.get('https://' + config.LINE_DOMAIN + config.LINE_CERTIFICATE_URL).headers(config.headers).timeout(120000)
.end((res) => {
reqx.type = 1;
reqx.verifier = res.body.result.verifier;
xthrift.loginZ(reqx, (err, success) => {
callback(success);
})
})
},
var getConsumers = function (prevConsumers,url) {
unirest.get(url)
.end(function(response) {
if (response.error) return cb(response);
var kongConsumers = prevConsumers.concat(response.body.data);
if (response.body.next) {
getConsumers(kongConsumers,response.body.next);
}
else {
handleConsumers(kongConsumers);
}
});
};
getConsumers([],sails.config.kong_admin_url + '/consumers');
retrieveEnabled : function(req,res) {
unirest.get(sails.config.kong_admin_url + '/plugins/enabled/')
.end(function(response){
if(response.error) return res.kongError(response)
return res.json(response.body)
})
},
promises.push(function(cb) {
unirest.get(sails.config.kong_admin_url + '/consumers/' + consumer_id + "/" + credential)
.end(function(response){
if(response.error) return cb({
status : response.error.status,
message : response.body.message
})
return cb(null,{
name : credential,
data : response.body.data,
total : response.body.total
})
})
})
})
retrieveCredentials : function(req,res) {
unirest.get(sails.config.kong_admin_url + '/consumers/' + req.params.id + "/" + req.params.credential)
.end(function(response){
if(response.error) return res.kongError(response)
return res.json(response.body)
})
},
status : function(req,res) {
unirest.get(( req.query.kong_admin_url || sails.config.kong_admin_url ) + "/status")
.end(function(response){
if(response.error) return res.negotiate(response.error)
return res.json(response.body)
})
},
const getTVDBID = async (name) => {
try {
const response = await get(urljoin(host, '/api/v1/Search/tv/', name)).headers({
accept: 'application/json',
ApiKey: apiKey
})
return response.body
} catch (e) {
const text = 'Failed to connect to Ombi'
Log.error('Ombi Movies', text, e)
await errorMessage(msg, text)
}
}
const getTMDbID = async (name) => {
try {
const response = await get(urljoin(host, '/api/v1/Search/movie/', name)).headers({
accept: 'application/json',
ApiKey: apiKey,
'User-Agent': `Mellow/${process.env.npm_package_version}`
})
return response.body
} catch (e) {
const text = 'Failed to connect to Ombi'
Log.error('Ombi Movies', text, e)
await errorMessage(msg, text)
}
}
const setPower = async (onoff) => {
const state = onoff === 'on' ? 'PO' : 'PF'
await get(urljoin(host, `/EventHandler.asp?WebToHostItem=${state}`)).headers({
accept: 'application/json'
})
if (api) return `AVR turned [ ${capitalize(onoff)} ]`
return standardMessage(msg, `:radio: AVR turned [ ${capitalize(onoff)} ]`)
}
retrieve: function (req, res) {
unirest.get(Utils.withoutTrailingSlash(req.connection.kong_admin_url) + req.url.replace('/kong', ''))
.headers(KongService.headers(req, true))
.end(function (response) {
if (response.error) return res.kongError(response);
return res.json(response.body);
});
},