zsviczian / obsidian-excalidraw-plugin

A plugin to edit and view Excalidraw drawings in Obsidian
4.16k stars 230 forks source link

Cloud Vault w/ SSR #724

Open 7flash opened 2 years ago

7flash commented 2 years ago

Describe the solution you'd like I would like to have my vault stored in the cloud and access it in browser from different devices.

Ideally it could be able to perform initial canvas rendering server-side (instead of rendering each referenced image on client)

zsviczian commented 2 years ago

Accessing Obsidian from a browser is not a feature I can implement for you. Furthermore since Obsidian is designed as a local-first PKM tool working with local files, I doubt the Obsidian team would want to develop such a feature in the future as well.

That said, you can hack Excalidraw.com to achieve something similar.

Collaboration spaces on Excalidraw.com are stored in the cloud indefinitely. The drawback of this approach is that you will not be able to create links in these drawings to files in your Obsidian Vault.

Here's a script you could use to create a Templater action to create a collaboration canvas and insert it into your active document in Obsidian.

Good luck.

<%*
const room = Array.from(window.crypto.getRandomValues(new Uint8Array(10))).map((byte) => `0${byte.toString(16)}`.slice(-2)).join("");
const key = (await window.crypto.subtle.exportKey("jwk",await window.crypto.subtle.generateKey({name:"AES-GCM",length:128},true,["encrypt", "decrypt"]))).k;
tR += `<iframe src="https://excalidraw.com/#room=${room},${key}`" style="width:800px;height:500px;resize:both;overflow:auto;"/>`;
%>