Bladeren bron

enhance(rtc,e2ee): remove unused deprecated code

rcmerci 3 dagen geleden
bovenliggende
commit
48801299da

+ 1 - 2
deps/db/src/logseq/db/frontend/kv_entity.cljs

@@ -36,5 +36,4 @@ RTC won't start when major-schema-versions don't match"
 
      :logseq.kv/graph-text-embedding-model-name   {:doc "Graph's text-embedding model name"
                                                    :rtc {:rtc/ignore-entity-when-init-upload true
-                                                         :rtc/ignore-entity-when-init-download true}}
-     :logseq.kv/graph-rtc-encrypt-salt       {:doc "salt used for encrypting data during RTC."})))
+                                                         :rtc/ignore-entity-when-init-download true}})))

+ 16 - 41
src/main/frontend/components/repo.cljs

@@ -458,8 +458,6 @@
   (rum/local "" ::graph-name)
   (rum/local false ::cloud?)
   (rum/local false ::creating-db?)
-  (rum/local "" ::password)
-  (rum/local "" ::password-confirm)
   (rum/local (rum/create-ref) ::input-ref)
   {:did-mount (fn [s]
                 (when-let [^js input (some-> @(::input-ref s)
@@ -470,33 +468,28 @@
   (let [*creating-db? (::creating-db? state)
         *graph-name (::graph-name state)
         *cloud? (::cloud? state)
-        *password (::password state)
-        *password-confirm (::password-confirm state)
         input-ref @(::input-ref state)
         new-db-f (fn []
                    (when-not (or (string/blank? @*graph-name)
                                  @*creating-db?)
                      (if (invalid-graph-name? @*graph-name)
                        (invalid-graph-name-warning)
-                       (if (and (not (string/blank? @*password))
-                                (not= @*password @*password-confirm))
-                         (notification/show! [:p "Password and password confirmation do not match!"] :warning false)
-                         (do
-                           (reset! *creating-db? true)
-                           (p/let [repo (repo-handler/new-db! @*graph-name {:rtc-e2ee-password @*password})]
-                             (when @*cloud?
-                               (->
-                                (p/do
-                                  (state/set-state! :rtc/uploading? true)
-                                  (rtc-handler/<rtc-create-graph! repo)
-                                  (rtc-flows/trigger-rtc-start repo)
-                                  (rtc-handler/<get-remote-graphs))
-                                (p/catch (fn [error]
-                                           (log/error :create-db-failed error)))
-                                (p/finally (fn []
-                                             (state/set-state! :rtc/uploading? false)
-                                             (reset! *creating-db? false)))))
-                             (shui/dialog-close!)))))))
+                       (do
+                         (reset! *creating-db? true)
+                         (p/let [repo (repo-handler/new-db! @*graph-name)]
+                           (when @*cloud?
+                             (->
+                              (p/do
+                                (state/set-state! :rtc/uploading? true)
+                                (rtc-handler/<rtc-create-graph! repo)
+                                (rtc-flows/trigger-rtc-start repo)
+                                (rtc-handler/<get-remote-graphs))
+                              (p/catch (fn [error]
+                                         (log/error :create-db-failed error)))
+                              (p/finally (fn []
+                                           (state/set-state! :rtc/uploading? false)
+                                           (reset! *creating-db? false)))))
+                           (shui/dialog-close!))))))
         submit! (fn [^js e click?]
                   (when-let [value (and (or click? (= (gobj/get e "key") "Enter"))
                                         (util/trim-safe (.-value (rum/deref input-ref))))]
@@ -510,24 +503,6 @@
        :placeholder "your graph name"
        :on-key-down submit!
        :autoComplete "off"})
-     (when @*cloud?
-       [:div.flex.flex-col.gap-4
-        (shui/input
-         {:type "password"
-          :default-value @*password
-          :disabled @*creating-db?
-          :placeholder "password"
-          :on-change #(reset! *password %)
-          :on-key-down submit!
-          :autoComplete "new-password"})
-        (shui/input
-         {:type "password"
-          :default-value @*password-confirm
-          :disabled @*creating-db?
-          :placeholder "password confirm"
-          :on-change #(reset! *password-confirm %)
-          :on-key-down submit!
-          :autoComplete "new-password"})])
      (when (user-handler/rtc-group?)
        [:div.flex.flex-row.items-center.gap-1
         (shui/checkbox

+ 2 - 3
src/main/frontend/handler/repo.cljs

@@ -189,14 +189,13 @@
   (let [full-graph-name (string/lower-case (str config/db-version-prefix graph-name))]
     (some #(= (some-> (:url %) string/lower-case) full-graph-name) (state/get-repos))))
 
-(defn- create-db [full-graph-name {:keys [file-graph-import? rtc-e2ee-password]}]
+(defn- create-db [full-graph-name {:keys [file-graph-import?]}]
   (->
    (p/let [config (common-config/create-config-for-db-graph config/config-default-content)
            _ (persist-db/<new full-graph-name
                               (cond-> {:config config
                                        :graph-git-sha config/revision}
-                                file-graph-import? (assoc :import-type :file-graph)
-                                rtc-e2ee-password (assoc :rtc-e2ee-password rtc-e2ee-password)))
+                                file-graph-import? (assoc :import-type :file-graph)))
            _ (start-repo-db-if-not-exists! full-graph-name)
            _ (state/add-repo! {:url full-graph-name :root (config/get-local-dir full-graph-name)})
            _ (restore-and-setup-repo! full-graph-name)

+ 7 - 12
src/main/frontend/worker/db_worker.cljs

@@ -257,7 +257,7 @@
                                      :kv/value (common-util/time-ms)}]))))
 
 (defn- <create-or-open-db!
-  [repo {:keys [config datoms rtc-e2ee-password] :as opts}]
+  [repo {:keys [config datoms] :as opts}]
   (when-not (worker-state/get-sqlite-conn repo)
     (p/let [[db search-db client-ops-db :as dbs] (get-dbs repo)
             storage (new-sqlite-storage db)
@@ -294,17 +294,12 @@
                 initial-data (sqlite-create-graph/build-db-initial-data
                               config (select-keys opts [:import-type :graph-git-sha]))]
             (d/transact! conn initial-data {:initial-db? true})))
-        (p/let [rtc-e2ee-salt (rtc-encrypt/gen-salt)
-                _ (d/transact! conn [(ldb/kv :logseq.kv/graph-rtc-encrypt-salt rtc-e2ee-salt)])
-                _ (rtc-encrypt/<persist-encrypt-key! repo rtc-e2ee-salt rtc-e2ee-password)]
-          (gc-sqlite-dbs! db client-ops-db conn {})
-
-          (let [migration-result (db-migrate/migrate conn)]
-            (when (client-op/rtc-db-graph? repo)
-              (let [client-ops (rtc-migrate/migration-results=>client-ops migration-result)]
-                (client-op/add-ops! repo client-ops))))
-
-          (db-listener/listen-db-changes! repo (get @*datascript-conns repo)))))))
+        (gc-sqlite-dbs! db client-ops-db conn {})
+        (let [migration-result (db-migrate/migrate conn)]
+          (when (client-op/rtc-db-graph? repo)
+            (let [client-ops (rtc-migrate/migration-results=>client-ops migration-result)]
+              (client-op/add-ops! repo client-ops))))
+        (db-listener/listen-db-changes! repo (get @*datascript-conns repo))))))
 
 (defn- iter->vec [iter']
   (when iter'