Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into chore/desktop-rel…
Browse files Browse the repository at this point in the history
…ease-ci
  • Loading branch information
defclass committed Feb 1, 2021
2 parents 417d481 + 67a1aba commit 6bc96e2
Show file tree
Hide file tree
Showing 12 changed files with 77 additions and 61 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build-desktop-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jobs:
- name: Build/release Electron app
run: yarn install && yarn release-electron

- name: clean build
if: matrix.os == 'macos-latest'
run: |
Expand Down
12 changes: 4 additions & 8 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,24 @@
org.clojure/core.async {:mvn/version "1.3.610"}
thheller/shadow-cljs {:mvn/version "2.11.14"}
expound/expound {:mvn/version "0.8.6"}
lambdaisland/glogi {:mvn/version "1.0.74"}}
lambdaisland/glogi {:mvn/version "1.0.74"}
binaryage/devtools {:mvn/version "1.0.2"}}

:aliases {:cljs {:extra-paths ["src/dev-cljs/" "src/test/" "src/electron/"]
:extra-deps {org.clojure/clojurescript {:mvn/version "1.10.764"}
binaryage/devtools {:mvn/version "1.0.2"}
org.clojure/tools.namespace {:mvn/version "0.2.11"}
cider/cider-nrepl {:mvn/version "0.25.5"}}
:main-opts ["-m" "shadow.cljs.devtools.cli"]}
:test
{:extra-paths ["src/test/"]
:extra-deps {
org.clojure/clojurescript {:mvn/version "1.10.764"}
:extra-deps {org.clojure/clojurescript {:mvn/version "1.10.764"}
org.clojure/test.check {:mvn/version "RELEASE"}}
:main-opts ["-m" "shadow.cljs.devtools.cli"]}

:test-clj
{:extra-paths ["src/test/"]
:extra-deps
{
com.cognitect/test-runner
{com.cognitect/test-runner
{:git/url "https://github.com/cognitect-labs/test-runner",
:sha "76568540e7f40268ad2b646110f237a60295fa3c"}},
:main-opts ["-m" "cognitect.test-runner" "-d" "src/test"]}}}


2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"cljs:watch": "clojure -M:cljs watch app publishing electron",
"cljs:electron-watch": "clojure -M:cljs watch app electron",
"cljs:release": "clojure -M:cljs release app publishing electron",
"cljs:electron-release": "clojure -M:cljs release app --config-merge '{:asset-path \"./js\" :release {:asset-path \"./js\"}}' publishing electron",
"cljs:electron-release": "clojure -M:cljs release app publishing electron --config-merge '{:asset-path \"./js\"}'",
"cljs:test": "clojure -A:test compile test",
"cljs:run-test": "node static/tests.js",
"cljs:watch-app": "clojure -M:cljs watch app",
Expand Down
12 changes: 12 additions & 0 deletions resources/entitlements.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.debugger</key>
<true/>
</dict>
</plist>
9 changes: 8 additions & 1 deletion resources/forge.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ const path = require('path')

module.exports = {
packagerConfig: {
icon: './icons/logseq_big_sur.icns'
icon: './icons/logseq_big_sur.icns',
osxSign: {
identity: 'Developer ID Application: Tiansheng Qin',
'hardened-runtime': true,
entitlements: 'entitlements.plist',
'entitlements-inherit': 'entitlements.plist',
'signature-flags': 'library'
}
},

makers: [
Expand Down
63 changes: 32 additions & 31 deletions src/main/frontend/components/block.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
[lambdaisland.glogi :as log]
[frontend.context.i18n :as i18n]))

;; TODO: remove rum/with-context because it'll make reactive queries not working

(defn safe-read-string
([s]
(safe-read-string s true))
Expand Down Expand Up @@ -468,36 +470,35 @@
(util/format "{{{%s}}}" name)))

