ruby-pass-qt 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff7e9aec8abb1930464e918a319eb2e0356b5b01775a82577fb3fd04573baf77
4
- data.tar.gz: b98a28691163b14373977108e3699e043d4ffbd095c5d07d5219d8024714c9d2
3
+ metadata.gz: 933031fe6c0ff54220bc6c2dbaab8eb575d52d001c2c560258c0fdc4faeb9262
4
+ data.tar.gz: 04d8b8dc1ab23584f7e796a9e1d19b742e917036e79d0aea2c76248246fa3464
5
5
  SHA512:
6
- metadata.gz: 18305f13b8ff16d87a22a4510c1ef62f8764eb86d036a5b924da34f8cb6540e9ae3fef83a3fe4d3161c45d518a6891ba9aa1ccb2dac4e4c6b8efaac37d2ea8ef
7
- data.tar.gz: fb1591d11c18e8a79aa3a60f5312c3b9202029e6653e5223123a163a654d4f369d634b61bf191a3b28d0637e29e1d75df8a2f8cc321c56dd7b78a5435491386d
6
+ metadata.gz: 49af5357e70d430f76470a0842fbbf443dee5398a89a5d05d0b135b8c56e8aea682c0bf1d7ce3e063e358073d25285f872cb32aba9f1083c8d679b6c286973ce
7
+ data.tar.gz: 4ed0728562a4918572aa75b009b5631277da658a82adfe28e4351695c63fac49b3abef4cac7f94f07cd154ab2a981ea65b99ada0d43e973eabdc46b5f6916bdd
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # Pass-Qt
1
+ # PassQt
2
2
 
3
3
  A simple GUI for pass on Linux.
4
4
 
5
5
  ## Requirements
6
6
 
