Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function shouldBuy(product_id) {
if (settings.get(product_id +'_buy_on_trend_long_up') && settings.get(product_id +'_buy_on_trend_short_up')) {
// Buy only on trend up, BOTH
return (varIsTrendingUp['long'][product_id] && varIsTrendingUp['short'][product_id]) ? true : false
} else if (settings.get(product_id +'_buy_on_trend_long_up')) {
// Buy only on trend up, LONG
return (varIsTrendingUp['long'][product_id]) ? true : false
} else if (settings.get(product_id +'_buy_on_trend_short_up')) {
// Buy only on trend up, SHORT
return (varIsTrendingUp['short'][product_id]) ? true : false
} else {
// Always buy
return true
}
}
getDatabaseDir() {
var databaseDir = this.userDataDir;
if (settings.has('custom_database_dir') &&
settings.get('custom_database_dir') != null) {
databaseDir = settings.get('custom_database_dir');
console.log('Using custom database dir ' + databaseDir + ' for database access!');
} else {
console.log('Using default database dir ' + databaseDir + ' for database access!');
}
return databaseDir;
}
constructor(props: any) {
super(props);
this.state = {
access_token: settings.get('spotify.access_token'),
refresh_token: settings.get('spotify.refresh_token'),
window_side: SIDE.LEFT,
auth: false,
}
}
function hasSubscription() {
all_comic_data = settings.get('comic');
if (all_comic_data == undefined) return false;
for (let host in all_comic_data) {
for (let comic in all_comic_data[host]) {
if (all_comic_data[host][comic].subscribed) {
return true;
}
}
}
return false;
}
function getOpt( key ) {
let value = settings.get(key);
if( typeof value === 'undefined' ) return defaultOpts[ key ];
return value;
}
function subscribe(host, titlekey, title, link, thumbnail_uri) {
let keyPath = "comic." + host + "." + titlekey;
let comic_data = settings.get(keyPath);
if (comic_data) {
comic_data.subscribed = !comic_data.subscribed;
settings.set(keyPath, comic_data);
} else {
comic_data = register(host, titlekey, title, link, thumbnail_uri, true)
}
if (comic_data.subscribed) {
checkUpdateSingle(host, titlekey);
}
updateSubscribeUIStatus();
}
function unsubscribe(host, titlekey) {
let key_path = "comic." + host + "." + titlekey;
let comicData = settings.get(key_path);
if (comicData) {
comicData.subscribed = false;
settings.set(key_path, comicData);
updateSubscribeUIStatus();
}
}
notify(trackName, singers, albumName, albumLogo) {
const showNotification = settings.get('showNotification', 'check');
if ('check' === showNotification) {
const title = `${Locale.NOTIFICATION_TRACK}: ${trackName}`;
const body = `${Locale.NOTIFICATION_ARTIST}: ${singers}
${Locale.NOTIFICATION_ALBUM}: ${albumName}`;
this.notificationController.notify(albumLogo, title, body);
}
}