Skip to content

Commit

Permalink
Merge pull request #193 from quexten/feature/resource-file
Browse files Browse the repository at this point in the history
Move commands to resource.json
  • Loading branch information
quexten authored May 3, 2024
2 parents 5ec0be0 + d960c8f commit c56fbb2
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 8 deletions.
5 changes: 4 additions & 1 deletion gui/src/gui/browserbiometrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from gi.repository import Gtk, Adw, GLib, Gdk, Gio
from ..services import goldwarden
from threading import Thread
from .template_loader import load_template
from .resource_loader import load_template, load_json
import subprocess
from . import components
import os
Expand All @@ -26,6 +26,9 @@ def load(self):
builder = load_template("browserbiometrics.ui")
self.window = builder.get_object("window")
self.window.set_application(self)
commands = load_json("commands")
self.setup_command_row = builder.get_object("setup_command_row")
self.setup_command_row.set_subtitle(commands["browserbiometric-setup"])

if __name__ == "__main__":
app = GoldwardenBrowserBiometricsSetupGuideApp(application_id="com.quexten.Goldwarden.browserbiometrics")
Expand Down
2 changes: 1 addition & 1 deletion gui/src/gui/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import time
from gi.repository import Gtk, Adw, GLib, Notify, Gdk
from threading import Thread
from .template_loader import load_template
from .resource_loader import load_template
import sys
import os
from ..services import goldwarden
Expand Down
2 changes: 1 addition & 1 deletion gui/src/gui/pinentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import time
from gi.repository import Gtk, Adw, GLib, Notify, Gdk
from threading import Thread
from .template_loader import load_template
from .resource_loader import load_template
import sys
import os

Expand Down
2 changes: 1 addition & 1 deletion gui/src/gui/pinentry_approval.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import time
from gi.repository import Gtk, Adw, GLib, Notify, Gdk
from threading import Thread
from .template_loader import load_template
from .resource_loader import load_template
import sys
import os

Expand Down
2 changes: 1 addition & 1 deletion gui/src/gui/quickaccess.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from gi.repository import Gtk, Adw, GLib, Notify, Gdk
from ..services import goldwarden
from threading import Thread
from .template_loader import load_template
from .resource_loader import load_template
import sys
import os
from ..services import totp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
from gi.repository import Gtk
import json

isflatpak = os.path.exists("/.flatpak-info")
pathprefix = "/app/bin/src/gui/" if isflatpak else "./src/gui/"
Expand All @@ -8,3 +9,8 @@ def load_template(path):
builder = Gtk.Builder()
builder.add_from_file(pathprefix + ".templates/" + path)
return builder

def load_json(name):
with open(pathprefix + "resources/" + name + ".json", "r") as f:
result = json.load(f)
return result
5 changes: 5 additions & 0 deletions gui/src/gui/resources/commands.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"browserbiometric-setup": "flatpak run --filesystem=home --command=goldwarden com.quexten.Goldwarden setup browserbiometrics",
"add-ssh-key": "flatpak run --command=goldwarden com.quexten.Goldwarden ssh add --name MY_KEY_NAME",
"ssh-socket-path": "export SSH_AUTH_SOCK=/home/$USER/.var/app/com.quexten.Goldwarden/data/ssh-auth-sock"
}
2 changes: 1 addition & 1 deletion gui/src/gui/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from gi.repository import Gtk, Adw, GLib, Gdk, Gio
from ..services import goldwarden
from threading import Thread
from .template_loader import load_template
from .resource_loader import load_template
import subprocess
import os

Expand Down
2 changes: 1 addition & 1 deletion gui/src/gui/shortcuts.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from gi.repository import Gtk, Adw, GLib, Gdk, Gio
from ..services import goldwarden
from threading import Thread
from .template_loader import load_template
from .resource_loader import load_template
import subprocess
from . import components
import os
Expand Down
7 changes: 6 additions & 1 deletion gui/src/gui/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from gi.repository import Gtk, Adw, GLib, Gdk, Gio
from ..services import goldwarden
from threading import Thread
from .template_loader import load_template
from .resource_loader import load_template, load_json
import subprocess
from . import components
import os
Expand All @@ -26,6 +26,11 @@ def load(self):
builder = load_template("ssh.ui")
self.window = builder.get_object("window")
self.window.set_application(self)
commands = load_json("commands")
self.add_ssh_key_row = builder.get_object("add_ssh_key_row")
self.add_ssh_key_row.set_subtitle(commands["add-ssh-key"])
self.ssh_socket_path_row = builder.get_object("ssh_socket_path_row")
self.ssh_socket_path_row.set_subtitle(commands["ssh-socket-path"])

if __name__ == "__main__":
app = GoldwardenSSHSetupGuideApp(application_id="com.quexten.Goldwarden.sshsetup")
Expand Down

0 comments on commit c56fbb2

Please sign in to comment.