Skip to content

Commit

Permalink
version 1.4
Browse files Browse the repository at this point in the history
* right click on add-on-bar now just opwnes the context menu
* non-public protocols like about: or chrome: are disabled
* friendly messages ;-)
  • Loading branch information
binfalse committed Mar 23, 2012
1 parent 05d6ea8 commit 8e4ed83
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion chrome/content/browser.xul
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<menuitem id="yourls-shortener-context" insertafter="context-bookmarkpage" label="&shorten;" tooltiptext="&shortenlong;" oncommand="YOURLSshortener.run(content.location.href);" />
</popup>
<statusbar id="status-bar">
<statusbarpanel id="yourls-shortener-status-bar-icon" class="statusbarpanel-iconic" src="chrome://yourls-shortener/skin/favicon.gif" tooltiptext="&shortenlong;" onclick="YOURLSshortener.run(content.location.href);" />
<statusbarpanel id="yourls-shortener-status-bar-icon" class="statusbarpanel-iconic" src="chrome://yourls-shortener/skin/favicon.gif" tooltiptext="&shortenlong;" onclick="event.button != 0 || YOURLSshortener.run(content.location.href);" />
</statusbar>
<toolbarpalette id="BrowserToolbarPalette">
<toolbarbutton id="yourls-shortener-toolbar-button" label="&shorten;" tooltiptext="&shortener;" class="toolbarbutton-1 chromeclass-toolbar-additional" type="menu">
Expand Down
13 changes: 11 additions & 2 deletions chrome/content/yourlsshortener.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ var YOURLSshortener = function () {

//alert (askforkey.value);
//alert (maxwait.value);
var checked = askforkey.checked;
prefManager.setCharPref ("extensions.yourls-shortener.api", api.value);
prefManager.setCharPref ("extensions.yourls-shortener.signature", signature.value);
prefManager.setBoolPref ("extensions.yourls-shortener.askforkey", askforkey.checked);
prefManager.setBoolPref ("extensions.yourls-shortener.askforkey", false);
prefManager.setIntPref ("extensions.yourls-shortener.maxwait", maxwait.value);

this.run ("http://binfalse.de/");
prefManager.setBoolPref ("extensions.yourls-shortener.askforkey", checked);
return;
},
run : function (long) {
Expand All @@ -51,6 +53,13 @@ var YOURLSshortener = function () {
return;
}

if (long != "http://binfalse.de/")
if (!(Services.io.getProtocolFlags(makeURI(long).scheme) & Ci.nsIProtocolHandler.URI_LOADABLE_BY_ANYONE))
{
prompts.alert(null, "URL invalid", "This URL is not valid");
return;
}

var api = prefManager.getCharPref ("extensions.yourls-shortener.api");
if (api.substr (-1) != '/')
api += '/';
Expand Down Expand Up @@ -113,7 +122,7 @@ var YOURLSshortener = function () {
}
else
{
prompts.alert(null, "YOURLS shortener: failed", "API returned crap! Please check your signature and the API-URL.");
prompts.alert(null, "YOURLS shortener: failed", "Do not understand the response from API!\nPlease check your signature and the API-URL.");
return;
}
}
Expand Down
4 changes: 2 additions & 2 deletions install.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Description about="urn:mozilla:install-manifest">
<em:id>[email protected]</em:id>
<em:name>YOURLS shortener</em:name>
<em:version>1.3</em:version>
<em:version>1.4</em:version>
<em:type>2</em:type>
<em:creator>Martin Scharm</em:creator>
<em:description>Shorten URLs with your own YOURLS instance</em:description>
Expand All @@ -14,7 +14,7 @@
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>3.0</em:minVersion>
<em:maxVersion>9.*</em:maxVersion>
<em:maxVersion>11.*</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
Expand Down

0 comments on commit 8e4ed83

Please sign in to comment.