rubeepass 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rubeepass/entry.rb +2 -6
- data/lib/rubeepass/group.rb +36 -12
- data/lib/rubeepass/wish/cd_wish.rb +1 -1
- data/lib/rubeepass/wish/copy_wish.rb +12 -5
- data/lib/rubeepass/wish/echo_wish.rb +12 -5
- data/lib/rubeepass/wish/ls_wish.rb +1 -1
- data/lib/rubeepass/wish/show_wish.rb +17 -13
- data/lib/rubeepass.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54e5d7978fbfd618209c6f5d38fb222aca339399
|
4
|
+
data.tar.gz: 537d3ac1597fefa44e2a81e85705b20a53fcf8d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b7f8d5e516f29751c59aad5cd466bc5b338244d1470c0e516272a6a644cfe7d57cf4bcab984caca98f7d6dee4b96417f547ceda03db5b2bbb47ce68095c886a
|
7
|
+
data.tar.gz: 3fbae9d48900fb97bc6d3f23c81f82235d4d6dfe5f1317b8d5390bdf58924f39406941f21eceac7b165560d47cb6007605332415fe67d12230a324f1f95903b4
|
data/lib/rubeepass/entry.rb
CHANGED
@@ -159,15 +159,11 @@ class RubeePass::Entry
|
|
159
159
|
end
|
160
160
|
|
161
161
|
def has_attachment?(name)
|
162
|
-
return
|
163
|
-
k.downcase == name.downcase
|
164
|
-
end
|
162
|
+
return !@attachments[name].nil?
|
165
163
|
end
|
166
164
|
|
167
165
|
def has_attribute?(attr)
|
168
|
-
return
|
169
|
-
k.downcase == attr.downcase
|
170
|
-
end
|
166
|
+
return !@attributes[attr].nil?
|
171
167
|
end
|
172
168
|
|
173
169
|
def hilight_attr(title)
|
data/lib/rubeepass/group.rb
CHANGED
@@ -51,7 +51,7 @@ class RubeePass::Group
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
def find_group(path)
|
54
|
+
def find_group(path, case_insensitive = false)
|
55
55
|
return nil if (@keepass.nil?)
|
56
56
|
|
57
57
|
path = @keepass.absolute_path(path, @path)
|
@@ -59,16 +59,30 @@ class RubeePass::Group
|
|
59
59
|
|
60
60
|
path.split("/").each do |group|
|
61
61
|
next if (group.empty?)
|
62
|
-
if (
|
63
|
-
|
62
|
+
if (case_insensitive)
|
63
|
+
if (cwd.has_group_like?(group))
|
64
|
+
cwd = cwd.groups.select do |k, v|
|
65
|
+
k.downcase == group.downcase
|
66
|
+
end.values.first
|
67
|
+
else
|
68
|
+
return nil
|
69
|
+
end
|
64
70
|
else
|
65
|
-
|
71
|
+
if (cwd.has_group?(group))
|
72
|
+
cwd = cwd.groups[group]
|
73
|
+
else
|
74
|
+
return nil
|
75
|
+
end
|
66
76
|
end
|
67
77
|
end
|
68
78
|
|
69
79
|
return cwd
|
70
80
|
end
|
71
81
|
|
82
|
+
def find_group_like(path)
|
83
|
+
return find_group(path, true)
|
84
|
+
end
|
85
|
+
|
72
86
|
def self.from_xml(keepass, parent, xml)
|
73
87
|
name = "/"
|
74
88
|
name = xml.elements["Name"].text || "" if (parent)
|
@@ -122,8 +136,10 @@ class RubeePass::Group
|
|
122
136
|
new_cwd = find_group(path)
|
123
137
|
return [Array.new, Array.new] if (new_cwd.nil?)
|
124
138
|
|
125
|
-
if (new_cwd.
|
126
|
-
new_cwd = new_cwd.groups
|
139
|
+
if (new_cwd.has_group_like?(target))
|
140
|
+
new_cwd = new_cwd.groups.select do |k, v|
|
141
|
+
k.downcase == target.downcase
|
142
|
+
end.values.first
|
127
143
|
target = ""
|
128
144
|
end
|
129
145
|
|
@@ -150,15 +166,23 @@ class RubeePass::Group
|
|
150
166
|
end
|
151
167
|
end
|
152
168
|
|
153
|
-
def has_entry?(
|
154
|
-
return
|
155
|
-
|
169
|
+
def has_entry?(entry)
|
170
|
+
return !@entries[entry].nil?
|
171
|
+
end
|
172
|
+
|
173
|
+
def has_entry_like?(entry)
|
174
|
+
return entry_titles.any? do |title|
|
175
|
+
title.downcase == entry.downcase
|
156
176
|
end
|
157
177
|
end
|
158
178
|
|
159
|
-
def has_group?(
|
160
|
-
return
|
161
|
-
|
179
|
+
def has_group?(group)
|
180
|
+
return !@groups[group].nil?
|
181
|
+
end
|
182
|
+
|
183
|
+
def has_group_like?(group)
|
184
|
+
return group_names.any? do |name|
|
185
|
+
name.downcase == group.downcase
|
162
186
|
end
|
163
187
|
end
|
164
188
|
|
@@ -32,27 +32,34 @@ class CopyWish < Djinni::Wish
|
|
32
32
|
|
33
33
|
path = keepass.absolute_path(path, cwd.path)
|
34
34
|
path, found, target = path.rpartition("/")
|
35
|
-
new_cwd = keepass.
|
35
|
+
new_cwd = keepass.find_group_like(path)
|
36
36
|
timeout = djinni_env["clipboard_timeout"]
|
37
37
|
|
38
|
-
if (new_cwd.nil? || !new_cwd.
|
38
|
+
if (new_cwd.nil? || !new_cwd.has_entry_like?(target))
|
39
39
|
puts "Entry not found"
|
40
40
|
return
|
41
41
|
end
|
42
42
|
|
43
|
+
# Prefer exact match
|
44
|
+
entry = new_cwd.entries[target]
|
45
|
+
# Fallback to case-insensitive match
|
46
|
+
entry ||= new_cwd.entries.select do |k, v|
|
47
|
+
k.downcase == target.downcase
|
48
|
+
end.values.first
|
49
|
+
|
43
50
|
case field
|
44
51
|
when "pass"
|
45
|
-
|
52
|
+
entry.copy_password_to_clipboard
|
46
53
|
keepass.send(
|
47
54
|
"clear_clipboard_after_#{timeout}_seconds"
|
48
55
|
)
|
49
56
|
when "url"
|
50
|
-
|
57
|
+
entry.copy_url_to_clipboard
|
51
58
|
keepass.send(
|
52
59
|
"clear_clipboard_after_#{timeout}_seconds"
|
53
60
|
)
|
54
61
|
when "user"
|
55
|
-
|
62
|
+
entry.copy_username_to_clipboard
|
56
63
|
keepass.send(
|
57
64
|
"clear_clipboard_after_#{timeout}_seconds"
|
58
65
|
)
|
@@ -32,20 +32,27 @@ class EchoWish < Djinni::Wish
|
|
32
32
|
|
33
33
|
path = keepass.absolute_path(path, cwd.path)
|
34
34
|
path, found, target = path.rpartition("/")
|
35
|
-
new_cwd = keepass.
|
35
|
+
new_cwd = keepass.find_group_like(path)
|
36
36
|
|
37
|
-
if (new_cwd.nil? || !new_cwd.
|
37
|
+
if (new_cwd.nil? || !new_cwd.has_entry_like?(target))
|
38
38
|
puts "Entry not found"
|
39
39
|
return
|
40
40
|
end
|
41
41
|
|
42
|
+
# Prefer exact match
|
43
|
+
entry = new_cwd.entries[target]
|
44
|
+
# Fallback to case-insensitive match
|
45
|
+
entry ||= new_cwd.entries.select do |k, v|
|
46
|
+
k.downcase == target.downcase
|
47
|
+
end.values.first
|
48
|
+
|
42
49
|
case field
|
43
50
|
when "pass"
|
44
|
-
|
51
|
+
entry.echo_password
|
45
52
|
when "url"
|
46
|
-
|
53
|
+
entry.echo_url
|
47
54
|
when "user"
|
48
|
-
|
55
|
+
entry.echo_username
|
49
56
|
end
|
50
57
|
end
|
51
58
|
|
@@ -16,7 +16,7 @@ class ShowWish < Djinni::Wish
|
|
16
16
|
args = cwd.path if (args.empty?)
|
17
17
|
path = keepass.absolute_path(args, cwd.path)
|
18
18
|
path, found, target = path.rpartition("/")
|
19
|
-
new_cwd = keepass.
|
19
|
+
new_cwd = keepass.find_group_like(path)
|
20
20
|
|
21
21
|
if (new_cwd.nil?)
|
22
22
|
puts "Group not found"
|
@@ -30,22 +30,26 @@ class ShowWish < Djinni::Wish
|
|
30
30
|
else
|
31
31
|
puts new_cwd
|
32
32
|
end
|
33
|
-
elsif (new_cwd.
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
33
|
+
elsif (new_cwd.has_group_like?(target))
|
34
|
+
new_cwd.groups.select do |k, v|
|
35
|
+
k.downcase == target.downcase
|
36
|
+
end.values.each do |group|
|
37
|
+
case djinni_env["djinni_input"]
|
38
|
+
when "showall"
|
39
|
+
puts group.details(0, true)
|
40
|
+
else
|
41
|
+
puts group
|
42
|
+
end
|
39
43
|
end
|
40
|
-
elsif (new_cwd.
|
41
|
-
new_cwd.
|
42
|
-
|
43
|
-
end.each do |entry|
|
44
|
+
elsif (new_cwd.has_entry_like?(target))
|
45
|
+
new_cwd.entries.select do |k, v|
|
46
|
+
k.downcase == target.downcase
|
47
|
+
end.values.each do |entry|
|
44
48
|
case djinni_env["djinni_input"]
|
45
49
|
when "showall"
|
46
|
-
puts
|
50
|
+
puts entry.details(0, true)
|
47
51
|
else
|
48
|
-
puts
|
52
|
+
puts entry
|
49
53
|
end
|
50
54
|
end
|
51
55
|
else
|
data/lib/rubeepass.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubeepass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Whittaker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|