I havenāt been able to get the private php version working on my Azure Static Site, but it got me thinkingā¦ would you be able to modify the script so that instead of doing a bunch of await upload() it would write those outputs locally?
Having the .html, .css, and other assets cleansed/created locally could open up other use-cases.
Very cool! Forgive me because my JS/Node skills are fairly weakā¦do you know how to set the path to somewhere on my drive (e.g. C:\)? Looks like currently itās writing to C:\Users\myusername\AppData\Local\Obsidian).
Figured it out. Added PR to the repo with an example if youād like it. No hard feelings if you donāt accept it ā this is working nicely for me! Thank you!!
I believe I got all the ānon-localā stuff out of there. Kept a modified version of getHash that could likely be cleaned up throughout but it was the easiest way to deal with all the .woff and .woff2 files. I tossed those all in a assets/ folder when you loop over the the base64 attachments.
Might be cool to have an issues tab on the repo?
I did notice that some of the code blocks and callout blocks are not āexactā when using the Minimal theme and a few extra settings with the Styler plugin (code blocks lose formatting and some subtle padding/margin changes elsewhere).
Also the copy button in the code blocks is there, but not functional. Likewise, header folding looks like itās there but not functional.
Mainly the script is just a reference implementation, as itās easy to modify and base something off which fits your own workflow. If I turn it into a plugin Iāll do the full shebang and add an issues tracker and all that.
Regarding the copy button and folding - thatās because it doesnāt include any of the Javascript along with the page. Perhaps something to consider adding, but of course then there will be security concerns to think about.
@AlanG If I turn it into a plugin Iāll do the full shebang and add an issues tracker and all that.
FYI, there is a plugin that has much of the same functionality as your script, including exporting the Javascript. However, it doesnāt do the main thing yours does, publish. Iāve forked this plugin and added publishing based on your script. It works well with my initial testing. I have different plans for this particular plugin and am not sure if it will be released to the community or just for private use. I wanted to let you know that there is a plugin that is similar to what you might intend to create someday.
This is pretty cool. Thanks for doing this. One thing you said it supports callouts; Iām assuming that is the official obsidian callouts. I use the Admonitions plug-in and it doesnāt work. Iāll change them to obsidian and see how it does.
I have Preformatted text > [!info] - Chart Preformatted text > Preformatted text > ![[../attachments/autism.png]]
on 3 separate lines. (I canāt get it to show up properly here).
In obsidian it shows collapsed as it should. But when shared, it is not collapsed and there is no option to collapse or expand. Are callouts working? Iām using 1.1.5.
Hereās a published page which includes both Obsidian default and Admonition plugin callouts, and both published without any issues:
What issue are you seeing?
This is correct - they wonāt collapse/expand, as there is no Javascript exported with the published webpage. Javascript is needed to make the collapse/expand functionality happen, itās not plain HTML.
Hi, this is a really awesome service!! Have you thought about turning it into a proper plugin that has a command to upload a note, and maybe a panel that lists links to all of the notes youāve shared so far? That would really take it to the next level for me.
And its missing the CSS as well as the HTML doctype.
Did I maybe use templater wrong? Looking at the source code of the upload script, it seems that everything goes āwellā as I do get the āFile has been sharedā notice at the end.
This is fantastic! This was the last feature which was holding me back from a full switch. Iāve been able to set it up with my own hosting which is fantastic! However, seems the images wonāt want to upload at all. See the test note being shared:
I read above that base64 is needed to be supported on the hosting end, which I use hostinger and it is supported, so Iām not sure what else could be wrong? Thanks!
It was a small change that Obsidian app made to the local image location. You can update your script by making this tiny change (replacing local with \w+):
Hi @Hemera - as the CSS is missing, weāll do some quick troubleshooting:
First, delete all share_ values from your YAML, then try and re-upload the note. This will force the CSS to re-upload. If that works, youāre all done. If it doesnāt work, there might be something specific to the theme youāre using thatās causing it to fail.
If the previous step didnāt work, try opening the Sandbox vault (from the help menu), and trying the share script using the default theme and without any plugins installed except for Templater. If this works, then it means thereās something in your normal vault which is preventing it from working.
To find out whatās causing it to fail, first start by using the default theme in your normal vault and see if that fixes it. If that doesnāt fix it, then perhaps some plugin is causing it to fail. Are there any helpful messages in the Javascript console?
@bryan00 I have now built this as a plugin, with a bunch of great updates. Firstly the note content is now stored encrypted on the server, with you holding the only key. The key is never sent to the server at any point so the contents of your notes are not accessible to anyone except you and whoever you send the shared link to. The sharing has also been updated to work with all the new Obsidian functionality.
I will be adding functions to manage you shared notes like you suggest - see which notes were published, have been changed, and let you unshare them.
@AlanG Any chance you are going to publish the server-side code, similar to your original share serviceās php script? Iād like to self-host locally. Thanks for considering.
Excellentā¦ I was hoping that was the case. I did notice the plugin utilizes an API key. Is that for encryption only? or does that control access to the share service? or both?