mirror of
https://github.com/Tygs/0bin.git
synced 2023-08-10 21:13:00 +03:00
#18 - It is better to shorten URL over SSH since there is the encryption key - futhermore if you run 0bin over SSH.
This commit is contained in:
parent
303905aff5
commit
28bff88784
@ -178,9 +178,19 @@ window.zerobin = {
|
||||
/** Get a tinyurl using JSONP */
|
||||
getTinyURL: function(longURL, success) {
|
||||
var api = 'http://is.gd/create.php?format=json&url=';
|
||||
$.getJSON(api + encodeURIComponent(longURL) + '&callback=?', function(data){
|
||||
success(data.shorturl);
|
||||
});
|
||||
$.ajax({
|
||||
url: 'https://www.googleapis.com/urlshortener/v1/url',
|
||||
type: 'POST',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify({
|
||||
"longUrl": longURL
|
||||
}),
|
||||
processData: false,
|
||||
dataType: 'json'
|
||||
}).done(function(data){
|
||||
console.log(data);
|
||||
success(data.id);
|
||||
});
|
||||
},
|
||||
|
||||
/** Check for browser support of the named featured. Store the result
|
||||
|
Loading…
Reference in New Issue
Block a user