Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5,482 changes: 5,482 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "onekeepass-frontend",
"version": "0.21.0",
"version": "0.22.1",
"private": true,
"devDependencies": {
"@fontsource/roboto": "^4.5.7",
Expand Down
1 change: 1 addition & 0 deletions src-cljs/main/onekeepass/frontend/constants.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
(def BROWSER_CONNECTION_REQUEST_EVENT "BrowserConnectionRequestEvent")
(def PASSKEY_DATA_CHANGED_EVENT "PasskeyDataChangedEvent")
(def DB_FILE_CHANGED_EVENT "DbFileChangedEvent")
(def SSH_AGENT_KEYS_LOADED_EVENT "SshAgentKeysLoadedEvent")

(def WINDOW_FOCUS_CHANGED "WindowFocusChanged")
(def CLOSE_REQUESTED "CloseRequested")
Expand Down
44 changes: 29 additions & 15 deletions src-cljs/main/onekeepass/frontend/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
[onekeepass.frontend.events.check-for-updates :as check-updates-events]
[onekeepass.frontend.events.tauri-events :as tauri-events]
[onekeepass.frontend.mui-components :as m :refer [custom-theme-atom
mui-backdrop
mui-box
mui-button
mui-circular-progress
mui-css-baseline
mui-icon-button
mui-icon-fingerprint
Expand All @@ -27,6 +29,7 @@
mui-typography
split-pane
theme-color]]
[onekeepass.frontend.events.tool-bar :as tb-events]
[onekeepass.frontend.start-page :as sp]
[onekeepass.frontend.tool-bar :as tool-bar]
[onekeepass.frontend.translation :as t :refer-macros [tr-t tr-bl]]
Expand Down Expand Up @@ -253,28 +256,39 @@
;; message-sanckbar-alert mostly for error notification
[cc/message-sanckbar-alert]])

(defn closing-overlay
"Full-screen spinner shown while the app is removing SSH keys and closing databases on quit."
[]
(let [quitting? @(re-frame.core/subscribe [:app/quitting])]
[mui-backdrop {:open (boolean quitting?)
:sx {:z-index 9999 :color "#fff" :flex-direction "column" :gap 2}}
[mui-circular-progress {:color "inherit" :size 56}]
[mui-typography {:variant "h6" :color "inherit"} "Closing…"]]))

(defn root-content
"A functional component which is the root of all the app components"
[]
(fn []
(if @(cmn-events/show-start-page)
[:<>
[sp/welcome-content]
[common-snackbars]]
[:div {:class "box" :dir (t/dir)} ;;:style {:height "100vh"}
[:div {:class "cust_row header"}
[header-bar]
[:<>
[closing-overlay]
(if @(cmn-events/show-start-page)
[:<>
[sp/welcome-content]
[common-snackbars]]
[:div {:class "box" :dir (t/dir)} ;;:style {:height "100vh"}
[:div {:class "cust_row header"}
[header-bar]
[common-snackbars]]

[:div {:class "cust_row content"
:style {:height "80%"}} ;;height "80%" added for WebKit
[:f> main-content]]
[:div {:class "cust_row content"
:style {:height "80%"}} ;;height "80%" added for WebKit
[:f> main-content]]

;;At this time, no use case for the footer
#_[:div {:class "cust_row footer"}
#_[:span "footer (fixed height)"]
;;need to make tag p's margin 0px if we use tag p. Include {:style {:margin 0}}
[:p "footer (fixed height)"]]])))
;;At this time, no use case for the footer
#_[:div {:class "cust_row footer"}
#_[:span "footer (fixed height)"]
;;need to make tag p's margin 0px if we use tag p. Include {:style {:margin 0}}
[:p "footer (fixed height)"]]])])))


(defn main-app-with-theme
Expand Down
15 changes: 13 additions & 2 deletions src-cljs/main/onekeepass/frontend/events/tauri_events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[onekeepass.frontend.background :as bg]
[onekeepass.frontend.constants :as const :refer
[BROWSER_CONNECTION_REQUEST_EVENT CLOSE_REQUESTED DB_FILE_CHANGED_EVENT FILE_DROP MAIN_WINDOW_EVENT
MENU_ID_ABOUT OTP_TOKEN_UPDATE_EVENT PASSKEY_DATA_CHANGED_EVENT TAURI_MENU_EVENT WINDOW_FOCUS_CHANGED]]
MENU_ID_ABOUT OTP_TOKEN_UPDATE_EVENT PASSKEY_DATA_CHANGED_EVENT SSH_AGENT_KEYS_LOADED_EVENT TAURI_MENU_EVENT WINDOW_FOCUS_CHANGED]]
[re-frame.core :refer [dispatch]]))

(defn- to-cljs [js-event-repsonse]
Expand Down Expand Up @@ -187,13 +187,24 @@
[]
(bg/register-event-listener DB_FILE_CHANGED_EVENT handle-db-file-changed-event))

