Skip to content

Commit

Permalink
Merge branch 'logseq:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Bad3r authored Sep 11, 2023
2 parents d59b680 + 0cef911 commit c98f1a0
Show file tree
Hide file tree
Showing 39 changed files with 957 additions and 115 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "com.logseq.app"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 68
versionName "0.9.15"
versionCode 70
versionName "0.9.17"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
Expand Down
8 changes: 4 additions & 4 deletions ios/App/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 0.9.16;
MARKETING_VERSION = 0.9.17;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
PRODUCT_BUNDLE_IDENTIFIER = com.logseq.logseq;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -546,7 +546,7 @@
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 0.9.16;
MARKETING_VERSION = 0.9.17;
PRODUCT_BUNDLE_IDENTIFIER = com.logseq.logseq;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
Expand All @@ -571,7 +571,7 @@
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 0.9.16;
MARKETING_VERSION = 0.9.17;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.logseq.logseq.ShareViewController;
Expand All @@ -598,7 +598,7 @@
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 0.9.16;
MARKETING_VERSION = 0.9.17;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.logseq.logseq.ShareViewController;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
2 changes: 1 addition & 1 deletion libs/src/LSPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ export interface IEditorProxy extends Record<string, any> {
opts?: { replaceState: boolean }
) => void

openInRightSidebar: (uuid: BlockUUID) => void
openInRightSidebar: (id: BlockUUID | EntityID) => void

