use api.logseq.io

This commit is contained in:
Tienson Qin
2026-02-27 11:22:21 +08:00
parent 2bc080d114
commit 9e57add57e
3 changed files with 4 additions and 25 deletions

View File

@@ -28,6 +28,7 @@
(if ENABLE-FILE-SYNC-PRODUCTION
(do (def LOGIN-URL
"https://logseq-prod.auth.us-east-1.amazoncognito.com/login?client_id=3c7np6bjtb4r1k1bi9i049ops5&response_type=code&scope=email+openid+phone&redirect_uri=logseq%3A%2F%2Fauth-callback")
;; TODO: move user_info api to cloudflare workers
(def API-DOMAIN "api.logseq.com")
(def COGNITO-IDP "https://cognito-idp.us-east-1.amazonaws.com/")
(def COGNITO-CLIENT-ID "69cs1lgme7p8kbgld8n5kseii6")
@@ -57,12 +58,12 @@
(defonce db-sync-ws-url
(if db-sync-local?
"ws://127.0.0.1:8787/sync/%s"
"wss://logseq-sync-prod.logseq.workers.dev/sync/%s"))
"wss://api.logseq.io/sync/%s"))
(defonce db-sync-http-base
(if db-sync-local?
"http://127.0.0.1:8787"
"https://logseq-sync-prod.logseq.workers.dev"))
"https://api.logseq.io"))
;; Feature flags
;; =============

View File

@@ -79,12 +79,7 @@
:graph<->user-user-type
:graph<->user-grant-by-user])))
graph-list)))))}
(shui/tabler-icon "download") "graph-list")
(shui/button
{:size :sm
:on-click #(c.m/run-task :upload-test-avatar
(user/new-task--upload-user-avatar "TEST_AVATAR"))}
(shui/tabler-icon "upload") "upload-test-avatar")]
(shui/tabler-icon "download") "graph-list")]
[:div.pb-4
[:pre.select-text

View File

@@ -335,23 +335,6 @@
[repo]
(= (get-user-type repo) "member"))
(defn new-task--upload-user-avatar
[avatar-str]
(m/sp
(when-let [token (state/get-auth-id-token)]
(let [{:keys [status body] :as resp}
(c.m/<?
(http/post
(str "https://" config/API-DOMAIN "/logseq/get_presigned_user_avatar_put_url")
{:oauth-token token
:with-credentials? false}))]
(when-not (http/unexceptional-status? status)
(throw (ex-info "failed to get presigned url" {:resp resp})))
(let [presigned-url (:presigned-url body)
{:keys [status]} (c.m/<? (http/put presigned-url {:body avatar-str :with-credentials? false}))]
(when-not (http/unexceptional-status? status)
(throw (ex-info "failed to upload avatar" {:resp resp}))))))))
(defn- guard-ex
[x]
(when (instance? ExceptionInfo x) x))