MobiusSync / MobiusSync

Syncthing for iOS
https://www.mobiussync.com
166 stars 3 forks source link

Utilize x-callback to sync via shortcut #136

Open Nihilentropy-117 opened 6 months ago

Nihilentropy-117 commented 6 months ago

I think this method, if implemented, would allow syncing via iOS shortcut. My specific use case is to sync my obsidian notes before opening the program, but it would function for any app that needs to be synced before running. Mobius would have to remain open, but as long as periodic sync is on, it shouldn’t take long to make sure all the files are current.

Shortcut


app_url_after_sync = "obsidian://"
    mobius_sync_url = "mobiussync://sync?callbackURL=" + app_url_after_sync

    OpenURL(mobius_sync_url)

Mockup Implementation

func startSync(appURLAfterSync: String) {
    let syncResult = do_sync()
    if syncResult {
        if let url = URL(string: appURLAfterSync) {
            UIApplication.shared.open(url)
        }
    }
}

private func do_sync() -> Bool {
    // Mobius’ Normal Sync Operations
    return true
}
hugoideler commented 6 months ago

It would be nice if shortcuts are supported. As an additional example, there is an unofficial sync approach for logseq that uses the "Working Copy" iOS app to sync the files in the background. In their workflow they use a shortcut on opening logseq to trigger a background sync in this "Working Copy" app.

sj7trunks commented 6 months ago

Requested for this feature in November, I have logseq and this would be perfect for my workflow since I have to manually sync it when I open and close the application.

Nihilentropy-117 commented 6 months ago

I hacked this together the other day, should be pretty easy to modify to call Logseq. It's not a pretty solution, but it's functional.

https://github.com/Nihilentropy-117/ISH-iOS-bridge

ronny3 commented 5 months ago

I would image utilizing the Shortcuts might enable more reliable background syncing. I have used Working Copy and it works very well with that. Currently we can Open App into Mobius and then simply open the next app. Somewhat ugly, but works everytime as even a very fast open is enough.