Skip to content

Commit

Permalink
Restore is.gd since it was brought back from the dead. Fix #127
Browse files Browse the repository at this point in the history
  • Loading branch information
fwenzel committed Nov 9, 2021
1 parent e5e3b35 commit f9c5f09
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 31 deletions.
34 changes: 4 additions & 30 deletions src/lib/shortener.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@ import notify from './notify.js';
const _ = browser.i18n.getMessage;

// Service default.
const DEFAULT_SERVICE = 'tinyurl';
const DEFAULT_SERVICE = 'isgd';

// Specify 'url' for plain-text GET APIs, or request/result for more complex
// variants. Note: return a fetch() promise.
// Do not forget to add origins to permissions in manifest.
const serviceUrls = {
none: {}, // Placeholder.

// TODO: isgd appears defunct (issue #122). Remove if permanently gone.
// isgd: {
// url: 'https://is.gd/api.php?longurl=%URL%'
// },
isgd: {
url: 'https://is.gd/api.php?longurl=%URL%'
},

tinyurl: {
url: 'https://tinyurl.com/api-create.php?url=%URL%',
Expand All @@ -34,31 +33,6 @@ const serviceUrls = {
result: response => response.text()
},

goly: {
request: url => fetch('https://api.go.ly/api/v1/link', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
'DomainID': 2,
'Payload': {
'Destination': url
},
'Type': 0,
'UserID': 1
})
}),
result: async response => {
const res = await response.json();
if (res['Status'] === 200) {
return `https://go.ly/${res['Slug']}`;
} else {
throw new Error(res['Message']);
}
}
},

vurl: {
url: 'https://vurl.com/api.php?url=%URL%',
force_https: true
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "__MSG_extensionDescription__",
"author": "Fred Wenzel",
"homepage_url": "http://copy-shorturl.rtfd.org",
"version": "5.2.0",
"version": "5.3.0",
"default_locale": "en",
"applications": {
"gecko": {
Expand Down

0 comments on commit f9c5f09

Please sign in to comment.