Vinzent03 / obsidian-advanced-uri

Advanced modes for Obsidian URI
MIT License
766 stars 44 forks source link

I made a PageRedirector project to allow opening Advanced URIs using https #190

Open EDLLT opened 1 month ago

EDLLT commented 1 month ago

https://github.com/EDLLT/PageRedirector

Can we mention it in this project's README? (If you can't mention my project for security reasons then feel free to create a fork of it instead) I think it'd help many people as I couldn't find any solution for it on the web

I mainly use it to link to my Obsidian vault in sites that don't allow for the "obsidian://" protocol to be processed(One, for example, is Google Tasks)

image

Vinzent03 commented 3 weeks ago

Interesting and simple project to solve that issue. I've experienced that myself from time to time. Just one note to your project, when adding the Obsidian URI or from this plugin, you need one extra layer of encoding. For example, if you want to write %20 to a file, you need one extra call to encodeUriComponent() with the obsidian URI so that it becomes https://edllt.github.io/PageRedirector/?link=obsidian%3A%2F%2Fadv-uri%3Fvault%3Dobsidian-testing%26filepath%3Ddf.md%26mode%3Dappend%26data%3D%252520 in the end. One could use the following tool: https://www.onlinewebtoolkit.com/url-encode-decode#decode-url-component

EDLLT commented 3 weeks ago

Interesting and simple project to solve that issue. I've experienced that myself from time to time. Just one note to your project, when adding the Obsidian URI or from this plugin, you need one extra layer of encoding. For example, if you want to write %20 to a file, you need one extra call to encodeUriComponent() with the obsidian URI so that it becomes https://edllt.github.io/PageRedirector/?link=obsidian%3A%2F%2Fadv-uri%3Fvault%3Dobsidian-testing%26filepath%3Ddf.md%26mode%3Dappend%26data%3D%252520 in the end. One could use the following tool: https://www.onlinewebtoolkit.com/url-encode-decode#decode-url-component

Actually, that's not needed due to the way the javascript is encoding the url. The only thing that's needed is to encode special characters iirc.

For that, a user could simply right click on their file and hit on "copy Obsidian URI" or "copy Advanced URI" and that'll be correctly encoded Then, all what they'd have to do is write it as "https://edllt.github.io/PageRedirector/?link=COPIED_URI_HERE" and that should work

Vinzent03 commented 2 weeks ago

By using the provided command in Obsidian the uri is correctly encoded to be called directly, but not to be passed as a query parameter. You can try it yourself by creating an uri to append <space>hello<space> to a file.