sboesen / remotely-sync

fork of remotely-save with security upgrades
Apache License 2.0
209 stars 8 forks source link

[Feature Request]: Please add the ability to synchronize trash bins (hidden trash folders) among devices #37

Open MartinJDavis93 opened 11 months ago

MartinJDavis93 commented 11 months ago

What feature are you suggesting?

This request should be implemented only after resolving #34, as they are related. It would be great to have the ability to synchronize trash folders. Yes, only trash folders. I know there's experimental support for syncing hidden directories, which includes the trash folder. However, it would be great if you could implement a separate switch specifically in the plugin settings for trash folders. It's very convenient. Imagine having multiple devices, 2, 3, or more, and after deleting files, you have to clear the trash bin on each of the devices. It's not critical, but it's not convenient either. It would be much better if you emptied the trash on one of the devices and it synced as a normal folder, which is the .trash folder, just hidden, with the .trash folders on the other devices and already permanently deleted the files from there (is meant finally, and not in the system trash). This would be analogous to the trash bin in apps like Google Keep, OneNote, etc., where it is universal for all devices. By implementing such a feature and logic, which I believe wouldn't be difficult, you could provide a useful function for many, even if they hadn't thought about it before.

What remote cloud services are you using, or suggesting adding the feature to?

No response

Ensure no sensitive information

sboesen commented 11 months ago

This makes sense to me, I'll add a drop-down allowing it to sync just the .trash folder, the .obsidian folder, all, or none. That should cover all bases (for now) and provide flexibility if we need to add more options later.

Will also use this configuration to update sync on save behavior as it will soon scan watched folders for changes instead of only the current file.

MikeWi11s0n commented 11 months ago

+1

MartinJDavis93 commented 11 months ago

This makes sense to me, I'll add a drop-down allowing it to sync just the .trash folder, the .obsidian folder, all, or none. That should cover all bases (for now) and provide flexibility if we need to add more options later.

Will also use this configuration to update sync on save behavior as it will soon scan watched folders for changes instead of only the current file.

Implementation #34 is just incredible. It's exactly what I initially envisioned for this feature. The simple switch, through which you can simply turn on/off. synchronization of the Obsidian cart without going into the details of its operation The 'drop-down allowing' feature is also a great improvement for those who want to sync only selected hidden folders. Of course, through it, you can also sync vaults with each other, but that's much less obvious for a regular user compared to a simple switch that performs only one function, as stated. Moreover, such a switch fits perfectly under 'Move deleted files to Obsidian .trash folder' in 'Basic Settings', while the 'drop-down allowing' feature falls into the category of 'Advanced Settings'. And even if hypothetically both the switch 'Synchronize between baskets' would be enabled and the .trash folder was also selected in the 'drop-down allowing', I doubt that these settings would conflict with each other. Therefore, I think it's better to separate these two implementations. Although the 'drop-down allowing' feature essentially can replace the switch, it's not quite the same, especially for a simple user who may not want to make changes into 'Advanced Settings'.

sboesen commented 11 months ago

Added in 0.4.22. Keep in mind the plugin rename may delay updates from showing up in the community plugin list, but manual installation is still possible.

MartinJDavis93 commented 11 months ago

Added in 0.4.22. Keep in mind the plugin rename may delay updates from showing up in the community plugin list, but manual installation is still possible.

Thanks for the implementation. However, currently, this parameter isn't working for me at all, so I'm reopening this issue. I manually updated the plugin. All other functions seem to be working correctly at first glance; synchronization is happening.

Based on the content in the Dropbox repository, the .trash folder has still not appeared, which, in my understanding, it should have. I suspect the reason lies in this, as it's unclear how synchronization should occur if there is no buffer folder for trash between devices.

sboesen commented 11 months ago

Hmm, I typed out this comment but I think I found one issue. By any chance do you have "Sync Config Dir" turned off?

Screenshot 2023-12-03 at 9 44 58 AM

Looks like I accidentally required this also to be on - will need to update this. I have also managed to get trash items not to sync on occasion, need to troubleshoot why that is.

Leaving the rest of my comment below, but it's mostly troubleshooting stuff and it looks like there are definitely some gaps from further testing. Sorry about that!

if there is no buffer folder for trash between devices.

What do you mean by a buffer folder for trash? Like an empty placeholder? I don't believe the current code syncs empty folders.

By the way I'm not sure why, but the current implementation only appears to synchronize newly added trash items and not ones that existed before this update. Definitely a gap, but I am not sure it's worth fixing since it will only affect existing users (and add code complexity). New users that trash items shouldn't be affected.

A workaround might be cd into the .trash folder and run touch * which should update the modification time for all of those files, tricking the plugin into syncing them.

Did you try trashing a test file after updating and still experience issues getting it to sync?

sboesen commented 11 months ago

I think I found the other part (or at least another part) of the issue. Deleting new files works fine for me, but deleting an old file doesn't work. I think this is because the sync time isn't recent, so if my guess is correct we just need to update the modification time or something like that, maybe ignore modification time, for items in the .trash folder.

MartinJDavis93 commented 11 months ago

Hmm, I typed out this comment but I think I found one issue. By any chance do you have "Sync Config Dir" turned off? Screenshot 2023-12-03 at 9 44 58 AM

Looks like I accidentally required this also to be on - will need to update this. I have also managed to get trash items not to sync on occasion, need to troubleshoot why that is.

Leaving the rest of my comment below, but it's mostly troubleshooting stuff and it looks like there are definitely some gaps from further testing. Sorry about that!

Yes, 'Sync Config Dir' parameter is disabled for me; I don't want to synchronize the .obsidian folder and any configuration files between the desktop and mobile versions. In general, the term 'experimental' doesn't instill confidence in stable operation.

What do you mean by a buffer folder for trash? Like an empty placeholder? I don't believe the current code syncs empty folders.

Regarding the expression 'buffer folder,' I used it metaphorically; I apologize if it caused any confusion. For me, the synchronization storage/cloud is like a transfer point that simply takes files and passes them along. Hence the term 'buffer folder.' I apologize once again.

By the way I'm not sure why, but the current implementation only appears to synchronize newly added trash items and not ones that existed before this update. Definitely a gap, but I am not sure it's worth fixing since it will only affect existing users (and add code complexity). New users that trash items shouldn't be affected.

A workaround might be cd into the .trash folder and run touch * which should update the modification time for all of those files, tricking the plugin into syncing them.

I periodically clean the folder either through a third-party trash plugin or by manually deleting the contents of the .trash folder. So if this complicates the process, it's certainly not worth bothering with.

Currently, the .trash folder is simply absent in the Dropbox repository. It doesn't matter if there are any items in it or if it's empty. Consequently, without the folder, there's nowhere to synchronize. But, as you noted, the 'Sync Config Dir' parameter should be enabled. In my case, it's disabled, and I explained why.

sboesen commented 11 months ago

Been a bit busy, but I think this should be fixed in latest release. Haven't had time to test all of the configurations. Give it a try if you like, will find time to test/fix it again if still not working throughout this week. Thanks for the details!

sboesen commented 11 months ago

I periodically clean the folder either through a third-party trash plugin or by manually deleting the contents of the .trash folder. So if this complicates the process, it's certainly not worth bothering with.

Currently the plugin cannot identify files deleted outside of Obsidian, just keep in mind the plugin may try to keep syncing the deleted files if they ended up being sync'd. There is no simple workaround for now except maybe deleting the file in your remote storage (dropbox etc). I think at some point we may extend the plugin to allow displaying hidden files/folders somehow because this is (what I consider) a critical feature.

MartinJDavis93 commented 11 months ago

Been a bit busy, but I think this should be fixed in latest release. Haven't had time to test all of the configurations. Give it a try if you like, will find time to test/fix it again if still not working throughout this week. Thanks for the details!

Nothing to worry about. You already dedicate a lot of time to supporting the plugin, thank you for that ❤️

As for the fix, I tried, but it doesn't work for me. The .trash folder in Dropbox is missing. I think this is specifically related to Dropbox, and I don't know if it's possible to bypass it at all. When you delete a file on a device, and in the settings, you have selected to delete files in Obsidian .trash, the files on the device are moved there. However, in Dropbox, during synchronization, the files are sent to the Dropbox trash, not to the .trash Obsidian folder, which is absent. Even if you manually create a .trash folder on Dropbox and move a file there, it'll not be reflected through the third-party trash plugin in Obsidian. But this is related to what you said: 'The plugin cannot identify files deleted outside of Obsidian'. I don't know if there is such a possibility in the Dropbox API at all, so that you can specify where to move the files after deletion. The situation is probably the same with OneDrive, so I don't know if it's worth spending time on this.

sboesen commented 11 months ago

Super odd behavior. I'll give it a try, I hope it's possible to improve the functionality here. Thanks for the continued details!

MartinJDavis93 commented 11 months ago

Super odd behavior. I'll give it a try, I hope it's possible to improve the functionality here. Thanks for the continued details!

I don't know why, but it doesn't work yet. I would recommend you to create some kind of test storage in yourself specifically for synchronization through Dropbox and test this function already on it. I'll attach the email address and password for the Dropbox that I created for you below so that you can test it yourself so as not to create additional inconvenience for you.

trashsynctesting1@proton.me mgh3BhIsjh

sboesen commented 11 months ago

Thank you!

MartinJDavis93 commented 11 months ago

@sboesen I forgot to mention yesterday that there's no need to pay too much attention to this for now. Focus on the fixes you've planned for yourself or those that are more prioritized overall and require a quicker response than this improvement. I suggested it with a long-term perspective. I didn't expect you to take it up so quickly and try to implement it.

And in my opinion, it would be good if, in the next update, you would add the following text to the description of this function: "(at the moment, it may not work with all sync services)". Because not everyone follows the changes that come with each update. And so that they don't have any questions, and why this parameter doesn't work for me.

sboesen commented 11 months ago

100%, I will also add (experimental) to call out not to expect it to work immediately.