mirror of
https://github.com/MailHops/mailhops-plugin.git
synced 2025-05-17 06:40:08 -07:00
Added minimum logging to show api url
Added debug option for this logging in the preferences
This commit is contained in:
parent
7e96333074
commit
2a2c55ddd1
@ -24,12 +24,18 @@ var mailHops =
|
|||||||
resultMeta: null,
|
resultMeta: null,
|
||||||
|
|
||||||
isLoaded: false,
|
isLoaded: false,
|
||||||
options: {'map':'goog','unit':'mi','api_url':'http://api.mailhops.com'},
|
options: {'map':'goog','unit':'mi','api_url':'http://api.mailhops.com','debug':false},
|
||||||
appVersion: 'MailHops Postbox 0.8.2',
|
appVersion: 'MailHops Postbox 0.8.2',
|
||||||
message: {secure:[]},
|
message: {secure:[]},
|
||||||
client_location: null
|
client_location: null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function LOG(msg) {
|
||||||
|
var consoleService = Components.classes["@mozilla.org/consoleservice;1"]
|
||||||
|
.getService(Components.interfaces.nsIConsoleService);
|
||||||
|
consoleService.logStringMessage('MailHops: '+msg);
|
||||||
|
}
|
||||||
|
|
||||||
mailHops.init = function()
|
mailHops.init = function()
|
||||||
{
|
{
|
||||||
//load preferences
|
//load preferences
|
||||||
@ -120,7 +126,8 @@ mailHops.loadPref = function()
|
|||||||
//Hosting
|
//Hosting
|
||||||
mailHops.options.use_private = mailHops.getCharPref('mail.mailHops.use_private','false')=='true'?true:false;
|
mailHops.options.use_private = mailHops.getCharPref('mail.mailHops.use_private','false')=='true'?true:false;
|
||||||
mailHops.options.hosting = mailHops.getCharPref('mail.mailHops.hosting','personal');
|
mailHops.options.hosting = mailHops.getCharPref('mail.mailHops.hosting','personal');
|
||||||
|
mailHops.options.debug = mailHops.getCharPref('mail.mailHops.debug','false')=='true'?true:false;
|
||||||
|
|
||||||
mailHops.options.client_location = mailHops.getCharPref('mail.mailHops.client_location','');
|
mailHops.options.client_location = mailHops.getCharPref('mail.mailHops.client_location','');
|
||||||
|
|
||||||
if(mailHops.options.use_private)
|
if(mailHops.options.use_private)
|
||||||
@ -921,11 +928,16 @@ mailHops.lookupRoute = function(header_route){
|
|||||||
var cached_results=mailHops.getResults();
|
var cached_results=mailHops.getResults();
|
||||||
|
|
||||||
if(cached_results){
|
if(cached_results){
|
||||||
|
if(mailHops.options.debug)
|
||||||
|
LOG('Found Cached Result');
|
||||||
cached_results = JSON.parse(cached_results);
|
cached_results = JSON.parse(cached_results);
|
||||||
mailHops.displayResult(header_route, cached_results.response, cached_results.meta, lookupURL);
|
mailHops.displayResult(header_route, cached_results.response, cached_results.meta, lookupURL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(mailHops.options.debug)
|
||||||
|
LOG(lookupURL);
|
||||||
|
|
||||||
//call mailhops api for lookup
|
//call mailhops api for lookup
|
||||||
var xmlhttp = new XMLHttpRequest();
|
var xmlhttp = new XMLHttpRequest();
|
||||||
|
|
||||||
@ -942,11 +954,15 @@ mailHops.lookupRoute = function(header_route){
|
|||||||
//display the result
|
//display the result
|
||||||
mailHops.displayResult(header_route,data.response,data.meta, lookupURL);
|
mailHops.displayResult(header_route,data.response,data.meta, lookupURL);
|
||||||
} else {
|
} else {
|
||||||
|
if(mailHops.options.debug)
|
||||||
|
LOG(JSON.stringify(data));
|
||||||
//display the error
|
//display the error
|
||||||
mailHops.displayError(data);
|
mailHops.displayError(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (ex){
|
catch (ex){
|
||||||
|
if(mailHops.options.debug)
|
||||||
|
LOG(JSON.stringify(ex));
|
||||||
mailHops.displayError();
|
mailHops.displayError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,6 +102,11 @@ var mailHopPreferences =
|
|||||||
else
|
else
|
||||||
document.getElementById("mailhop.use_private").checked = false;
|
document.getElementById("mailhop.use_private").checked = false;
|
||||||
|
|
||||||
|
if(pref.getCharPref("mail.mailHops.debug",'true')=='true')
|
||||||
|
document.getElementById("mailhop.debug").checked = true;
|
||||||
|
else
|
||||||
|
document.getElementById("mailhop.debug").checked = false;
|
||||||
|
|
||||||
this.api_url.value = pref.getCharPref("mail.mailHops.api_url",'http://api.mailhops.com');
|
this.api_url.value = pref.getCharPref("mail.mailHops.api_url",'http://api.mailhops.com');
|
||||||
|
|
||||||
ResetLocation(document.getElementById("mailhop.refresh_location"));
|
ResetLocation(document.getElementById("mailhop.refresh_location"));
|
||||||
@ -123,6 +128,7 @@ var mailHopPreferences =
|
|||||||
pref.setCharPref("mail.mailHops.show_lists", String(document.getElementById("mailhop.show_lists").checked)) ;
|
pref.setCharPref("mail.mailHops.show_lists", String(document.getElementById("mailhop.show_lists").checked)) ;
|
||||||
pref.setCharPref("mail.mailHops.show_auth", String(document.getElementById("mailhop.show_auth").checked)) ;
|
pref.setCharPref("mail.mailHops.show_auth", String(document.getElementById("mailhop.show_auth").checked)) ;
|
||||||
pref.setCharPref("mail.mailHops.use_private", String(document.getElementById("mailhop.use_private").checked)) ;
|
pref.setCharPref("mail.mailHops.use_private", String(document.getElementById("mailhop.use_private").checked)) ;
|
||||||
|
pref.setCharPref("mail.mailHops.debug", String(document.getElementById("mailhop.debug").checked)) ;
|
||||||
pref.setCharPref("mail.mailHops.hosting", document.getElementById("mailhop.hosting").selectedItem.value) ;
|
pref.setCharPref("mail.mailHops.hosting", document.getElementById("mailhop.hosting").selectedItem.value) ;
|
||||||
pref.setCharPref("mail.mailHops.api_url", String(document.getElementById("mailhop.api_url").value)) ;
|
pref.setCharPref("mail.mailHops.api_url", String(document.getElementById("mailhop.api_url").value)) ;
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,7 @@
|
|||||||
<radio value="business" label="Business (Not-Free)"/>
|
<radio value="business" label="Business (Not-Free)"/>
|
||||||
</radiogroup>
|
</radiogroup>
|
||||||
<checkbox id="mailhop.use_private" label="Yes, I Agree to MailHops terms of use for hosting my own MailHops API." checked="false" oncommand="ChangePrivate(this);"/>
|
<checkbox id="mailhop.use_private" label="Yes, I Agree to MailHops terms of use for hosting my own MailHops API." checked="false" oncommand="ChangePrivate(this);"/>
|
||||||
|
<checkbox id="mailhop.debug" label="Debug" checked="false"/>
|
||||||
<label class="text-link plain" value="MailHops Terms of Use" href="http://www.mailhops.com/terms"/>
|
<label class="text-link plain" value="MailHops Terms of Use" href="http://www.mailhops.com/terms"/>
|
||||||
<textbox id="mailhop.api_url" value="http://api.mailhops.com" disabled="true"/>
|
<textbox id="mailhop.api_url" value="http://api.mailhops.com" disabled="true"/>
|
||||||
<label class="text-link plain act" onclick="TestConnection(this);" value="Test Connection" />
|
<label class="text-link plain act" onclick="TestConnection(this);" value="Test Connection" />
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<em:id>postbox@mailhops.com</em:id>
|
<em:id>postbox@mailhops.com</em:id>
|
||||||
<em:type>2</em:type>
|
<em:type>2</em:type>
|
||||||
<em:name>MailHops</em:name>
|
<em:name>MailHops</em:name>
|
||||||
<em:version>0.8.2</em:version>
|
<em:version>0.8.3</em:version>
|
||||||
<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>
|
<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>
|
||||||
<em:iconURL>chrome://mailhops/content/images/mailhops32.png</em:iconURL>
|
<em:iconURL>chrome://mailhops/content/images/mailhops32.png</em:iconURL>
|
||||||
<em:homepageURL>http://mailhops.com</em:homepageURL>
|
<em:homepageURL>http://mailhops.com</em:homepageURL>
|
||||||
|
BIN
mailhops.xpi
Normal file
BIN
mailhops.xpi
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user