summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas F. K. Jorna <[email protected]>2021-10-09 14:08:34 +0200
committerThomas F. K. Jorna <[email protected]>2021-10-09 14:08:34 +0200
commit03641ca2868d5ef21ffe426fa547dd859ce1c474 (patch)
tree73500c4a178f25f2d34b66c4dccdbcf10ee7ee83
parent2384b30a244c7d6477e54de5385fe7f1cc62d43a (diff)
fix(preview): changed from api routing to emacs server
-rw-r--r--components/Sidebar/Link.tsx5
-rw-r--r--org-roam-ui.el8
-rw-r--r--util/uniorg.tsx4
3 files changed, 6 insertions, 11 deletions
diff --git a/components/Sidebar/Link.tsx b/components/Sidebar/Link.tsx
index 9515b6d..1211cb4 100644
--- a/components/Sidebar/Link.tsx
+++ b/components/Sidebar/Link.tsx
@@ -129,10 +129,9 @@ export const PreviewLink = (props: LinkProps) => {
},
})
- const file = encodeURIComponent(nodeById[id]?.file as string)
+ const file = encodeURIComponent(encodeURIComponent(nodeById[id]?.file as string))
const getText = () => {
- console.log(nodeById[id]?.title)
- fetch(`api/notes/${file}`)
+ fetch(`http://localhost:35901/file/${file}`)
.then((res) => {
return res.text()
})
diff --git a/org-roam-ui.el b/org-roam-ui.el
index 2d10abb..e018b09 100644
--- a/org-roam-ui.el
+++ b/org-roam-ui.el
@@ -237,13 +237,9 @@ This serves the web-build and API over HTTP."
(json-encode `((type . "orgText") (data . ,text))))))
(defservlet* note/:id text/plain ()
- (if-let ((node (org-roam-populate (org-roam-node-create :id id)))
- (file (org-roam-node-file node)))
(progn
- (insert-file-contents-literally file)
- (message "we got one %s" file)
- ))
-(httpd-send-header t "text/plain" 200 :Access-Control-Allow-Origin "*"))
+ (insert-file-contents-literally (org-link-decode file))
+(httpd-send-header t "text/plain" 200 :Access-Control-Allow-Origin "*")))
;(insert "error")
;(httpd-send-header t "text/plain" 200 :Access-Control-Allow-Origin "*")
diff --git a/util/uniorg.tsx b/util/uniorg.tsx
index c36f662..6d0bb56 100644
--- a/util/uniorg.tsx
+++ b/util/uniorg.tsx
@@ -16,9 +16,9 @@ export const UniOrg = (props: UniOrgProps) => {
const [previewText, setPreviewText] = useState('')
- const file = encodeURIComponent(previewNode.file)
+ const file = encodeURIComponent(encodeURIComponent(previewNode.file))
useEffect(() => {
- fetch(`api/notes/${file}`)
+ fetch(`http://localhost:35901/file/${file}`)
.then((res) => {
return res.text()
})