瀏覽代碼

electron: disable github

Tienson Qin 4 年之前
父節點
當前提交
190837ab07
共有 3 個文件被更改,包括 27 次插入23 次删除
  1. 1 1
      src/main/frontend/components/repo.cljs
  2. 19 19
      src/main/frontend/components/widgets.cljs
  3. 7 3
      src/main/frontend/fs.cljs

+ 1 - 1
src/main/frontend/components/repo.cljs

@@ -45,7 +45,7 @@
               (ui/button
                (t :open-a-directory)
                :on-click nfs-handler/ls-dir-files)])
-           (when (state/logged?)
+           (when (and (state/logged?) (not (util/electron?)))
              (ui/button
               "Add another git repo"
               :href (rfe/href :repo-add nil {:graph-types "github"})))]

+ 19 - 19
src/main/frontend/components/widgets.cljs

@@ -59,24 +59,24 @@
                           (reset! branch (util/evalue e)))}]]]]
 
         (ui/button
-          (t :git/add-repo-prompt-confirm)
-          :on-click
-          (fn []
-            (let [branch (string/trim @branch)]
-              (if (string/blank? branch)
-                (notification/show!
-                 [:p.text-gray-700.dark:text-gray-300 "Please input a branch, make sure it's matched with your setting on Github."]
-                 :error
-                 false)
-                (let [repo (util/lowercase-first @repo)]
-                  (if (util/starts-with? repo "https://github.com/")
-                    (let [repo (string/replace repo ".git" "")]
-                      (repo-handler/create-repo! repo branch))
+         (t :git/add-repo-prompt-confirm)
+         :on-click
+         (fn []
+           (let [branch (string/trim @branch)]
+             (if (string/blank? branch)
+               (notification/show!
+                [:p.text-gray-700.dark:text-gray-300 "Please input a branch, make sure it's matched with your setting on Github."]
+                :error
+                false)
+               (let [repo (util/lowercase-first @repo)]
+                 (if (util/starts-with? repo "https://github.com/")
+                   (let [repo (string/replace repo ".git" "")]
+                     (repo-handler/create-repo! repo branch))
 
-                    (notification/show!
-                     [:p.text-gray-700.dark:text-gray-300 "Please input a valid repo url, e.g. https://github.com/username/repo"]
-                     :error
-                     false)))))))]])))
+                   (notification/show!
+                    [:p.text-gray-700.dark:text-gray-300 "Please input a valid repo url, e.g. https://github.com/username/repo"]
+                    :error
+                    false)))))))]])))
 
 (rum/defcs add-local-directory
   []
@@ -109,9 +109,9 @@
         generate-f (fn [x]
                      (case x
                        :github
-                       (when github-authed?
+                       (when (and github-authed? (not (util/electron?)))
                          (rum/with-key (add-github-repo)
-                                       "add-github-repo"))
+                           "add-github-repo"))
 
                        :local
                        (rum/with-key (add-local-directory)

+ 7 - 3
src/main/frontend/fs.cljs

@@ -8,7 +8,8 @@
             [frontend.fs.nfs :as nfs]
             [frontend.fs.bfs :as bfs]
             [frontend.fs.node :as node]
-            [cljs-bean.core :as bean]))
+            [cljs-bean.core :as bean]
+            [frontend.state :as state]))
 
 (defonce nfs-record (nfs/->Nfs))
 (defonce bfs-record (bfs/->Bfs))
@@ -22,9 +23,12 @@
 (defn get-fs
   [dir]
   (let [bfs-local? (or (string/starts-with? dir "/local")
-                       (string/starts-with? dir "local"))]
+                       (string/starts-with? dir "local"))
+        current-repo (state/get-current-repo)
+        git-repo? (and current-repo
+                       (string/starts-with? current-repo "https://"))]
     (cond
-      (and (util/electron?) (not bfs-local?))
+      (and (util/electron?) (not bfs-local?) (not git-repo?))
       node-record
 
       (local-db? dir)