vrtmrz / obsidian-livesync

MIT License
3.92k stars 132 forks source link

[Feature Request] Sync Attachment on demand and clear them periodically to save up disk on edge device #424

Open qlibp opened 1 month ago

qlibp commented 1 month ago

Scenario: It's nice to sync all .md files across all devices, but it's not quite a good idea to sync all attachments across all devices, especially on mobile side. For example, I just wanna view some of the pdfs occasionally, not all the pdfs should be synced to mobile side. I would like to sync/download the attachments when it's needed.

Possible Feature:

Maybe this feature could be named as a cache feature.

vrtmrz commented 2 days ago

Thank you for the request! I think this might be a useful feature. However, we have a few things to solve.

  1. Possibly, we should have a stub file to handle the existence. Otherwise, we cannot fetch that again if the file is not referenced from anywhere.
  2. Self-hosted LiveSync always handles the file events, but cannot intercept them. So, we should hook the file opening or create events. This possibly causes some unexpected behaviour (i.e., clicking [[a.png]] without real a.png makes a.png.md).
  3. From the point of view of other plugins, it may be a bit difficult to interpret.
  4. We cannot rebuild the database as in the past.

However, indeed it might be a useful feature (especially at the initial setup). I hope to think about it more deeply in the time that I can focus on it.