Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
d844f1de04 | |||
96f7a83e1e | |||
34e297592a | |||
375feac8a0 | |||
101c833db2 | |||
bf053eda24 | |||
522436fdfb |
3
.tito/packages/.readme
Normal file
3
.tito/packages/.readme
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
the .tito/packages directory contains metadata files
|
||||||
|
named after their packages. Each file has the latest tagged
|
||||||
|
version and the project's relative directory.
|
1
.tito/packages/gnome-pass-search-provider
Normal file
1
.tito/packages/gnome-pass-search-provider
Normal file
@ -0,0 +1 @@
|
|||||||
|
1.3.2-1 ./
|
5
.tito/tito.props
Normal file
5
.tito/tito.props
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[buildconfig]
|
||||||
|
builder = tito.builder.Builder
|
||||||
|
tagger = tito.tagger.VersionTagger
|
||||||
|
changelog_do_not_remove_cherrypick = 0
|
||||||
|
changelog_format = %s (%ae)
|
@ -40,7 +40,7 @@ dnf install gnome-pass-search-provider
|
|||||||
|
|
||||||
## Manual
|
## Manual
|
||||||
|
|
||||||
Ensure that python>=3.7 as well as the dbus and gobject Python modules are installed. They should all be packaged under python-name or python3-name depending on your distribution.
|
Ensure that python>=3.7 as well as the dbus, gobject and thefuzz (formerly fuzzywuzzy, might still be packaged under that name in your distribution) Python modules are installed. They should all be packaged under python-name or python3-name depending on your distribution.
|
||||||
|
|
||||||
Clone this repository and run the installation script as root:
|
Clone this repository and run the installation script as root:
|
||||||
```
|
```
|
||||||
|
@ -32,6 +32,12 @@ from os.path import join as path_join
|
|||||||
import dbus.service
|
import dbus.service
|
||||||
from dbus.mainloop.glib import DBusGMainLoop
|
from dbus.mainloop.glib import DBusGMainLoop
|
||||||
|
|
||||||
|
try:
|
||||||
|
from thefuzz import fuzz
|
||||||
|
from thefuzz import process
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
from fuzzywuzzy import fuzz
|
||||||
|
from fuzzywuzzy import process
|
||||||
from gi.repository import GLib
|
from gi.repository import GLib
|
||||||
|
|
||||||
# Convenience shorthand for declaring dbus interface methods.
|
# Convenience shorthand for declaring dbus interface methods.
|
||||||
@ -110,7 +116,19 @@ class SearchPassService(dbus.service.Object):
|
|||||||
[self.password_executable, "list"], universal_newlines=True
|
[self.password_executable, "list"], universal_newlines=True
|
||||||
).split("\n")[:-1]
|
).split("\n")[:-1]
|
||||||
|
|
||||||
results = list(filter(lambda x: x.startswith(name), password_list))[:5]
|
results = list(filter(lambda p: p.startswith(name), password_list))[:5]
|
||||||
|
|
||||||
|
remaining = 5 - len(results)
|
||||||
|
|
||||||
|
if remaining > 0:
|
||||||
|
fuzzy_results = [
|
||||||
|
e[0]
|
||||||
|
for e in process.extract(
|
||||||
|
name, password_list, limit=remaining, scorer=fuzz.token_sort_ratio
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
|
results.extend(fuzzy_results)
|
||||||
|
|
||||||
if field is not None:
|
if field is not None:
|
||||||
results = [f":{field} {r}" for r in results]
|
results = [f":{field} {r}" for r in results]
|
||||||
@ -139,7 +157,28 @@ class SearchPassService(dbus.service.Object):
|
|||||||
path = path_join(dir_path, filename)[:-4]
|
path = path_join(dir_path, filename)[:-4]
|
||||||
password_list.append(path)
|
password_list.append(path)
|
||||||
|
|
||||||
results = list(filter(lambda x: x.startswith(name), password_list))[:5]
|
results = list(sorted(filter(lambda p: p.startswith(name), password_list)))[:5]
|
||||||
|
|
||||||
|
remaining = 5 - len(results)
|
||||||
|
|
||||||
|
if remaining > 0:
|
||||||
|
containing_results = list(
|
||||||
|
sorted(filter(lambda p: name in p, password_list))
|
||||||
|
)[:remaining]
|
||||||
|
|
||||||
|
results.extend(containing_results)
|
||||||
|
|
||||||
|
remaining = 5 - len(results)
|
||||||
|
|
||||||
|
if remaining > 0:
|
||||||
|
fuzzy_results = [
|
||||||
|
e[0]
|
||||||
|
for e in process.extract(
|
||||||
|
name, password_list, limit=remaining, scorer=fuzz.token_sort_ratio
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
|
results.extend(fuzzy_results)
|
||||||
|
|
||||||
if field == "otp":
|
if field == "otp":
|
||||||
results = [f"otp {r}" for r in results]
|
results = [f"otp {r}" for r in results]
|
||||||
@ -155,7 +194,9 @@ class SearchPassService(dbus.service.Object):
|
|||||||
if match:
|
if match:
|
||||||
value = match.group("value")
|
value = match.group("value")
|
||||||
else:
|
else:
|
||||||
raise RuntimeError(f"The field {field} was not found in the password entry.")
|
raise RuntimeError(
|
||||||
|
f"The field {field} was not found in the password entry."
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
value = output.split("\n", 1)[0]
|
value = output.split("\n", 1)[0]
|
||||||
return value
|
return value
|
||||||
@ -174,7 +215,9 @@ class SearchPassService(dbus.service.Object):
|
|||||||
|
|
||||||
def send_password_to_native_clipboard(self, base_args, name, field=None):
|
def send_password_to_native_clipboard(self, base_args, name, field=None):
|
||||||
if self.password_mode == "bw":
|
if self.password_mode == "bw":
|
||||||
output = subprocess.check_output(base_args + [name], universal_newlines=True)
|
output = subprocess.check_output(
|
||||||
|
base_args + [name], universal_newlines=True
|
||||||
|
)
|
||||||
value = self.get_value_from_output(output, field)
|
value = self.get_value_from_output(output, field)
|
||||||
p1 = subprocess.run(self.clipboard_executable, input=value, text=True)
|
p1 = subprocess.run(self.clipboard_executable, input=value, text=True)
|
||||||
if p1.returncode:
|
if p1.returncode:
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
Name: gnome-pass-search-provider
|
Name: gnome-pass-search-provider
|
||||||
Version: master
|
Version: 1.3.3
|
||||||
Release: 1
|
Release: %autorelease
|
||||||
License: GPL-3.0+
|
Summary: Gnome Shell search provider for zx2c4/pass
|
||||||
Summary: Gnome Shell search provider for zx2c4/pass
|
License: GPL-3.0+
|
||||||
Url: https://github.com/jle64/gnome-pass-search-provider
|
Url: https://git.dm1sh.ru/dm1sh/%{name}
|
||||||
Source: https://github.com/jle64/%{name}/archive/master.tar.gz
|
Source0: https://git.dm1sh.ru/dm1sh/%{name}/archive/%{version}.tar.gz
|
||||||
Requires: gnome-shell
|
Requires: gnome-shell
|
||||||
Requires: pass
|
Requires: (pass or gopass)
|
||||||
Requires: python3-gobject
|
Requires: python3-gobject
|
||||||
Requires: python3-dbus
|
Requires: python3-dbus
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
Requires: python3-fuzzywuzzy
|
||||||
|
Requires: python3-Levenshtein
|
||||||
%global debug_package %{nil}
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
A Gnome Shell passwords search provider for zx2c4/pass (passwordstore.org) or compatibles and Bitwarden/Vaultwarden that sends passwords to clipboard (or GPaste).
|
A Gnome Shell passwords search provider for zx2c4/pass (passwordstore.org) or compatibles and Bitwarden/Vaultwarden that sends passwords to clipboard (or GPaste).
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n %{name}-%{version}
|
%autosetup -n %{name}
|
||||||
|
|
||||||
|
%define debug_package %{nil}
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
|
||||||
@ -27,10 +27,13 @@ sed -i -e 's|LIBDIR=|LIBDIR=$RPM_BUILD_ROOT|' install.sh
|
|||||||
./install.sh
|
./install.sh
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr(-,root,root,-)
|
|
||||||
%doc README.md
|
%doc README.md
|
||||||
|
%license LICENSE
|
||||||
%{_prefix}/lib/gnome-pass-search-provider/gnome-pass-search-provider.py
|
%{_prefix}/lib/gnome-pass-search-provider/gnome-pass-search-provider.py
|
||||||
%{_prefix}/lib/systemd/user/org.gnome.Pass.SearchProvider.service
|
%{_prefix}/lib/systemd/user/org.gnome.Pass.SearchProvider.service
|
||||||
%{_prefix}/share/dbus-1/services/org.gnome.Pass.SearchProvider.service
|
%{_prefix}/share/dbus-1/services/org.gnome.Pass.SearchProvider.service
|
||||||
%{_prefix}/share/applications/org.gnome.Pass.SearchProvider.desktop
|
%{_prefix}/share/applications/org.gnome.Pass.SearchProvider.desktop
|
||||||
%{_prefix}/share/gnome-shell/search-providers/org.gnome.Pass.SearchProvider.ini
|
%{_prefix}/share/gnome-shell/search-providers/org.gnome.Pass.SearchProvider.ini
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
%autochangelog
|
||||||
|
Loading…
x
Reference in New Issue
Block a user