(defn- handle-ssh-agent-keys-loaded [js-event]
(let [cnt (-> js-event .-payload .-count)]
(when (and cnt (> cnt 0))
(js/setTimeout
#(dispatch [:common/message-snackbar-open (str cnt " SSH key(s) loaded into agent")])
2000))))

(defn- register-ssh-agent-keys-loaded-event []
(bg/register-event-listener SSH_AGENT_KEYS_LOADED_EVENT handle-ssh-agent-keys-loaded))

(defn register-tauri-events []
(register-menu-events)
(register-main-window-events)
(register-otp-token-update-events)
(register-browser-connection-request-event)
(register-passkey-data-changed-event)
(register-db-file-changed-event))
(register-db-file-changed-event)
(register-ssh-agent-keys-loaded-event))

(defn enable-app-menu [menu-id enable? & {:as menu-args}]
;; (println "Going to call for menu-id " menu-id enable? menu-args)
Expand Down
18 changes: 16 additions & 2 deletions src-cljs/main/onekeepass/frontend/events/tool_bar.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,25 @@
{:db (-> db (assoc-in [:ask-save :status] :completed))
:fx [[:bg-quit-app-menu-action-requested]]}))

(reg-event-db
:app/quitting-started
(fn [db [_event-id]]
(assoc db :app/quitting true)))

(reg-sub
:app/quitting
(fn [db _]
(get db :app/quitting false)))

(reg-fx
:bg-quit-app-menu-action-requested
(fn []
;; See menu-id and other info in 'tauri_events.cljs'
(bg/menu-action-requested "Quit" "Close" #(println %))))
;; Show the closing overlay first, then yield to React so it can render
;; before the blocking Rust quit handler removes keys and exits.
(re-frame.core/dispatch [:app/quitting-started])
(js/setTimeout
#(bg/menu-action-requested "Quit" "Close" (fn [_]))
50)))

(reg-event-db
:ask-save-dialog-save-error
Expand Down
14 changes: 7 additions & 7 deletions src-cljs/shadow-cljs.edn
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
:asset-path "/cljs-out/dev"
:js-options {:js-package-dirs ["../node_modules"]}
:devtools {:after-load onekeepass.frontend.core/start}
:release {:compiler-options {:optimizations :advanced}}}

;; Here is some production config
;; :optimizations :simple
;; :optimizations :advanced
;; :release {:compiler-options {:optimizations :advanced
;; :pretty-print true
;; :pseudo-names true}}
}}}
:release
{:target :browser
:modules {:main {:init-fn onekeepass.frontend.core/init}}
:output-dir "../resources/public/cljs-out/dev"
:asset-path "/cljs-out/dev"
:js-options {:js-package-dirs ["../node_modules"]}}}}
5 changes: 4 additions & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 17 additions & 3 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ tipsy = "0.7.0"
futures-util = "0.3"
data-encoding = "2.9.0"
crypto_box = "0.9.1"
russh-keys = "0.49.2"
# Used to parse PuTTY PPK key format; bridges to russh-keys via OpenSSH PEM roundtrip
ssh-key-ppk = { package = "internal-russh-forked-ssh-key", version = "0.6", features = ["ppk"] }


## Adding "devtools" to features list enables devtools in production; But in mac it uses private api
Expand All @@ -45,10 +48,10 @@ crypto_box = "0.9.1"
tauri = { version = "2", features = [] }

## using from the local crate during development
# onekeepass-core = {path = "../../onekeepass-core", version = "0.22.0", features = ["favicon"] }
onekeepass-core = {path = "../onekeepass-core", features = ["favicon"] }

## Need to use the git ref for release
onekeepass-core = {git = "https://github.com/OneKeePass/onekeepass-core.git" , tag="v0.22.0", features = ["favicon"] }
# onekeepass-core = {git = "https://github.com/OneKeePass/onekeepass-core.git" , tag="v0.22.0", features = ["favicon"] }

tauri-plugin-shell = "2"
tauri-plugin-process = "2"
Expand All @@ -72,7 +75,14 @@ swift-rs = { version = "1.0.7", features = ["build"] }
tauri-plugin-global-shortcut = "2"

[target."cfg(target_os = \"windows\")".dependencies]
winreg = "0.55.0"
winreg = "0.55.0"
pageant = "0.0.3"
windows = { version = "0.58", features = [
"Win32_Foundation",
"Win32_System_Memory",
"Win32_System_DataExchange",
"Win32_UI_WindowsAndMessaging",
] }

[features]
default = ["custom-protocol"]
Expand All @@ -87,5 +97,9 @@ onekeepass-dev = []
# from the store build script wrapper.
mas-build = []

[profile.release]
strip = false


[dev-dependencies]
env_logger = "0.11.8"
Loading