electron: disable github

pull/1179/head
Tienson Qin 2021-01-26 15:20:27 +08:00
parent 5c401f2bd3
commit 190837ab07
3 changed files with 27 additions and 23 deletions

View File

@ -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"})))]

View File

@ -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)

View File

@ -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)