From ab1e45114c7643f7e487e98c19b1f604fb471b87 Mon Sep 17 00:00:00 2001 From: Thomas Lynch Date: Fri, 15 Jan 2021 13:18:48 +0000 Subject: [PATCH] consider LOKI x-country-code also anonymizer (still pending code changes to refactor locals.tor into locals.anonymizer) --- helpers/countries.js | 5 +++-- helpers/geoip.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/helpers/countries.js b/helpers/countries.js index f1398082..2a1a7469 100644 --- a/helpers/countries.js +++ b/helpers/countries.js @@ -2,7 +2,7 @@ const countries = require('i18n-iso-countries') , countryNamesMap = countries.getNames('en') - , countryCodes = ['EU', 'XX', 'T1', 'TOR'] + , countryCodes = ['EU', 'XX', 'T1', 'TOR', 'LOKI'] .concat(Object.keys(countryNamesMap)); //this dumb library conveniently includes 2 names for some countries... @@ -13,7 +13,8 @@ Object.entries(countryNamesMap) countryNamesMap['EU'] = 'Europe'; countryNamesMap['XX'] = 'Unknown'; countryNamesMap['T1'] = 'Tor Exit Node'; -countryNamesMap['TOR'] = 'Tor Onion'; +countryNamesMap['TOR'] = 'Tor Hidden Service'; +countryNamesMap['LOKI'] = 'Lokinet SNApp'; module.exports = { countryNamesMap, diff --git a/helpers/geoip.js b/helpers/geoip.js index bbe4d454..04c37057 100644 --- a/helpers/geoip.js +++ b/helpers/geoip.js @@ -5,7 +5,7 @@ const { countryNamesMap } = require(__dirname+'/countries.js') module.exports = (req, res, next) => { const code = req.headers[countryCodeHeader] || 'XX'; - res.locals.tor = code === 'TOR'; + res.locals.tor = code === 'TOR' || code === 'LOKI'; res.locals.country = { code, name: countryNamesMap[code],