searchlink 2.3.77 → 2.3.79
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/searchlink/searches/isgd.rb +48 -0
- data/lib/searchlink/searches.rb +3 -0
- data/lib/searchlink/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc8e7b3ad7f2660103a7030846dc663d0e82119acf0b8d32e89f063335f644fd
|
4
|
+
data.tar.gz: bf9a2a1bb3d6bb68d75e6a98a177ecc85a2ef8df162b74655b4f0684b27045ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51c29438e4641530c10b449e72206ba3ee6ab955882f8db6e0928aac335d70659659c813738d988df973933b68dc561876f334c16e4b17ef21fd67d927166a36
|
7
|
+
data.tar.gz: 65b99b60b02522e7ed7c01bf31b8fb52382055db906e1742b130d9852524bb943a7dc3471ae253c5ed2619c77be849baf7dcb7bceca6afe3f7f4dc3ab41a830f
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SL
|
4
|
+
# is.gd link shortening
|
5
|
+
class IsgdSearch
|
6
|
+
class << self
|
7
|
+
def settings
|
8
|
+
{
|
9
|
+
trigger: "isgd",
|
10
|
+
searches: [
|
11
|
+
["isgd", "is.gd Shorten"]
|
12
|
+
]
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
def search(_, search_terms, link_text)
|
17
|
+
if SL::URL.url?(search_terms)
|
18
|
+
link = search_terms
|
19
|
+
else
|
20
|
+
link, rtitle = SL.ddg(search_terms, link_text)
|
21
|
+
end
|
22
|
+
|
23
|
+
url, title = isgd_shorten(link, rtitle)
|
24
|
+
link_text = title || url
|
25
|
+
[url, title, link_text]
|
26
|
+
end
|
27
|
+
|
28
|
+
def isgd_shorten(url, title = nil)
|
29
|
+
long_url = url.dup
|
30
|
+
|
31
|
+
data = Curl::Json.new("https://is.gd/create.php?format=json&url=#{CGI.escape(long_url)}", symbolize_names: true)
|
32
|
+
|
33
|
+
if data.json.key?('errorcode')
|
34
|
+
SL.add_error('Error creating is.gd url', data.json[:errorcode])
|
35
|
+
return [false, title, link_text]
|
36
|
+
end
|
37
|
+
|
38
|
+
link = data.json[:shorturl]
|
39
|
+
rtitle = SL::URL.title(long_url)
|
40
|
+
title = rtitle
|
41
|
+
link_text = rtitle if link_text == '' && !SL.titleize
|
42
|
+
[link, title, link_text]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
SL::Searches.register "isgd", :search, self
|
47
|
+
end
|
48
|
+
end
|
data/lib/searchlink/searches.rb
CHANGED
data/lib/searchlink/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: searchlink
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.79
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base64
|
@@ -284,6 +284,7 @@ files:
|
|
284
284
|
- lib/searchlink/searches/helpers/safari.rb
|
285
285
|
- lib/searchlink/searches/history.rb
|
286
286
|
- lib/searchlink/searches/hook.rb
|
287
|
+
- lib/searchlink/searches/isgd.rb
|
287
288
|
- lib/searchlink/searches/itunes.rb
|
288
289
|
- lib/searchlink/searches/lastfm.rb
|
289
290
|
- lib/searchlink/searches/linkding.rb
|