diff --git a/Website/ch/index.php b/Website/ch/index.php index 0c21b61..90c95f3 100644 --- a/Website/ch/index.php +++ b/Website/ch/index.php @@ -12,6 +12,8 @@ if(isset($_GET['shorten'])){ $short = $_GET['url']; + $expire = 2; + if(!empty($_GET['time']) && is_numeric($_GET['time'])) $expire = $_GET['time']; if(strpos($short, "http://") === false && strpos($short, "https://") === false){ $short = "http://$short"; } $apip = $redis->get("api:ip:$ip"); @@ -22,7 +24,7 @@ die("Too many requests too fast!"); } - $reShort = shorten($redis, $short, 2, $seperator); + $reShort = shorten($redis, $short, $expire, $seperator); $reShort = explode($seperator, $reShort); $retCode = $reShort[0]; @@ -52,7 +54,7 @@ break; } exit; - }elseif(isset($_GET['resolve'])){ die("Not ready"); } - else{ die("Improper Call."); } + }elseif(isset($_GET['resolve'])){ die("Not ready"); + }else{ die("Improper Call."); } -?> \ No newline at end of file +?> diff --git a/lob.li crx/js/background.js b/lob.li crx/js/background.js index b6712ee..415632d 100644 --- a/lob.li crx/js/background.js +++ b/lob.li crx/js/background.js @@ -45,7 +45,7 @@ function shortenTabURL(tabid){ // Use just a tab id to shorten its url function shortenURL(url){ // Creates a short url and copies it to clipboard if(testURL(url)){ - sendAPIRequest("shorten&url=" + url, function(req){ + sendAPIRequest("?shorten&url=" + url, function(req){ var res = req.responseText.trim(); switch(res){ case "dead": @@ -58,7 +58,7 @@ function shortenURL(url){ // Creates a short url and copies it to clipboard showAlert("General Error."); break; default: - copyToClipboard("http://lob.li/" + res); + copyToClipboard("http://b.lob.li/?"+res); showAlert("Link shortened. Short link copied to clipboard!"); break; } @@ -68,7 +68,7 @@ function shortenURL(url){ // Creates a short url and copies it to clipboard function resolveURL(url){ // For when/if I decide to add the ability to resolve links through the extension if(testURL(url)){ - sendAPIRequest("resolve&url=" + url, function(req){ + sendAPIRequest("?resolve&url=" + url, function(req){ var res = req.responseText.trim(); copyToClipboard(res); showAlert("Link Resolved!\n" + res); @@ -79,7 +79,7 @@ function resolveURL(url){ // For when/if I decide to add the ability to resolve function sendAPIRequest(url, callback){ // Sends a GET request to the server, response is expected to be text and only short id, or resolved link var method = "GET"; var req = new XMLHttpRequest(); - req.open(method, "http://lob.li/ch/" + url, true); + req.open(method, "http://b.lob.li/ch/" + url, true); req.onload = function(){ callback(req); };