searchlink 2.3.74 → 2.3.77
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/searchlink/config.rb +23 -23
- data/lib/searchlink/curl/html.rb +38 -38
- data/lib/searchlink/curl/json.rb +19 -17
- data/lib/searchlink/curl.rb +2 -2
- data/lib/searchlink/exceptions.rb +2 -2
- data/lib/searchlink/help.rb +13 -13
- data/lib/searchlink/output.rb +21 -21
- data/lib/searchlink/parse.rb +116 -113
- data/lib/searchlink/plist.rb +11 -11
- data/lib/searchlink/script_plugin.rb +10 -10
- data/lib/searchlink/search.rb +6 -6
- data/lib/searchlink/searches/amazon.rb +4 -4
- data/lib/searchlink/searches/applemusic.rb +28 -28
- data/lib/searchlink/searches/bitly.rb +11 -11
- data/lib/searchlink/searches/definition.rb +7 -7
- data/lib/searchlink/searches/duckduckgo.rb +31 -27
- data/lib/searchlink/searches/github.rb +48 -48
- data/lib/searchlink/searches/google.rb +16 -16
- data/lib/searchlink/searches/helpers/chromium.rb +46 -46
- data/lib/searchlink/searches/helpers/firefox.rb +20 -20
- data/lib/searchlink/searches/helpers/safari.rb +14 -14
- data/lib/searchlink/searches/history.rb +78 -78
- data/lib/searchlink/searches/hook.rb +5 -5
- data/lib/searchlink/searches/itunes.rb +37 -37
- data/lib/searchlink/searches/lastfm.rb +13 -13
- data/lib/searchlink/searches/linkding.rb +14 -14
- data/lib/searchlink/searches/lyrics.rb +11 -11
- data/lib/searchlink/searches/pinboard.rb +35 -35
- data/lib/searchlink/searches/social.rb +45 -56
- data/lib/searchlink/searches/software.rb +4 -4
- data/lib/searchlink/searches/spelling.rb +10 -10
- data/lib/searchlink/searches/spotlight.rb +4 -4
- data/lib/searchlink/searches/stackoverflow.rb +5 -5
- data/lib/searchlink/searches/tmdb.rb +17 -17
- data/lib/searchlink/searches/twitter.rb +8 -8
- data/lib/searchlink/searches/wikipedia.rb +4 -4
- data/lib/searchlink/searches/youtube.rb +7 -7
- data/lib/searchlink/searches.rb +16 -16
- data/lib/searchlink/semver.rb +4 -4
- data/lib/searchlink/string.rb +55 -55
- data/lib/searchlink/url.rb +30 -32
- data/lib/searchlink/util.rb +3 -3
- data/lib/searchlink/version.rb +19 -21
- data/lib/searchlink/which.rb +5 -5
- data/lib/searchlink.rb +31 -31
- metadata +31 -18
- data/lib/tokens.rb +0 -3
data/lib/searchlink/version.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module SL
|
4
|
-
VERSION = '2.3.
|
4
|
+
VERSION = '2.3.77'
|
5
5
|
end
|
6
6
|
|
7
7
|
# Main module
|
8
8
|
module SL
|
9
9
|
class << self
|
10
10
|
def version_check
|
11
|
-
cachefile = File.expand_path(
|
11
|
+
cachefile = File.expand_path("~/.config/searchlink/cache/update.txt")
|
12
12
|
|
13
13
|
FileUtils.mkdir_p(File.dirname(cachefile)) unless File.directory?(File.dirname(cachefile))
|
14
14
|
|
@@ -29,11 +29,9 @@ module SL
|
|
29
29
|
latest = SemVer.new(latest_tag)
|
30
30
|
current = SemVer.new(SL::VERSION)
|
31
31
|
|
32
|
-
File.open(cachefile,
|
32
|
+
File.open(cachefile, "w") { |f| f.puts("#{last_time.strftime("%c")}|#{latest}") }
|
33
33
|
|
34
|
-
if latest_tag && current.older_than(latest)
|
35
|
-
return "SearchLink v#{current}, #{latest} available. Run 'update' to download."
|
36
|
-
end
|
34
|
+
return "SearchLink v#{current}, #{latest} available. Run \"update\" to download." if latest_tag && current.older_than(latest)
|
37
35
|
|
38
36
|
"SearchLink v#{current}"
|
39
37
|
end
|
@@ -43,17 +41,17 @@ module SL
|
|
43
41
|
# @return false if no new version, or semantic version of latest release
|
44
42
|
def new_version?
|
45
43
|
headers = {
|
46
|
-
|
47
|
-
|
44
|
+
"Accept" => "application/vnd.github+json",
|
45
|
+
"X-GitHub-Api-Version" => "2022-11-28",
|
48
46
|
}
|
49
|
-
headers[
|
47
|
+
headers["Authorization"] = "Bearer #{Secrets::GH_AUTH_TOKEN}" if defined? Secrets::GH_AUTH_TOKEN
|
50
48
|
|
51
|
-
url =
|
49
|
+
url = "https://api.github.com/repos/ttscoff/searchlink/releases/latest"
|
52
50
|
page = Curl::Json.new(url, headers: headers)
|
53
51
|
result = page.json
|
54
52
|
|
55
53
|
if result
|
56
|
-
latest_tag = result[
|
54
|
+
latest_tag = result["tag_name"]
|
57
55
|
|
58
56
|
return false unless latest_tag
|
59
57
|
|
@@ -64,7 +62,7 @@ module SL
|
|
64
62
|
|
65
63
|
return latest_tag if current.older_than(latest)
|
66
64
|
else
|
67
|
-
warn
|
65
|
+
warn "Check for new version failed."
|
68
66
|
end
|
69
67
|
|
70
68
|
false
|
@@ -72,24 +70,24 @@ module SL
|
|
72
70
|
|
73
71
|
def update_searchlink
|
74
72
|
if `uname`.strip !~ /Darwin/
|
75
|
-
add_output(
|
73
|
+
add_output("Auto updating only available on macOS")
|
76
74
|
return
|
77
75
|
end
|
78
76
|
|
79
77
|
new_version = SL.new_version?
|
80
78
|
if new_version
|
81
|
-
folder = File.expand_path(
|
82
|
-
services = File.expand_path(
|
83
|
-
dl = File.join(folder,
|
84
|
-
curl = TTY::Which.which(
|
79
|
+
folder = File.expand_path("~/Downloads")
|
80
|
+
services = File.expand_path("~/Library/Services")
|
81
|
+
dl = File.join(folder, "SearchLink.zip")
|
82
|
+
curl = TTY::Which.which("curl")
|
85
83
|
`#{curl} -SsL -o "#{dl}" https://github.com/ttscoff/searchlink/releases/latest/download/SearchLink.zip`
|
86
84
|
Dir.chdir(folder)
|
87
85
|
`unzip -qo #{dl} -d #{folder}`
|
88
86
|
FileUtils.rm(dl)
|
89
87
|
|
90
|
-
[
|
88
|
+
["SearchLink", "SearchLink File", "Jump to SearchLink Error"].each do |workflow|
|
91
89
|
wflow = "#{workflow}.workflow"
|
92
|
-
src = File.join(folder,
|
90
|
+
src = File.join(folder, "SearchLink Services", wflow)
|
93
91
|
dest = File.join(services, wflow)
|
94
92
|
if File.exist?(src) && File.exist?(dest)
|
95
93
|
FileUtils.rm_rf(dest)
|
@@ -97,9 +95,9 @@ module SL
|
|
97
95
|
end
|
98
96
|
end
|
99
97
|
add_output("Installed SearchLink #{new_version}")
|
100
|
-
FileUtils.rm_rf(
|
98
|
+
FileUtils.rm_rf("SearchLink Services")
|
101
99
|
else
|
102
|
-
add_output(
|
100
|
+
add_output("Already up to date.")
|
103
101
|
end
|
104
102
|
end
|
105
103
|
end
|
data/lib/searchlink/which.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
module TTY
|
7
7
|
module Which
|
8
|
-
VERSION =
|
8
|
+
VERSION = "0.5.0"
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -84,7 +84,7 @@ module TTY
|
|
84
84
|
# the array of paths to search
|
85
85
|
#
|
86
86
|
# @api private
|
87
|
-
def search_paths(path = ENV[
|
87
|
+
def search_paths(path = ENV["PATH"])
|
88
88
|
paths = if path && !path.empty?
|
89
89
|
path.split(::File::PATH_SEPARATOR)
|
90
90
|
else
|
@@ -106,10 +106,10 @@ module TTY
|
|
106
106
|
# an array with valid file extensions
|
107
107
|
#
|
108
108
|
# @api private
|
109
|
-
def extensions(path_ext = ENV[
|
110
|
-
return [
|
109
|
+
def extensions(path_ext = ENV["PATHEXT"])
|
110
|
+
return [""] unless path_ext
|
111
111
|
|
112
|
-
path_ext.split(::File::PATH_SEPARATOR).select { |part| part.include?(
|
112
|
+
path_ext.split(::File::PATH_SEPARATOR).select { |part| part.include?(".") }
|
113
113
|
end
|
114
114
|
|
115
115
|
# Determines if filename is an executable file
|
data/lib/searchlink.rb
CHANGED
@@ -2,74 +2,74 @@
|
|
2
2
|
|
3
3
|
# SearchLink by Brett Terpstra 2015 <http://brettterpstra.com/projects/searchlink/>
|
4
4
|
# MIT License, please maintain attribution
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
13
|
-
require
|
14
|
-
require
|
15
|
-
require
|
16
|
-
require
|
5
|
+
require "net/https"
|
6
|
+
require "uri"
|
7
|
+
require "shellwords"
|
8
|
+
require "yaml"
|
9
|
+
require "cgi"
|
10
|
+
require "fileutils"
|
11
|
+
require "tempfile"
|
12
|
+
require "zlib"
|
13
|
+
require "time"
|
14
|
+
require "json"
|
15
|
+
require "erb"
|
16
|
+
require "English"
|
17
17
|
|
18
18
|
# import
|
19
|
-
|
19
|
+
require_relative "tokens" if File.exist?("tokens.rb")
|
20
20
|
|
21
21
|
# import
|
22
|
-
|
22
|
+
require_relative "searchlink/exceptions"
|
23
23
|
|
24
24
|
# import
|
25
|
-
|
25
|
+
require_relative "searchlink/number"
|
26
26
|
|
27
27
|
# import
|
28
|
-
|
28
|
+
require_relative "searchlink/util"
|
29
29
|
|
30
30
|
# import
|
31
|
-
|
31
|
+
require_relative "searchlink/curl"
|
32
32
|
|
33
33
|
# import
|
34
|
-
|
34
|
+
require_relative "searchlink/semver"
|
35
35
|
|
36
36
|
# import
|
37
|
-
|
37
|
+
require_relative "searchlink/version"
|
38
38
|
|
39
39
|
# import
|
40
|
-
|
40
|
+
require_relative "searchlink/array"
|
41
41
|
|
42
42
|
# import
|
43
|
-
|
43
|
+
require_relative "searchlink/string"
|
44
44
|
|
45
45
|
# import
|
46
|
-
|
46
|
+
require_relative "searchlink/plist"
|
47
47
|
|
48
48
|
# import
|
49
|
-
|
49
|
+
require_relative "searchlink/config"
|
50
50
|
|
51
51
|
# import
|
52
|
-
|
52
|
+
require_relative "searchlink/searches"
|
53
53
|
|
54
54
|
# import
|
55
|
-
|
55
|
+
require_relative "searchlink/url"
|
56
56
|
|
57
57
|
# import
|
58
|
-
|
58
|
+
require_relative "searchlink/search"
|
59
59
|
|
60
60
|
# import
|
61
|
-
|
61
|
+
require_relative "searchlink/help"
|
62
62
|
|
63
63
|
# import
|
64
|
-
|
64
|
+
require_relative "searchlink/parse"
|
65
65
|
|
66
66
|
# import
|
67
|
-
|
67
|
+
require_relative "searchlink/output"
|
68
68
|
|
69
69
|
# import
|
70
|
-
|
70
|
+
require_relative "searchlink/which"
|
71
71
|
|
72
72
|
# import
|
73
|
-
|
73
|
+
require_relative "searchlink/script_plugin"
|
74
74
|
|
75
75
|
module Secrets; end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
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.77
|
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-
|
11
|
+
date: 2024-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: base64
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.2'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,6 +136,20 @@ dependencies:
|
|
122
136
|
- - "~>"
|
123
137
|
- !ruby/object:Gem::Version
|
124
138
|
version: '2.1'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: plist
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 3.7.1
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 3.7.1
|
125
153
|
- !ruby/object:Gem::Dependency
|
126
154
|
name: rake
|
127
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -220,20 +248,6 @@ dependencies:
|
|
220
248
|
- - "~>"
|
221
249
|
- !ruby/object:Gem::Version
|
222
250
|
version: 0.9.5
|
223
|
-
- !ruby/object:Gem::Dependency
|
224
|
-
name: plist
|
225
|
-
requirement: !ruby/object:Gem::Requirement
|
226
|
-
requirements:
|
227
|
-
- - "~>"
|
228
|
-
- !ruby/object:Gem::Version
|
229
|
-
version: 3.7.1
|
230
|
-
type: :development
|
231
|
-
prerelease: false
|
232
|
-
version_requirements: !ruby/object:Gem::Requirement
|
233
|
-
requirements:
|
234
|
-
- - "~>"
|
235
|
-
- !ruby/object:Gem::Version
|
236
|
-
version: 3.7.1
|
237
251
|
description: macOS System Service for inline web searches
|
238
252
|
email:
|
239
253
|
- me@brettterpstra.com
|
@@ -290,7 +304,6 @@ files:
|
|
290
304
|
- lib/searchlink/util.rb
|
291
305
|
- lib/searchlink/version.rb
|
292
306
|
- lib/searchlink/which.rb
|
293
|
-
- lib/tokens.rb
|
294
307
|
homepage: https://github.com/ttscoff/searchlink
|
295
308
|
licenses:
|
296
309
|
- MIT
|
@@ -310,7 +323,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
310
323
|
- !ruby/object:Gem::Version
|
311
324
|
version: '0'
|
312
325
|
requirements: []
|
313
|
-
rubygems_version: 3.
|
326
|
+
rubygems_version: 3.5.3
|
314
327
|
signing_key:
|
315
328
|
specification_version: 4
|
316
329
|
summary: Create Markdown links from web searches without leaving your editor.
|
data/lib/tokens.rb
DELETED