Replaced geoip-ultralight with geoip-country
This commit is contained in:
parent
24fc0a8b30
commit
02b74b9a52
4 changed files with 17 additions and 11 deletions
|
@ -195,13 +195,14 @@ canvasBackgroundStyle = "bluish"
|
|||
canvasLabelsColor = "#4b5666"
|
||||
|
||||
[views.template]
|
||||
|
||||
showeditor = false
|
||||
showeditor=false
|
||||
|
||||
[views.lists]
|
||||
statuscolored=false
|
||||
|
||||
statuscolored = false
|
||||
|
||||
[geoip]
|
||||
# Alternative directory containing the files geoip-country.dat and geoip-country6.dat
|
||||
datadirectory=false
|
||||
|
||||
[reports]
|
||||
# The whole reporting functionality can be disabled below if the they are not needed and the DB cannot be
|
||||
|
|
|
@ -5,7 +5,7 @@ let shortid = require('shortid');
|
|||
let util = require('util');
|
||||
let _ = require('../translate')._;
|
||||
|
||||
let geoip = require('geoip-ultralight');
|
||||
let geoip = require('geoip-country');
|
||||
let campaigns = require('./campaigns');
|
||||
let subscriptions = require('./subscriptions');
|
||||
let lists = require('./lists');
|
||||
|
@ -57,7 +57,8 @@ module.exports.countClick = (remoteIp, useragent, campaignCid, listCid, subscrip
|
|||
return callback(err);
|
||||
}
|
||||
|
||||
let country = geoip.lookupCountry(remoteIp) || null;
|
||||
let geodata = geoip.lookup(remoteIp);
|
||||
let country = geodata && geodata.country || null;
|
||||
let device = ua_parser(useragent, { unknownUserAgentDeviceType: 'desktop', emptyUserAgentDeviceType: 'desktop' });
|
||||
let query = 'INSERT INTO `campaign_tracker__' + data.campaign.id + '` (`list`, `subscriber`, `link`, `ip`, `device_type`, `country`) VALUES (?,?,?,?,?,?) ON DUPLICATE KEY UPDATE `count`=`count`+1';
|
||||
connection.query(query, [data.list.id, data.subscription.id, linkId, remoteIp, device.type, country], (err, result) => {
|
||||
|
@ -173,7 +174,8 @@ module.exports.countOpen = (remoteIp, useragent, campaignCid, listCid, subscript
|
|||
return callback(err);
|
||||
}
|
||||
|
||||
let country = geoip.lookupCountry(remoteIp) || null;
|
||||
let geodata = geoip.lookup(remoteIp);
|
||||
let country = geodata && geodata.country || null;
|
||||
let device = ua_parser(useragent, { unknownUserAgentDeviceType: 'desktop', emptyUserAgentDeviceType: 'desktop' });
|
||||
let query = 'INSERT INTO `campaign_tracker__' + data.campaign.id + '` (`list`, `subscriber`, `link`, `ip`, `device_type`, `country`) VALUES (?,?,?,?,?,?) ON DUPLICATE KEY UPDATE `count`=`count`+1';
|
||||
connection.query(query, [data.list.id, data.subscription.id, -1, remoteIp, device.type, country], (err, result) => {
|
||||
|
@ -272,7 +274,7 @@ module.exports.updateLinks = (campaign, list, subscription, serviceUrl, message,
|
|||
// tracking is disabled, do not modify the message
|
||||
return setImmediate(() => callback(null, message));
|
||||
}
|
||||
|
||||
|
||||
// insert tracking image
|
||||
if (!campaign.openTrackingDisabled) {
|
||||
let inserted = false;
|
||||
|
@ -289,7 +291,7 @@ module.exports.updateLinks = (campaign, list, subscription, serviceUrl, message,
|
|||
return callback(null, message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!campaign.clickTrackingDisabled) {
|
||||
let re = /(<a[^>]* href\s*=[\s"']*)(http[^"'>\s]+)/gi;
|
||||
let urls = new Set();
|
||||
|
|
|
@ -17,6 +17,8 @@ let htmlToText = require('html-to-text');
|
|||
|
||||
let blockedUsers = ['abuse', 'admin', 'billing', 'compliance', 'devnull', 'dns', 'ftp', 'hostmaster', 'inoc', 'ispfeedback', 'ispsupport', 'listrequest', 'list', 'maildaemon', 'noc', 'noreply', 'noreply', 'null', 'phish', 'phishing', 'postmaster', 'privacy', 'registrar', 'root', 'security', 'spam', 'support', 'sysadmin', 'tech', 'undisclosedrecipients', 'unsubscribe', 'usenet', 'uucp', 'webmaster', 'www'];
|
||||
|
||||
global.geodatadir = config.geoip.datadirectory || undefined;
|
||||
|
||||
module.exports = {
|
||||
toDbKey,
|
||||
fromDbKey,
|
||||
|
|
|
@ -16,7 +16,7 @@ let _ = require('../lib/translate')._;
|
|||
let util = require('util');
|
||||
let cors = require('cors');
|
||||
let cache = require('memory-cache');
|
||||
let geoip = require('geoip-ultralight');
|
||||
let geoip = require('geoip-country');
|
||||
let confirmations = require('../lib/models/confirmations');
|
||||
let mailHelpers = require('../lib/subscription-mail-helpers');
|
||||
|
||||
|
@ -74,7 +74,8 @@ function checkAndExecuteConfirmation(req, action, errorMsg, next, exec) {
|
|||
router.get('/confirm/subscribe/:cid', (req, res, next) => {
|
||||
checkAndExecuteConfirmation(req, 'subscribe', 'Request invalid or already completed. If your subscription request is still pending, please subscribe again.', next, (confirmation, list) => {
|
||||
const data = confirmation.data;
|
||||
let optInCountry = geoip.lookupCountry(confirmation.ip) || null;
|
||||
let geodata = geoip.lookup(confirmation.ip);
|
||||
let optInCountry = geodata && geodata.country || null;
|
||||
|
||||
const meta = {
|
||||
cid: req.params.cid,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue