elias-sundqvist / obsidian-annotator

A plugin for reading and annotating PDFs and EPUBs in obsidian.
GNU Affero General Public License v3.0
1.46k stars 68 forks source link

calibre::// URL  #78

Open Wcdaren opened 2 years ago

Wcdaren commented 2 years ago

I'm sorry, please forgive me, my English is not very good

Hello, first thank you for your plugin, is wonderful, helps me a lot.

So i like to suggest a implementation, would be perfect if you can add a support for calibre:// to open file ,just like file://, i have a lot of my PDFs hosted obsidan file and sync by webdav, and now for read them with Annotator plugin i need to copy file path by use file::// , but i think than would be perfect if i can use calibre:// , like

annotation-target: calibre://view-book/_hex_-43616c696272655f4c696272617279/84/PDF

The calibre:// URL scheme detail

andrewcrook commented 2 years ago

The issue here is that calibre processes the calibre:// url. It will open calibre at the document, the obsidian plugin will not receive the file or file path. The PDF viewer needs the relative file path of the pdf on the filesystem i.e like file:// Unless calibre offers way to query and get the file path from the calibre:// link I don't think it can be done. Unless calibre can support something like a x-callback-url which can return the required information to the obsidian plugin by returning the information back to obsidian via an obsidian URL. I wonder if calibre allows you to hook into its schema via plugins so that you could add x-callback-url support?

x-callback-url example of two way communication.

targetapp://x-callback-url/translate?
             x-success=sourceapp://x-callback-url/acceptTranslation&
             x-source=SourceApp&
             x-error=sourceapp://x-callback-url/translationError&
             word=Hello&
             language=Spanish

To secure you could add tokens.