7
- - [Ruby 3.4+](https://www.ruby-lang.org/)
8
- - [Qt 6.10+](https://www.qt.io/)
7
+ - [Ruby](https://www.ruby-lang.org/)
8
+ - [Qt](https://www.qt.io/)
9
9
  - **one of the following password managers**
10
10
  - [pass](https://www.passwordstore.org/) & [pwgen](https://sourceforge.net/projects/pwgen/)
11
11
  - [gopass](https://github.com/gopasspw/gopass)
@@ -1,235 +1,233 @@
1
- module PassQt
2
- class PassInfoWidget < RubyQt6::Bando::QWidget
3
- q_object do
4
- slot "_on_copy_action_triggered()"
5
- slot "_on_copy_action_triggered_otpcode()"
6
- slot "_on_view_action_triggered()"
7
- end
1
+ class PassInfoWidget < RubyQt6::Bando::QWidget
2
+ q_object do
3
+ slot "_on_copy_action_triggered()"
4
+ slot "_on_copy_action_triggered_otpcode()"
5
+ slot "_on_view_action_triggered()"
6
+ end
8
7
 
9
- def initialize
10
- super
8
+ def initialize
9
+ super
11
10
 
12
- @store = QString.new
13
- @passname = QString.new
11
+ @store = QString.new
12
+ @passname = QString.new
14
13
 
15
- initialize_form
16
- initialize_otpform
17
- initialize_folderform
18
- initialize_infoframe
14
+ initialize_form
15
+ initialize_otpform
16
+ initialize_folderform
17
+ initialize_infoframe
19
18
 
20
- @stackedlayout = QStackedLayout.new
21
- @stackedlayout.add_widget(@form)
22
- @stackedlayout.add_widget(@otpform)
23
- @stackedlayout.add_widget(@folderform)
24
- @stackedlayout.add_widget(@infoframe)
19
+ @stackedlayout = QStackedLayout.new
20
+ @stackedlayout.add_widget(@form)
21
+ @stackedlayout.add_widget(@otpform)
22
+ @stackedlayout.add_widget(@folderform)
23
+ @stackedlayout.add_widget(@infoframe)
25
24
 
26
- mainlayout = QVBoxLayout.new(self)
27
- mainlayout.add_spacing(76)
28
- mainlayout.add_layout(@stackedlayout)
25
+ mainlayout = QVBoxLayout.new(self)
26
+ mainlayout.add_spacing(76)
27
+ mainlayout.add_layout(@stackedlayout)
29
28
 
30
- use_infoframe
31
- end
29
+ use_infoframe
30
+ end
32
31
 
33
- def reinitialize_passfile(store, passname)
34
- @store = store
35
- @passname = passname
36
- use_infoframe
37
-
38
- Pass.show(@store, @passname, on_success: ->(data) {
39
- formdata = h_parse_passfile(data)
40
- if formdata["password"].start_with?("otpauth:")
41
- use_otpform(formdata)
42
- else
43
- use_form(formdata)
44
- end
45
- }, on_failure: ->(data) {
46
- errinfo = data["stderr"]
47
- use_infoframe_err(errinfo)
48
- })
49
- end
32
+ def reinitialize_passfile(store, passname)
33
+ @store = store
34
+ @passname = passname
35
+ use_infoframe
36
+
37
+ Pass.show(@store, @passname, on_success: ->(data) {
38
+ formdata = h_parse_passfile(data)
39
+ if formdata["password"].start_with?("otpauth:")
40
+ use_otpform(formdata)
41
+ else
42
+ use_form(formdata)
43
+ end
44
+ }, on_failure: ->(data) {
45
+ errinfo = data["stderr"]
46
+ use_infoframe_err(errinfo)
47
+ })
48
+ end
50
49
 
51
- def reinitialize_passfolder(store, passname)
52
- @store = store
53
- @passname = passname
54
- use_infoframe
55
- use_folderform
56
- end
50
+ def reinitialize_passfolder(store, passname)
51
+ @store = store
52
+ @passname = passname
53
+ use_infoframe
54
+ use_folderform
55
+ end
57
56
 
58
- def reinitialize_infoframe
59
- @store = QString.new
60
- @passname = QString.new
61
- use_infoframe
62
- end
57
+ def reinitialize_infoframe
58
+ @store = QString.new
59
+ @passname = QString.new
60
+ use_infoframe
61
+ end
63
62
 
64
- private
63
+ private
65
64
 
66
- def initialize_form
67
- @passnameinput = initialize_form_inputfield
68
- initialize_form_inputfield_copyaction(@passnameinput)
65
+ def initialize_form
66
+ @passnameinput = initialize_form_inputfield
67
+ initialize_form_inputfield_copyaction(@passnameinput)
69
68
 
70
- @passwordinput = initialize_form_inputfield
71
- initialize_form_inputfield_copyaction(@passwordinput)
72
- initialize_form_inputfield_viewaction(@passwordinput)
69
+ @passwordinput = initialize_form_inputfield
70
+ initialize_form_inputfield_copyaction(@passwordinput)
71
+ initialize_form_inputfield_viewaction(@passwordinput)
73
72
 
74
- @usernameinput = initialize_form_inputfield
75
- initialize_form_inputfield_copyaction(@usernameinput)
73
+ @usernameinput = initialize_form_inputfield
74
+ initialize_form_inputfield_copyaction(@usernameinput)
76
75
 
77
- @websiteinput = initialize_form_inputfield
78
- initialize_form_inputfield_copyaction(@websiteinput)
76
+ @websiteinput = initialize_form_inputfield
77
+ initialize_form_inputfield_copyaction(@websiteinput)
79
78
 
80
- @form = QWidget.new
81
- formlayout = QFormLayout.new(@form)
82
- formlayout.add_row(initialize_form_label("File"), @passnameinput)
83
- formlayout.add_row(initialize_form_label("Username"), @usernameinput)
84
- formlayout.add_row(initialize_form_label("Password"), @passwordinput)
85
- formlayout.add_row(initialize_form_label("Website"), @websiteinput)
86
- end
79
+ @form = QWidget.new
80
+ formlayout = QFormLayout.new(@form)
81
+ formlayout.add_row(initialize_form_label("File"), @passnameinput)
82
+ formlayout.add_row(initialize_form_label("Username"), @usernameinput)
83
+ formlayout.add_row(initialize_form_label("Password"), @passwordinput)
84
+ formlayout.add_row(initialize_form_label("Website"), @websiteinput)
85
+ end
87
86
 
88
- def initialize_otpform
89
- @otppassnameinput = initialize_form_inputfield
90
- initialize_form_inputfield_copyaction(@otppassnameinput)
87
+ def initialize_otpform
88
+ @otppassnameinput = initialize_form_inputfield
89
+ initialize_form_inputfield_copyaction(@otppassnameinput)
91
90
 
92
- @otppasswordinput = initialize_form_inputfield
93
- initialize_form_inputfield_copyaction(@otppasswordinput)
94
- initialize_form_inputfield_viewaction(@otppasswordinput)
91
+ @otppasswordinput = initialize_form_inputfield
92
+ initialize_form_inputfield_copyaction(@otppasswordinput)
93
+ initialize_form_inputfield_viewaction(@otppasswordinput)
95
94
 
96
- @otpcodeinput = initialize_form_inputfield
97
- action = @otpcodeinput.add_action(QIcon.from_theme(QIcon::ThemeIcon::EditCopy), QLineEdit::LeadingPosition)
98
- action.triggered.connect(self, :_on_copy_action_triggered_otpcode)
95
+ @otpcodeinput = initialize_form_inputfield
96
+ action = @otpcodeinput.add_action(QIcon.from_theme(QIcon::ThemeIcon::EditCopy), QLineEdit::LeadingPosition)
97
+ action.triggered.connect(self, :_on_copy_action_triggered_otpcode)
99
98
 
100
- @otpform = QWidget.new
101
- otpformlayout = QFormLayout.new(@otpform)
102
- otpformlayout.add_row(initialize_form_label("File"), @otppassnameinput)
103
- otpformlayout.add_row(initialize_form_label("OTP URI"), @otppasswordinput)
104
- otpformlayout.add_row(initialize_form_label("OTP Code"), @otpcodeinput)
105
- end
99
+ @otpform = QWidget.new
100
+ otpformlayout = QFormLayout.new(@otpform)
101
+ otpformlayout.add_row(initialize_form_label("File"), @otppassnameinput)
102
+ otpformlayout.add_row(initialize_form_label("OTP URI"), @otppasswordinput)
103
+ otpformlayout.add_row(initialize_form_label("OTP Code"), @otpcodeinput)
104
+ end
106
105
 
107
- def initialize_folderform
108
- @folderpassnameinput = initialize_form_inputfield
109
- initialize_form_inputfield_copyaction(@folderpassnameinput)
106
+ def initialize_folderform
107
+ @folderpassnameinput = initialize_form_inputfield
108
+ initialize_form_inputfield_copyaction(@folderpassnameinput)
110
109
 
111
- @folderform = QWidget.new
112
- folderformlayout = QFormLayout.new(@folderform)
113
- folderformlayout.add_row(initialize_form_label("Folder"), @folderpassnameinput)
114
- end
110
+ @folderform = QWidget.new
111
+ folderformlayout = QFormLayout.new(@folderform)
112
+ folderformlayout.add_row(initialize_form_label("Folder"), @folderpassnameinput)
113
+ end
115
114
 
116
- def initialize_form_label(text)
117
- label = QLabel.new(text)
118
- label.set_alignment(Qt::AlignRight)
119
- label.set_style_sheet("min-width: 80px; padding-right: 4px;")
120
- label
121
- end
115
+ def initialize_form_label(text)
116
+ label = QLabel.new(text)
117
+ label.set_alignment(Qt::AlignRight)
118
+ label.set_style_sheet("min-width: 80px; padding-right: 4px;")
119
+ label
120
+ end
122
121
 
123
- def initialize_form_inputfield
124
- input = QLineEdit.new
125
- input.set_read_only(true)
126
- input.set_focus_policy(Qt::NoFocus)
127
- input
128
- end
122
+ def initialize_form_inputfield
123
+ input = QLineEdit.new
124
+ input.set_read_only(true)
125
+ input.set_focus_policy(Qt::NoFocus)
126
+ input
127
+ end
129
128
 
130
- def initialize_form_inputfield_copyaction(input)
131
- action = input.add_action(QIcon.from_theme(QIcon::ThemeIcon::EditCopy), QLineEdit::LeadingPosition)
132
- action.triggered.connect(self, :_on_copy_action_triggered)
133
- end
129
+ def initialize_form_inputfield_copyaction(input)
130
+ action = input.add_action(QIcon.from_theme(QIcon::ThemeIcon::EditCopy), QLineEdit::LeadingPosition)
131
+ action.triggered.connect(self, :_on_copy_action_triggered)
132
+ end
134
133
 
135
- def initialize_form_inputfield_viewaction(input)
136
- action = input.add_action(QIcon.from_theme(QIcon::ThemeIcon::DocumentPrintPreview), QLineEdit::TrailingPosition)
137
- action.triggered.connect(self, :_on_view_action_triggered)
138
- end
134
+ def initialize_form_inputfield_viewaction(input)
135
+ action = input.add_action(QIcon.from_theme(QIcon::ThemeIcon::DocumentPrintPreview), QLineEdit::TrailingPosition)
136
+ action.triggered.connect(self, :_on_view_action_triggered)
137
+ end
139
138
 
140
- def initialize_infoframe
141
- @infolabel = QLabel.new
142
- @infoframe = QWidget.new
143
- infoframelayout = QVBoxLayout.new(@infoframe)
144
- infoframelayout.add_widget(@infolabel)
145
- infoframelayout.add_stretch
146
- end
139
+ def initialize_infoframe
140
+ @infolabel = QLabel.new
141
+ @infoframe = QWidget.new
142
+ infoframelayout = QVBoxLayout.new(@infoframe)
143
+ infoframelayout.add_widget(@infolabel)
144
+ infoframelayout.add_stretch
145
+ end
147
146
 
148
- def use_form(formdata)
149
- @passnameinput.set_text(@passname)
150
- @passwordinput.set_text(formdata["password"])
151
- @passwordinput.set_echo_mode(QLineEdit::Password)
147
+ def use_form(formdata)
148
+ @passnameinput.set_text(@passname)
149
+ @passwordinput.set_text(formdata["password"])
150
+ @passwordinput.set_echo_mode(QLineEdit::Password)
152
151
 
153
- @usernameinput.set_text(formdata["username"])
154
- @websiteinput.set_text(formdata["website"])
155
- @stackedlayout.set_current_widget(@form)
156
- end
152
+ @usernameinput.set_text(formdata["username"])
153
+ @websiteinput.set_text(formdata["website"])
154
+ @stackedlayout.set_current_widget(@form)
155
+ end
157
156
 
158
- def use_otpform(formdata)
159
- @otppassnameinput.set_text(@passname)
160
- @otppasswordinput.set_text(formdata["password"])
161
- @otppasswordinput.set_cursor_position(0)
162
- @otppasswordinput.set_echo_mode(QLineEdit::Password)
157
+ def use_otpform(formdata)
158
+ @otppassnameinput.set_text(@passname)
159
+ @otppasswordinput.set_text(formdata["password"])
160
+ @otppasswordinput.set_cursor_position(0)
161
+ @otppasswordinput.set_echo_mode(QLineEdit::Password)
163
162
 
164
- @otpcodeinput.set_text("")
165
- @stackedlayout.set_current_widget(@otpform)
163
+ @otpcodeinput.set_text("")
164
+ @stackedlayout.set_current_widget(@otpform)
166
165
 
167
- Pass.otp(@store, @passname, on_success: ->(data) {
168
- otpcode = data["stdout"].rstrip
169
- @otpcodeinput.set_text(otpcode)
170
- }, on_failure: ->(_) {})
171
- end
166
+ Pass.otp(@store, @passname, on_success: ->(data) {
167
+ otpcode = data["stdout"].rstrip
168
+ @otpcodeinput.set_text(otpcode)
169
+ }, on_failure: ->(_) {})
170
+ end
172
171
 
173
- def use_folderform
174
- @folderpassnameinput.set_text(@passname)
175
- @stackedlayout.set_current_widget(@folderform)
176
- end
172
+ def use_folderform
173
+ @folderpassnameinput.set_text(@passname)
174
+ @stackedlayout.set_current_widget(@folderform)
175
+ end
177
176
 
178
- def use_infoframe(info = "")
179
- @infolabel.set_style_sheet("color: black;")
180
- @infolabel.set_text(info)
181
- @stackedlayout.set_current_widget(@infoframe)
182
- end
177
+ def use_infoframe(info = "")
178
+ @infolabel.set_style_sheet("color: black;")
179
+ @infolabel.set_text(info)
180
+ @stackedlayout.set_current_widget(@infoframe)
181
+ end
183
182
 
184
- def use_infoframe_err(info)
185
- @infolabel.set_style_sheet("color: red;")
186
- @infolabel.set_text(info)
187
- @stackedlayout.set_current_widget(@infoframe)
188
- end
183
+ def use_infoframe_err(info)
184
+ @infolabel.set_style_sheet("color: red;")
185
+ @infolabel.set_text(info)
186
+ @stackedlayout.set_current_widget(@infoframe)
187
+ end
189
188
 
190
- def h_parse_passfile(data)
191
- lines = data["stdout"].lines
192
- password = lines[0][..-2]
189
+ def h_parse_passfile(data)
190
+ lines = data["stdout"].lines
191
+ password = lines[0][..-2]
193
192
 
194
- username = ""
195
- website = ""
196
- lines.each do |line|
197
- matched = line.match(/\A(\w+:\s*)?(.*)\n/)
198
- next if matched.nil?
193
+ username = ""
194
+ website = ""
195
+ lines.each do |line|
196
+ matched = line.match(/\A(\w+:\s*)?(.*)\n/)
197
+ next if matched.nil?
199
198
 
200
- case matched[1]&.rstrip&.downcase
201
- when "username:" then username = matched[2]
202
- when "website:" then website = matched[2]
203
- end
199
+ case matched[1]&.rstrip&.downcase
200
+ when "username:" then username = matched[2]
201
+ when "website:" then website = matched[2]
204
202
  end
205
-
206
- {
207
- "password" => password,
208
- "username" => username,
209
- "website" => website
210
- }
211
203
  end
212
204
 
213
- def _on_copy_action_triggered
214
- input = sender.parent
215
- QApplication.clipboard.set_text(input.text)
216
- end
205
+ {
206
+ "password" => password,
207
+ "username" => username,
208
+ "website" => website
209
+ }
210
+ end
217
211
 
218
- def _on_copy_action_triggered_otpcode
219
- Pass.otp(@store, @passname, on_success: ->(data) {
220
- otpcode = data["stdout"].rstrip
221
- @otpcodeinput.set_text(otpcode)
222
- QApplication.clipboard.set_text(otpcode)
223
- }, on_failure: ->(_) {})
224
- end
212
+ def _on_copy_action_triggered
213
+ input = sender.parent
214
+ QApplication.clipboard.set_text(input.text)
215
+ end
225
216
 
226
- def _on_view_action_triggered
227
- input = sender.parent
228
- case input.echo_mode
229
- when QLineEdit::Normal then input.set_echo_mode(QLineEdit::Password)
230
- when QLineEdit::Password then input.set_echo_mode(QLineEdit::Normal)
231
- else raise "unreachable!"
232
- end
217
+ def _on_copy_action_triggered_otpcode
218
+ Pass.otp(@store, @passname, on_success: ->(data) {
219
+ otpcode = data["stdout"].rstrip
220
+ @otpcodeinput.set_text(otpcode)
221
+ QApplication.clipboard.set_text(otpcode)
222
+ }, on_failure: ->(_) {})
223
+ end
224
+
225
+ def _on_view_action_triggered
226
+ input = sender.parent
227
+ case input.echo_mode
228
+ when QLineEdit::Normal then input.set_echo_mode(QLineEdit::Password)
229
+ when QLineEdit::Password then input.set_echo_mode(QLineEdit::Normal)
230
+ else raise "unreachable!"
233
231
  end
234
232
  end
235
233
  end