(declare block-content)
(defn block-reference
(rum/defc block-reference < rum/reactive
[config id]
(rum/with-context [[t] i18n/*tongue-context*]
(when-not (string/blank? id)
(let [block (and (util/uuid-string? id)
(db/pull-block (uuid id)))]
(if block
[:span
[:div.block-ref-wrap
{:on-click (fn [e]
(util/stop e)
(if (gobj/get e "shiftKey")
(state/sidebar-add-block!
(state/get-current-repo)
(:db/id block)
:block-ref
{:block block})
(route-handler/redirect! {:to :page
:path-params {:name id}})))}

(let [title (:block/title block)]
(if (empty? title)
;; display the content
[:div.block-ref
(block-content config block nil (:block/uuid block) (:slide? config))]
(->elem
:span.block-ref
(map-inline config title))))]]
[:span.warning.mr-1 {:title "Block ref invalid"}
(util/format "((%s))" id)])))))
(when-not (string/blank? id)
(let [block (and (util/uuid-string? id)
(db/pull-block (uuid id)))]
(if block
[:span
[:div.block-ref-wrap
{:on-click (fn [e]
(util/stop e)
(if (gobj/get e "shiftKey")
(state/sidebar-add-block!
(state/get-current-repo)
(:db/id block)
:block-ref
{:block block})
(route-handler/redirect! {:to :page
:path-params {:name id}})))}

(let [title (:block/title block)]
(if (empty? title)
;; display the content
[:div.block-ref
(block-content config block nil (:block/uuid block) (:slide? config))]
(->elem
:span.block-ref
(map-inline config title))))]]
[:span.warning.mr-1 {:title "Block ref invalid"}
(util/format "((%s))" id)]))))

(defn inline-text
[format v]
Expand Down Expand Up @@ -563,15 +564,15 @@
(if (and s (util/tag-valid? s))
[:a.tag {:href (rfe/href :page {:name s})
:on-click (fn [e]
(.preventDefault e)
(let [repo (state/get-current-repo)
page (db/pull repo '[*] [:page/name (string/lower-case (util/url-decode s))])]
(when (gobj/get e "shiftKey")
(state/sidebar-add-block!
repo
(:db/id page)
:page
{:page page}))))}
{:page page})
(.preventDefault e))))}
(str "#" s)]
[:span.warning.mr-1 {:title "Invalid tag, tags only accept alphanumeric characters, \"-\", \"_\", \"@\" and \"%\"."}
(str "#" s)])
Expand Down
10 changes: 5 additions & 5 deletions src/main/frontend/components/header.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,12 @@

(if config/publishing?
[:a.text-sm.font-medium.ml-3 {:href (rfe/href :graph)}
(t :graph)]
(t :graph)])

(dropdown-menu {:me me
:t t
:current-repo current-repo
:default-home default-home}))
(dropdown-menu {:me me
:t t
:current-repo current-repo
:default-home default-home})

[:a#download-as-html.hidden]
[:a#download-as-zip.hidden]])))
3 changes: 2 additions & 1 deletion src/main/frontend/components/journal.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
(:db/id page)
:page
{:page page
:journal? true}))))}
:journal? true}))
(.preventDefault e)))}
[:h1.title
(util/capitalize-all title)]]

Expand Down
4 changes: 2 additions & 2 deletions src/main/frontend/components/right_sidebar.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@
[:a.mb-1 {:key (str "recent-page-" page)
:href (rfe/href :page {:name page})
:on-click (fn [e]
(.preventDefault e)
(when (gobj/get e "shiftKey")
(when-let [page (db/pull [:page/name (string/lower-case page)])]
(state/sidebar-add-block!
(state/get-current-repo)
(:db/id page)
:page
{:page page}))))}
{:page page}))
(.preventDefault e)))}
page]))]))

(rum/defc contents < rum/reactive db-mixins/query
Expand Down
15 changes: 9 additions & 6 deletions src/main/frontend/db/model.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,15 @@
[repo]
(when-let [conn (conn/get-conn repo)]
(->> (d/q
'[:find ?path ?modified-at
'[:find ?path
;; ?modified-at
:where
[?file :file/path ?path]
[?file :file/last-modified-at ?modified-at]]
;; [?file :file/last-modified-at ?modified-at]
]
conn)
(seq)
(sort-by last)
;; (sort-by last)
(reverse))))

(defn get-files-blocks
Expand Down Expand Up @@ -703,9 +705,10 @@
property-name (when (and (= "Properties" (ffirst ast))
(not (string/blank? (:title (last (first ast))))))
(:title (last (first ast))))
first-block-name (and first-block
;; FIXME:
(str (last (first (:title first-block)))))
first-block-name (let [title (last (first (:title first-block)))]
(and first-block
(string? title)
title))
file-name (when-let [file-name (last (string/split file #"/"))]
(when-let [file-name (first (util/split-last "." file-name))]
(-> file-name
Expand Down
5 changes: 1 addition & 4 deletions src/main/frontend/handler/repo.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,7 @@
(when (or (db/cloned? repo)
(and (config/local-db? repo)
;; config file exists
(let [path (config/get-config-path)
path (if (and (util/electron?) (config/local-db? repo))
(str (config/get-repo-dir repo) "/" path)
path)]
(let [path (config/get-config-path)]
(db/get-file path))))
(let [today-page (string/lower-case (date/today))]
(when (empty? (db/get-page-blocks-no-cache repo today-page))
Expand Down
2 changes: 1 addition & 1 deletion src/main/frontend/version.cljs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(ns frontend.version)

(defonce version "0.0.5.1-8")
(defonce version "0.0.5.3")

0 comments on commit 6bc96e2

Please sign in to comment.