/**
* @example https://github.com/logseq/logseq-plugin-samples/tree/master/logseq-a-translator
Expand Down
2 changes: 1 addition & 1 deletion resources/forge.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = {
packagerConfig: {
name: 'Logseq',
icon: './icons/logseq_big_sur.icns',
buildVersion: 68,
buildVersion: 70,
protocols: [
{
"protocol": "logseq",
Expand Down
2 changes: 1 addition & 1 deletion resources/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Logseq",
"productName": "Logseq",
"version": "0.9.15",
"version": "0.9.17",
"main": "electron.js",
"author": "Logseq",
"license": "AGPL-3.0",
Expand Down
2 changes: 1 addition & 1 deletion scripts/get-pkg-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if (match) {
if (process.argv[2] === 'nightly' || process.argv[2] === '') {
const today = new Date()
console.log(
ver + '-nightly.' + today.toISOString().split('T')[0].replaceAll('-', '')
ver + '-alpha+nightly.' + today.toISOString().split('T')[0].replaceAll('-', '')
)
} else {
console.log(ver)
Expand Down
3 changes: 2 additions & 1 deletion scripts/src/logseq/tasks/lang.clj
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@
:search-item/whiteboard :settings-page/enable-flashcards :settings-page/enable-whiteboards
:settings-page/tab-editor :shortcut.category/whiteboard :whiteboard/medium
:whiteboard/twitter-url :whiteboard/youtube-url :right-side-bar/history-global}
:tr #{:help/awesome-logseq}})
:tr #{:help/awesome-logseq}
:id #{:host :port :on-boarding/section-app :right-side-bar/history-global}})

(defn- validate-languages-dont-have-duplicates
"Looks up duplicates for all languages"
Expand Down
19 changes: 1 addition & 18 deletions src/main/frontend/components/container.css
Original file line number Diff line number Diff line change
Expand Up @@ -683,14 +683,6 @@ html[data-theme='dark'] {
}
}

&:not(:hover) {
::-webkit-scrollbar-thumb,
::-webkit-scrollbar,
::-webkit-scrollbar-thumb:active {
background-color: transparent;
}
}

.initial {
flex: 1;
}
Expand All @@ -699,22 +691,13 @@ html[data-theme='dark'] {
@apply h-full;

.button {
@apply hidden p-0 ml-2 flex items-center;
@apply p-0 ml-2 flex items-center;

&:focus {
@apply flex;
}
}
}

.is-mobile &,
&:hover {
.item-actions {
.button {
@apply flex;
}
}
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/main/frontend/components/plugins.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,8 @@
(assoc opts :test (util/trim-safe (util/evalue %))))
:value (:test opts)}]
[:datalist#proxy-test-url-datalist
[:option "https://api.logseq.com/logseq/version"]
[:option "https://logseq-connectivity-testing-prod.s3.us-east-1.amazonaws.com/logseq-connectivity-testing"]
[:option "https://www.google.com"]
[:option "https://s3.amazonaws.com"]
[:option "https://clients3.google.com/generate_204"]]]
Expand Down
12 changes: 1 addition & 11 deletions src/main/frontend/components/settings.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -472,15 +472,6 @@
;; (let [value (not enable-block-timestamps?)]
;; (config-handler/set-config! :feature/enable-block-timestamps? value)))))

(rum/defc keyboard-shortcuts-row [t]
(row-with-button-action
{:left-label (t :settings-page/customize-shortcuts)
:button-label (t :settings-page/shortcut-settings)
:on-click (fn []
(state/close-settings!)
(route-handler/redirect! {:to :shortcut-setting}))
:-for "customize_shortcuts"}))

(defn zotero-settings-row []
[:div.it.sm:grid.sm:grid-cols-3.sm:gap-4.sm:items-start
[:label.block.text-sm.font-medium.leading-5.opacity-70
Expand Down Expand Up @@ -646,8 +637,7 @@
(when (config/global-config-enabled?) (edit-global-config-edn))
(when current-repo (edit-config-edn))
(when current-repo (edit-custom-css))
(when current-repo (edit-export-css))
(keyboard-shortcuts-row t)]))
(when current-repo (edit-export-css))]))

(rum/defcs settings-editor < rum/reactive
[_state current-repo]
Expand Down
6 changes: 4 additions & 2 deletions src/main/frontend/dicts.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
:ko (edn-resource "dicts/ko.edn")
:pl (edn-resource "dicts/pl.edn")
:sk (edn-resource "dicts/sk.edn")
:uk (edn-resource "dicts/uk.edn")})
:uk (edn-resource "dicts/uk.edn")
:id (edn-resource "dicts/id.edn")})

(def languages
"List of languages presented to user"
Expand All @@ -80,7 +81,8 @@
{:label "Türkçe" :value :tr}
{:label "Українська" :value :uk}
{:label "한국어" :value :ko}
{:label "Slovenčina" :value :sk}])
{:label "Slovenčina" :value :sk}
{:label "Bahasa Indonesia" :value :id}])

(assert (= (set (keys dicts)) (set (map :value languages)))
"List of user-facing languages must match list of dictionaries")
57 changes: 40 additions & 17 deletions src/main/frontend/fs/sync.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -237,17 +237,25 @@
(when-let [ws (:ws @*ws)]
(.close ws))))

(def *ws-connect-retries (atom 0))
(declare <sync-stop)
(defn- ws-listen!*
[graph-uuid *ws remote-changes-chan]
(reset! *ws {:ws (js/WebSocket. (util/format ws-addr graph-uuid)) :stop false})
(ws-ping-loop (:ws @*ws))
;; (set! (.-onopen (:ws @*ws)) #(println (util/format "ws opened: graph '%s'" graph-uuid %)))
(set! (.-onopen (:ws @*ws)) #(reset! *ws-connect-retries 0))
(set! (.-onclose (:ws @*ws)) (fn [_e]
(when-not (true? (:stop @*ws))
(go
(timeout 1000)
(println "re-connecting graph" graph-uuid)
(ws-listen!* graph-uuid *ws remote-changes-chan)))))
(if (> @*ws-connect-retries 3)
(do (println "ws-listen! retry count > 3, stop retry")
(reset! *ws-connect-retries 0)
(swap! *ws (fn [o] (assoc o :stop true)))
(<sync-stop))
(when-not (true? (:stop @*ws))
(go
(timeout 1000)
(println "re-connecting graph" graph-uuid)
(swap! *ws-connect-retries inc)
(ws-listen!* graph-uuid *ws remote-changes-chan))))))
(set! (.-onmessage (:ws @*ws)) (fn [e]
(let [data (js->clj (js/JSON.parse (.-data e)) :keywordize-keys true)]
(when (some? (:txid data))
Expand Down Expand Up @@ -3349,17 +3357,25 @@
[]
(go
(let [api-url (str "https://" config/API-DOMAIN "/logseq/version")
r1 (http/get api-url)
r2 (http/get config/CONNECTIVITY-TESTING-S3-URL)
r1 (http/get api-url {:with-credentials? false})
r2 (http/get config/CONNECTIVITY-TESTING-S3-URL {:with-credentials? false})
r1* (<! r1)
r2* (<! r2)
ok? (and (= 200 (:status r1*))
(= 200 (:status r2*))
(= "OK" (:body r2*)))]
(if ok?
(println :connectivity-testing-succ)
(notification/show! (str (t :file-sync/connectivity-testing-failed)
(print-str [config/CONNECTIVITY-TESTING-S3-URL api-url])) :warning false))
(notification/clear! :sync-connection-failed)
(notification/show! [:div
(t :file-sync/connectivity-testing-failed)
[:a {:href api-url} api-url]
" and "
[:a
{:href config/CONNECTIVITY-TESTING-S3-URL}
config/CONNECTIVITY-TESTING-S3-URL]]
:warning
false
:sync-connection-failed))
ok?)))

(declare network-online-cursor)
Expand All @@ -3368,14 +3384,22 @@
"Avoid running multiple sync instances simultaneously."
(atom false))

(defn- <should-start-sync?
[]
(go
(and (state/enable-sync?)
@network-online-cursor ;; is online
(user/has-refresh-token?) ;; has refresh token, should bring up sync
(or (= ::stop (:state (state/get-file-sync-state))) ;; state=stopped
(nil? (state/get-file-sync-state))) ;; the whole sync state not inited yet, happens when app starts without network
(<! (p->c (persist-var/-load graphs-txid)))))) ;; not a sync graph))

(defn <sync-start
[]
(go
(when-not @*sync-starting
(reset! *sync-starting true)
(if-not (and (state/enable-sync?)
(or (nil? (state/get-file-sync-state))
(= ::stop (:state (state/get-file-sync-state))))
(if-not (and (<! (<should-start-sync?))
(<! (<connectivity-testing)))
(reset! *sync-starting false)
(try
Expand Down Expand Up @@ -3492,9 +3516,8 @@
;; try to re-start sync when state=stopped every 1min
(go-loop []
(<! (timeout 60000))
(when (and @network-online-cursor ; is online
(= ::stop (:state (state/get-file-sync-state))))
(println "trying to restart sync...")
(when (<! (<should-start-sync?))
(println "trying to restart sync..." (tc/to-string (t/now)))
(<sync-start))
(recur))

Expand Down
2 changes: 1 addition & 1 deletion src/main/frontend/handler/editor.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
(defn open-block-in-sidebar!
[block-id]
(when block-id
(when-let [block (db/entity [:block/uuid block-id])]
(when-let [block (db/entity (if (number? block-id) block-id [:block/uuid block-id]))]
(let [page? (nil? (:block/page block))]
(state/sidebar-add-block!
(state/get-current-repo)
Expand Down
8 changes: 5 additions & 3 deletions src/main/frontend/handler/route.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,13 @@
(recent-handler/add-page-to-recent! (state/get-current-repo) page-name
click-from-recent?)
(let [m (cond->
(default-page-route page-name)
(default-page-route page-name)

anchor
(assoc :query-params {:anchor anchor})
push
(assoc :push push))]

(boolean? push)
(assoc :push push))]
(redirect! m)))))

(defn redirect-to-whiteboard!
Expand Down
5 changes: 5 additions & 0 deletions src/main/frontend/handler/user.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@
;; refresh remote graph list by pub login event
(when (user-uuid) (state/pub-event! [:user/fetch-info-and-graphs]))))))

(defn has-refresh-token?
"Has refresh-token"
[]
(boolean (js/localStorage.getItem "refresh-token")))

(defn login-callback
[session]
(set-tokens!
Expand Down
10 changes: 5 additions & 5 deletions src/main/frontend/modules/shortcut/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
(when-let [handler (-> (get @*installed-handlers install-id)
:handler)]
(.dispose ^js handler)
(js/console.debug "[shortcuts]" "uninstall handler" (-> @*installed-handlers (get install-id) :group str) (if refresh? "*" ""))
(log/debug :shortcuts/uninstall-handler (-> @*installed-handlers (get install-id) :group (str (if refresh? "*" ""))))
(swap! *installed-handlers dissoc install-id))))

(defn install-shortcut-handler!
Expand Down Expand Up @@ -146,7 +146,7 @@

(.listen handler EventType/SHORTCUT_TRIGGERED f)

(js/console.debug "[shortcuts] install handler" (str handler-id))
(log/debug :shortcuts/install-handler (str handler-id))
(swap! *installed-handlers merge data)

install-id)))
Expand Down Expand Up @@ -181,9 +181,9 @@
:will-remount
(fn [old-state new-state]
(util/profile "[shortcuts] reinstalled:"
(uninstall-shortcut-handler! (::install-id old-state))
(when-let [install-id (install-shortcut-handler! handler-id {:state new-state})]
(assoc new-state ::install-id install-id))))))))
(uninstall-shortcut-handler! (::install-id old-state))
(when-let [install-id (install-shortcut-handler! handler-id {:state new-state})]
(assoc new-state ::install-id install-id))))))))

(defn mixin*
"This is an optimized version compared to (mixin).
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 ^:no-doc frontend.version)

(defonce version "0.9.15")
(defonce version "0.9.17")
Loading

0 comments on commit c98f1a0

Please sign in to comment.