mirror of
https://github.com/MailHops/mailhops-plugin.git
synced 2025-05-21 00:20:21 -07:00
Removed client logic to fix distance message traveled display
This commit is contained in:
parent
a317fc87a8
commit
4a4079eca8
@ -8,7 +8,7 @@ var mailHops =
|
||||
{
|
||||
msgURI: null
|
||||
, isLoaded: false
|
||||
, options: {'version':'MailHops Plugin 1.0.3','lan':'en','unit':'mi','api_url':'http://api.mailhops.com','debug':false}
|
||||
, options: {'version':'MailHops Plugin 1.0.4','lan':'en','unit':'mi','api_url':'http://api.mailhops.com','debug':false}
|
||||
, message: { secure:[] }
|
||||
, client_location: null
|
||||
};
|
||||
@ -26,7 +26,7 @@ mailHops.init = function() {
|
||||
|
||||
//load preferences
|
||||
mailHops.loadPref();
|
||||
|
||||
|
||||
document.getElementById("mailhopsDataPanePrefsLink").addEventListener("click", function () {
|
||||
window.openDialog("chrome://mailhops/content/preferences.xul","","chrome, dialog, modal, centerscreen").focus();
|
||||
});
|
||||
@ -36,7 +36,7 @@ mailHops.init = function() {
|
||||
});
|
||||
|
||||
mailHops.isLoaded = true;
|
||||
|
||||
|
||||
};
|
||||
|
||||
mailHops.loadPref = function()
|
||||
@ -69,7 +69,7 @@ mailHops.loadPref = function()
|
||||
mailHops.options.api_url = mailHops.getCharPref('mail.mailHops.api_url','http://api.mailhops.com');
|
||||
|
||||
mailHops.options.map_provider = mailHops.getCharPref('mail.mailHops.map_provider','OpenStreetMap.Mapnik');
|
||||
|
||||
|
||||
if(mailHops.options.client_location == ''){
|
||||
mailHops.setClientLocation(function(response){
|
||||
mailHops.options.client_location=response;
|
||||
@ -142,12 +142,12 @@ mailHops.getRoute = function(){
|
||||
//IP regex
|
||||
var regexIp=/(1\d{0,2}|2(?:[0-4]\d{0,1}|[6789]|5[0-5]?)?|[3-9]\d?|0)\.(1\d{0,2}|2(?:[0-4]\d{0,1}|[6789]|5[0-5]?)?|[3-9]\d?|0)\.(1\d{0,2}|2(?:[0-4]\d{0,1}|[6789]|5[0-5]?)?|[3-9]\d?|0)\.(1\d{0,2}|2(?:[0-4]\d{0,1}|[6789]|5[0-5]?)?|[3-9]\d?|0)(\/(?:[012]\d?|3[012]?|[456789])){0,1}$/;
|
||||
var regexAllIp = /(1\d{0,2}|2(?:[0-4]\d{0,1}|[6789]|5[0-5]?)?|[3-9]\d?|0)\.(1\d{0,2}|2(?:[0-4]\d{0,1}|[6789]|5[0-5]?)?|[3-9]\d?|0)\.(1\d{0,2}|2(?:[0-4]\d{0,1}|[6789]|5[0-5]?)?|[3-9]\d?|0)\.(1\d{0,2}|2(?:[0-4]\d{0,1}|[6789]|5[0-5]?)?|[3-9]\d?|0)(\/(?:[012]\d?|3[012]?|[456789])){0,1}/g;
|
||||
|
||||
|
||||
// TODO test IPV6 regex for Received headers, currently only used for X-Originating-IP
|
||||
// IPv6 addresses including compressed and IPv4-embedded variants (RFC 2373)
|
||||
// http://regexlib.com/REDetails.aspx?regexp_id=2919
|
||||
var regexIPV6 = /(::|(([a-fA-F0-9]{1,4}):){7}(([a-fA-F0-9]{1,4}))|(:(:([a-fA-F0-9]{1,4})){1,6})|((([a-fA-F0-9]{1,4}):){1,6}:)|((([a-fA-F0-9]{1,4}):)(:([a-fA-F0-9]{1,4})){1,6})|((([a-fA-F0-9]{1,4}):){2}(:([a-fA-F0-9]{1,4})){1,5})|((([a-fA-F0-9]{1,4}):){3}(:([a-fA-F0-9]{1,4})){1,4})|((([a-fA-F0-9]{1,4}):){4}(:([a-fA-F0-9]{1,4})){1,3})|((([a-fA-F0-9]{1,4}):){5}(:([a-fA-F0-9]{1,4})){1,2}))/;
|
||||
|
||||
|
||||
var headReceived = mailHops.headers.extractHeader ( "Received" , true ) ;
|
||||
var headXOrigIP = mailHops.headers.extractHeader ( "X-Originating-IP" , false ) ;
|
||||
//auth box
|
||||
@ -191,7 +191,7 @@ mailHops.getRoute = function(){
|
||||
all_ips.unshift( received_ips[r] );
|
||||
//don't want duplicate IPs from the same Received header
|
||||
if(r < received_ips.length && received_ips[r] == received_ips[r+1])
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -232,14 +232,14 @@ mailHops.testIP = function(ip,header){
|
||||
|
||||
if(firstchar.match(/\.|\d|\-/)
|
||||
|| lastchar.match(/\.|\d|\-/)
|
||||
|| ( firstchar == '?' && lastchar == '?' )
|
||||
|| ( firstchar == '?' && lastchar == '?' )
|
||||
|| lastchar == ';'){
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
else if(header.indexOf('['+ip+']') !== -1 || header.indexOf('('+ip+')') !== -1){
|
||||
retval = true;
|
||||
retval = true;
|
||||
}
|
||||
|
||||
|
||||
//check if this IP was part of a secure transmission
|
||||
if(retval){
|
||||
if(header.indexOf('using SSL') != -1){
|
||||
@ -363,9 +363,6 @@ mailHops.lookupRoute = function(header_route){
|
||||
if(mailHops.options.fkey != '')
|
||||
lookupURL += '&fkey='+mailHops.options.fkey;
|
||||
|
||||
if(mailHops.options.client_location != '')
|
||||
lookupURL+='&c=0';
|
||||
|
||||
mailHops.LOG(lookupURL);
|
||||
|
||||
//check for cache
|
||||
|
@ -1,5 +1,5 @@
|
||||
var mailHopsDisplay =
|
||||
{
|
||||
{
|
||||
resultTextDataPane: null,
|
||||
resultTextDataPane2: null,
|
||||
resultTextDataPane3: null,
|
||||
@ -19,7 +19,7 @@ var mailHopsDisplay =
|
||||
options: null,
|
||||
|
||||
init: function(options){
|
||||
|
||||
|
||||
this.options = options;
|
||||
|
||||
this.resultContainerDataPane = document.getElementById ( "mailhopsDataPane");
|
||||
@ -48,7 +48,7 @@ var mailHopsDisplay =
|
||||
document.getElementById('dataPaneMailHopsMetaContainer').style.display='';
|
||||
else
|
||||
document.getElementById('dataPaneMailHopsMetaContainer').style.display='none';
|
||||
|
||||
|
||||
//event listner for route click to launch map
|
||||
this.resultMapLink.addEventListener("click", function () {
|
||||
if(this.hasAttribute("data-route"))
|
||||
@ -246,11 +246,11 @@ var mailHopsDisplay =
|
||||
if(no_ips){
|
||||
this.resultTextDataPane.style.backgroundImage = 'url(chrome://mailhops/content/images/help.png)';
|
||||
this.resultTextDataPane.value = ' No IPs';
|
||||
this.resultTextDataPane.setAttribute('tooltiptext','There were no received headers found');
|
||||
this.resultTextDataPane.setAttribute('tooltiptext','There were no received headers found');
|
||||
} else {
|
||||
this.resultTextDataPane.style.backgroundImage = 'url(chrome://mailhops/content/images/loader.gif)';
|
||||
this.resultTextDataPane.value = ' Looking Up Route';
|
||||
this.resultTextDataPane.setAttribute('tooltiptext','Looking Up Route');
|
||||
this.resultTextDataPane.setAttribute('tooltiptext','Looking Up Route');
|
||||
}
|
||||
|
||||
this.resultTextDataPane2.value = '';
|
||||
@ -258,7 +258,7 @@ var mailHopsDisplay =
|
||||
this.resultTextDataPane2.setAttribute('tooltiptext','');
|
||||
|
||||
this.resultTextDataPane3.style.display = 'none';
|
||||
this.resultTextDataPane3.value = '';
|
||||
this.resultTextDataPane3.value = '';
|
||||
|
||||
//remove child details
|
||||
while(this.resultDetails.firstChild) {
|
||||
@ -267,7 +267,7 @@ var mailHopsDisplay =
|
||||
},
|
||||
|
||||
route: function(header_route, message, response, meta, lookup_url){
|
||||
|
||||
|
||||
var displayText=''
|
||||
, distanceText=''
|
||||
, image='chrome://mailhops/content/images/local.png'
|
||||
@ -296,13 +296,14 @@ var mailHopsDisplay =
|
||||
mlabel.setAttribute('href',lookup_url);
|
||||
this.resultMeta.appendChild(mlabel);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(response && response.route && response.route.length > 0){
|
||||
|
||||
if(this.options.client_location){
|
||||
var client_location = JSON.parse(this.options.client_location);
|
||||
response.route.push(client_location.route[0]);
|
||||
if(response.route[response.route.length-1].ip != client_location.route[0].ip)
|
||||
response.route.push(client_location.route[0]);
|
||||
}
|
||||
|
||||
for(var i=0; i<response.route.length;i++){
|
||||
@ -396,7 +397,7 @@ var mailHopsDisplay =
|
||||
// var ipv6 = document.createElement('label');
|
||||
// ipv6.setAttribute('class','dataPaneAddressitem mailhopsipv6');
|
||||
// ipv6.setAttribute('value','IPV6');
|
||||
// this.resultDetails.appendChild(ipv6);
|
||||
// this.resultDetails.appendChild(ipv6);
|
||||
// }
|
||||
|
||||
if(response.route[i].w3w){
|
||||
@ -412,7 +413,7 @@ var mailHopsDisplay =
|
||||
if(image.indexOf('local')!=-1) {
|
||||
displayText = ' Local message.';
|
||||
} else {
|
||||
|
||||
|
||||
if(!!first){
|
||||
if(!!first.city && !!first.state)
|
||||
displayText = first.city+', '+first.state;
|
||||
@ -471,4 +472,4 @@ var mailHopsDisplay =
|
||||
}
|
||||
|
||||
} //end route
|
||||
};
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
var mailHopsDisplay =
|
||||
{
|
||||
{
|
||||
resultBox: null,
|
||||
resultText: null,
|
||||
resultDetails: null,
|
||||
@ -13,7 +13,7 @@ var mailHopsDisplay =
|
||||
options: null,
|
||||
|
||||
init: function(options){
|
||||
|
||||
|
||||
this.options = options;
|
||||
|
||||
this.container = document.getElementById ( "mailhopsBox" ) ;
|
||||
@ -156,7 +156,7 @@ var mailHopsDisplay =
|
||||
|
||||
this.mailhopsDataPaneDNSBL.style.display = 'none';
|
||||
this.mailhopsResultWeather.style.display = 'none';
|
||||
|
||||
|
||||
if(no_ips){
|
||||
this.resultText.style.backgroundImage='url(chrome://mailhops/content/images/loader.gif)';
|
||||
this.resultText.setAttribute('value',' Looking Up Route');
|
||||
@ -164,7 +164,7 @@ var mailHopsDisplay =
|
||||
} else {
|
||||
this.resultText.style.backgroundImage = 'url(chrome://mailhops/content/images/loader.gif)';
|
||||
this.resultText.value = ' Looking Up Route';
|
||||
this.resultText.setAttribute('tooltiptext','Looking Up Route');
|
||||
this.resultText.setAttribute('tooltiptext','Looking Up Route');
|
||||
}
|
||||
},
|
||||
|
||||
@ -185,7 +185,8 @@ var mailHopsDisplay =
|
||||
|
||||
if(this.options.client_location){
|
||||
var client_location = JSON.parse(this.options.client_location);
|
||||
response.route.push(client_location.route[0]);
|
||||
if(response.route[response.route.length-1].ip != client_location.route[0].ip)
|
||||
response.route.push(client_location.route[0]);
|
||||
}
|
||||
for(var i=0; i<response.route.length;i++){
|
||||
//get the first hop location
|
||||
@ -273,7 +274,7 @@ var mailHopsDisplay =
|
||||
if(image.indexOf('local')!=-1) {
|
||||
displayText = ' Local message.';
|
||||
} else {
|
||||
|
||||
|
||||
if(!!first){
|
||||
if(!!first.city && !!first.state)
|
||||
displayText = first.city+', '+first.state;
|
||||
@ -300,4 +301,4 @@ var mailHopsDisplay =
|
||||
this.resultText.setAttribute('value', displayText+' '+distanceText);
|
||||
this.resultText.style.backgroundImage = 'url('+image+')';
|
||||
}//end route
|
||||
};
|
||||
};
|
||||
|
30
install.rdf
30
install.rdf
@ -5,7 +5,7 @@
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:type>2</em:type>
|
||||
<em:id>thunderbird@mailhops.com</em:id>
|
||||
<em:version>1.0.3</em:version>
|
||||
<em:version>1.0.4</em:version>
|
||||
|
||||
<em:name>MailHops</em:name>
|
||||
<em:description>MailHops maps the route an email traveled to get to you. Using GeoIP it also displays distance traveled along with the location (city, state and country) of the sender.</em:description>
|
||||
@ -16,16 +16,16 @@
|
||||
<!-- <em:updateURL>https://dl.dropbox.com/u/1533417/mailhops_update.rdf</em:updateURL> -->
|
||||
|
||||
<!-- Postbox -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>postbox@postbox-inc.com</em:id>
|
||||
<em:minVersion>2.0</em:minVersion>
|
||||
<em:maxVersion>4.*</em:maxVersion>
|
||||
</Description>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- Thunderbird -->
|
||||
<em:targetApplication>
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
|
||||
<em:minVersion>3.0.*</em:minVersion>
|
||||
@ -39,7 +39,7 @@
|
||||
<em:name>MailHops</em:name>
|
||||
<em:description>MailHops Karten die Route eine E-Mail gereist, um bei Ihnen melden. Verwendung GeoIP es zeigt auch zurückgelegte Strecke zusammen mit dem Standort ( Ort, Bundesland und Land) des Absenders.</em:description>
|
||||
</Description>
|
||||
</em:localized>
|
||||
</em:localized>
|
||||
|
||||
<em:localized>
|
||||
<Description>
|
||||
@ -47,7 +47,7 @@
|
||||
<em:name>MailHops</em:name>
|
||||
<em:description>MailHops maps the route an email traveled to get to you. Using GeoIP it also displays distance traveled along with the location (city, state and country) of the sender.</em:description>
|
||||
</Description>
|
||||
</em:localized>
|
||||
</em:localized>
|
||||
|
||||
<em:localized>
|
||||
<Description>
|
||||
@ -55,7 +55,7 @@
|
||||
<em:name>MailHops</em:name>
|
||||
<em:description>Mapas MailHops la ruta un correo electrónico viajó a llegar a usted. Usando GeoIP también muestra la distancia recorrida junto con la ubicación ( ciudad, estado y país) del remitente.</em:description>
|
||||
</Description>
|
||||
</em:localized>
|
||||
</em:localized>
|
||||
|
||||
<em:localized>
|
||||
<Description>
|
||||
@ -63,7 +63,7 @@
|
||||
<em:name>MailHops</em:name>
|
||||
<em:description>MailHops mappe la route un email parcouru pour arriver à vous . Utilisation GeoIP il affiche aussi la distance parcourue avec le lieu (ville , état et pays ) de l'expéditeur.</em:description>
|
||||
</Description>
|
||||
</em:localized>
|
||||
</em:localized>
|
||||
|
||||
<em:localized>
|
||||
<Description>
|
||||
@ -71,7 +71,7 @@
|
||||
<em:name>MailHops</em:name>
|
||||
<em:description>MailHops電子メールがあなたに取得するために旅したルートをマップします。のGeoIPを使用しても距離が送信者の場所(都市、州や国)と一緒に旅に表示されます。</em:description>
|
||||
</Description>
|
||||
</em:localized>
|
||||
</em:localized>
|
||||
|
||||
<em:localized>
|
||||
<Description>
|
||||
@ -79,7 +79,7 @@
|
||||
<em:name>MailHops</em:name>
|
||||
<em:description>MailHops mapeia a rota um e-mail viajou para chegar até você . Usando GeoIP ele também exibe a distância percorrida , juntamente com a localização (cidade , estado e país ) do remetente.</em:description>
|
||||
</Description>
|
||||
</em:localized>
|
||||
</em:localized>
|
||||
|
||||
<em:localized>
|
||||
<Description>
|
||||
@ -87,7 +87,7 @@
|
||||
<em:name>MailHops</em:name>
|
||||
<em:description>MailHops отображает маршрутэлектронной почты , пройденное , чтобы добраться до вас. Использование GeoIP также отображает расстояние вместе с места (город, штат и страна ) отправителя.</em:description>
|
||||
</Description>
|
||||
</em:localized>
|
||||
</em:localized>
|
||||
|
||||
<em:localized>
|
||||
<Description>
|
||||
@ -95,8 +95,8 @@
|
||||
<em:name>MailHops</em:name>
|
||||
<em:description>MailHops映射電子郵件前往得到你的路線。使用GeoIP的它也顯示行駛距離隨著發送者的位置(城市,州和國家)</em:description>
|
||||
</Description>
|
||||
</em:localized>
|
||||
|
||||
</em:localized>
|
||||
|
||||
</Description>
|
||||
|
||||
|
||||
</RDF>
|
||||
|
Loading…
x
Reference in New Issue
Block a user