joshfarrant / shortcuts-js

A JavaScript iOS 12 Shortcuts creator
https://shortcuts.fun
GNU General Public License v3.0
1.69k stars 101 forks source link

iOS 13 Beta does not support Shortcut imports through AirDrop #217

Open sarimarton opened 5 years ago

sarimarton commented 5 years ago

I guess that's it then? :(

joshfarrant commented 5 years ago

We'll have to wait and see what happens in the full release. I did post on r/shortcuts a few weeks ago but didn't really find a good solution. I'd be interested to know if there is a workaround at the moment.

mtpereira commented 4 years ago

Hi,

Apparently someone created a Siri Shortcut to import other Shortcuts from iCloud: https://www.icloud.com/shortcuts/f9acfff2a5e94138a6574498d22c2813 (found it at: https://www.reddit.com/r/shortcuts/comments/d738kr/ios13_importing_shortcuts_as_files_is_not/f2ngi2e/ )

I haven't tried it yet, I'll let you know once I do.

n33kos commented 4 years ago

It looks like if you make an iCloud link out of the shortcut, you can import it by visiting the link in safari. I have verified this works, but you also need to go to security settings and enable "Allow Untrusted Shortcuts".

I haven't checked out the contents of the shortcut mtpereira posted but I assume it's just running Get File > Get Link To File. This worked for me 👍

mtpereira commented 4 years ago

It’s basically that, yes. It picks a file from iCloud, gets a link to it and opens it on Safari under a workflow://shortcuts URL.

mtpereira commented 4 years ago

On a similar note, does anyone know how to export a Shortcut to a file on iOS 13? All I can get are iCloud links, and for that reason I can't follow the "contributing" instructions. :disappointed:

n33kos commented 4 years ago

@mtpereira Im in the exact same situation, I haven’t found a way to send the shortcut over as a file instead of an “add shortcut” page.

I happened to find an output file in this comment: https://github.com/joshfarrant/shortcuts-js/issues/6#issuecomment-513875797 which helped me find out what variables the action was expecting, but I’m not sure if that is the same output as the parsing function provided. The action I added did work though so presumably it’s close. Hopefully that will get you unblocked for now.

joshfarrant commented 4 years ago

This still works, as far as I can tell:

https://www.icloud.com/shortcuts/b7cf16f2de72470ab165f80c23efeb5a

It essentially just saves the shortcut as a file in iCloud, allowing you to then send it to yourself. I'm sure that shortcut could be improved to actually handle the sending of the file too. Once you've got it, stick it in the /shortcuts directory of the project and run node scripts/parse.js.

@mtpereira That shortcut to import a shortcut seems to work for me, which is great news! Thanks for linking it :+1:

mtpereira commented 4 years ago

@joshfarrant To clarify my setup, my only iOS device is an iPhone, I'm developing on a Linux workstation.

So the way that I'm trying to get the Shortcut onto my workstation is by sharing it on my iPhone via Dropbox. The file that ends-up on Dropbox is actually and HTML file, and not a .shortcut file.

When I open an URL like the one you've shared on my workstation, it redirects me to the App Store, which isn't helpful on Linux. :stuck_out_tongue:

Is there any other way to export the Shortcuts? Thank you! :bowing_man:

joshfarrant commented 4 years ago

@mtpereira Ok, makes sense. Could you try opening that iCloud link I posted on your iPhone and importing the shortcut please. You'll get the following:

image

That Shortcut will save your selected Shortcuts to iCloud Drive. You can then open the Files app on your iPhone, find the saved Shortcuts, and share those files to Dropbox. Hopefully then you'll get Shortcuts in the correct format.

If that works, you may be able to edit the Shortcut linked above (on your iPhone, after you've imported it) to save the outputted file to Dropbox directly, which will make the process a bit quicker. I've not got Dropbox installed on my iPhone, so I can't test that I'm afraid.

Apologies if I've misunderstood your setup, or if that's what you've been trying!

mtpereira commented 4 years ago

@joshfarrant Oh I didn't understood that the Shortcut you had shared was actually to help me out on exporting them! :sweat_smile:

The procedure you've explained works great! :smile: :tada:

Thanks for the help! :bowing_man:

joshfarrant commented 4 years ago

No problem, glad that worked! 😄

rlb222 commented 4 years ago

This still works, as far as I can tell:

https://www.icloud.com/shortcuts/b7cf16f2de72470ab165f80c23efeb5a I'm sure that shortcut could be improved to actually handle the sending of the file too.

I added email support to this "shortcut exporting" shortcut. https://www.icloud.com/shortcuts/f779cc6b5367419c9acddb43221e313a

With this shortcut you can mail a shortcut(file) from your iOS device to an email address. This takes care of step 2 of the contributing steps

goranmoomin commented 4 years ago

OK, so AFAIK iOS 14 b1 re-adds importing .shortcut files 👍

a2 commented 4 years ago

@pcr910303 iOS 14 b2 seems to have removed this? (Filed feedback FB7931973)

the8tre commented 4 years ago

Shortcuts can still be exported through the 'Backup Shortcuts To iCloud' shortcut: https://www.icloud.com/shortcuts/f779cc6b5367419c9acddb43221e313a (It now seems that the output is a xml plist instead of the previous bplist)

Shortcuts files can be imported with the 'Create iCloud Link' shortcut avaible here: https://www.icloud.com/shortcuts/2dd8928b5e9a437ea893868f707aa6f3

Open the generated link with Safari to trigger the shortcut import.

0xdevalias commented 1 year ago

You may also find some benefit in something like this:

Originally posted by @0xdevalias in https://github.com/joshfarrant/shortcuts-js/issues/683#issuecomment-1548831442

Looking a little closer at that shortcut, the main bit of functionality seems to basically be modifying the iCloud Share URL slightly:

Given a URL like this:

https://www.icloud.com/shortcuts/ABC12

It becomes:

https://www.icloud.com/shortcuts/api/records/ABC123

Then extracts the following from the JSON on that page:

  • the URL for the unsigned shortcut file (which is an 'Apple binary property list' file): fields -> shortcut -> value -> downloadURL
  • the name of the shortcut workflow: fields -> name -> value

We can then convert that binary plist file to XML or JSON using plutil (though when I tried the JSON format I got an error (invalid object in plist for destination format), so might have to stick to XML):

plutil -convert xml1 -e plist.xml -- the-downloaded-shortcut.plist

or

plutil -convert json -e plist.json -- the-downloaded-shortcut.plist

(Crossposted: https://www.reddit.com/r/shortcuts/comments/13h61hv/comment/jl4dw28/)

Originally posted by @0xdevalias in https://github.com/joshfarrant/shortcuts-js/issues/683#issuecomment-1556546326