cloudy9101 / obsidian-image-inserter

An Obsidian plugin helps users easily search and insert images to editors from Unsplash.
https://github.com/cloudy9101/obsidian-image-inserter
MIT License
35 stars 5 forks source link

Backend implementation #7

Closed vovech closed 1 year ago

vovech commented 1 year ago

Hello, thanks for your plugin. Do you also share backend implementation of it? I would like to host it by myself as well :)

cloudy9101 commented 1 year ago

That's a good idea. The backend only needs to be a simple proxy to Unsplash. I moved to Cloudflare workers recently since it's easy to use and has a free tier. That's the repo. https://github.com/cloudy9101/obsidian-image-inserter-proxy

  1. You need to apply a client id from Unsplash and fill it into the wrangler.yml as CLIENT_ID under the repo.
  2. Then deploy the worker to Cloudflare.
  3. After deployment, you need to go back to this repo and change the endpoint from https://insert-unsplash-image.cloudy9101.com/ to the Cloudflare worker's endpoint like https://xxx.xxx.workers.dev.
  4. Build the plugin and install it from Obsidian.

You may need some knowledge of using Cloudflare workers to finish this. You can try to build it. I will write a README for the proxy repo this weekend and If you want to follow detailed instructions, keep an eye on it maybe.

vovech commented 1 year ago

Hello, thank you very much. I will try it.

cloudy9101 commented 1 year ago

I added README for the proxy repo and a setting for the self-host proxy server in the plugin's setting tab in v0.1.6

I will close this issue, please feel free to reopen it if any problem arises.