Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read custom user configuration for vis.Network options #43

Merged
merged 3 commits into from
Jun 22, 2020

Conversation

wohanley
Copy link
Contributor

My network is pretty big, so it's useful to be able to tweak the physics options for vis.Network. These changes make that possible.

Copy link
Member

@goktug97 goktug97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the mimetype is application/json you don't need data: %s\n\n. It should be the json itself to work.

(defservlet* network-vis-options application/json (token)
  (if org-roam-server-authenticate
      (if (not (string= org-roam-server-token token))
          (httpd-error httpd-current-proc 403)))
  (insert (or org-roam-server-network-vis-options "{}")))

Add example to encode the json using elisp

(defcustom org-roam-server-network-vis-options nil
  "Options to be passed directly to vis.Network, in JSON format.
e.g. (json-encode (list (cons 'physics (list (cons 'enabled json-false)))))
or { \"physics\": { \"enabled\": false } }"
  :group 'org-roam-server
  :type 'string)

@wohanley
Copy link
Contributor Author

Sorry about the force push, didn't notice you had looked at this already. Thanks for the tip - I'm still mostly unclear on what exactly $.get does.

@wohanley wohanley requested a review from goktug97 June 21, 2020 19:34
@goktug97 goktug97 merged commit 3ecc8d5 into org-roam:master Jun 22, 2020
@goktug97
Copy link
Member

Thank you for the PR, it works perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants