Merge pull request #193 from quexten/feature/resource-file
Move commands to resource.json
This commit is contained in:
commit
c56fbb2dd3
|
@ -8,7 +8,7 @@ gi.require_version('Adw', '1')
|
|||
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
|
||||
|
@ -26,6 +26,9 @@ class GoldwardenBrowserBiometricsSetupGuideApp(Adw.Application):
|
|||
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")
|
||||
|
|
|
@ -5,7 +5,7 @@ import gc
|
|||
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
|
||||
|
|
|
@ -5,7 +5,7 @@ import gc
|
|||
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
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import gc
|
|||
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
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import time
|
|||
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
|
||||
|
|
|
@ -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/"
|
||||
|
@ -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
|
|
@ -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"
|
||||
}
|
|
@ -8,7 +8,7 @@ gi.require_version('Adw', '1')
|
|||
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
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ gi.require_version('Adw', '1')
|
|||
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
|
||||
|
|
|
@ -8,7 +8,7 @@ gi.require_version('Adw', '1')
|
|||
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
|
||||
|
@ -26,6 +26,11 @@ class GoldwardenSSHSetupGuideApp(Adw.Application):
|
|||
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")
|
||||
|
|
Loading…
Reference in New Issue