Comments (11)
Any ideas on this? ๐ I'm really coming to depend on some Shortcuts I use for personal automation. I recently decided I'd like to convert them to Cherri, and I'd love to have some initial automated "bones" to start from!
from cherri.
Good to know! I've got almost a dozen shortcuts that I use on a regular basis (five of which I have set to automatically run periodically throughout the day ๐) so I'm really looking forward to getting some of this into source control! ๐
from cherri.
Btw it turns out that this comment is not true!
Lines 66 to 68 in 68974c0
It's possible to extract the raw shortcut contents from signed shortcut files.
See https://theapplewiki.com/wiki/Apple_Encrypted_Archive:
Signed shortcuts are AEA files but they are actually not encrypted. The 32bit size for the AEA context can be found at location 0x8-0xB in the file, and the size plus 0x495c will be the starting location of an LZFSE compressed Apple Archive. (For an example of this, take a look at libshortcutsign's extract_aa_from_aea function.) After decompression, the magic number is the 4 ASCII characters "AA01".
I have an example of doing this using https://github.com/wader/fq for my own shortcuts repo I started a few weeks ago here:
from cherri.
Alright so a few updates!
- I was able to resolve that
decomp
branch Go compilation error via vergenzt@d45deae. - I attempted to import all of my Shortcuts! ๐ There were a number of issues. You can view the results at https://github.com/vergenzt/shortcuts/tree/main/src. For the imports that succeeded, there is a
*.cherri
file in the repo next to the corresponding*.plist
/*.json
files (I included both for each Shortcut for ease of comparison). For imports that failed, there is a*.cherri-decompile.log
file containing the stderr panic output.
There were a few issues I've noticed so far:
- There were quite a few panics. ๐ I haven't dug into the details yet.
- Custom actions seemed to not be extracted at all. E.g. the single custom action at https://github.com/vergenzt/shortcuts/blob/62b5893173eb1c7003f22f22efc849f5a4dd151e/src/Automation%20Utils/Fastmail%20Auth.json#L4-L10
vs the empty
{ "WFWorkflowActionIdentifier": "dk.simonbs.DataJar.GetValueIntent", "WFWorkflowActionParameters": { "UUID": "9B76AD6E-10C1-4A4E-A9F0-7CE3F3A21D3D", "keyPath": "fastmail-config" } }
*.cherri
file at https://github.com/vergenzt/shortcuts/blob/62b5893173eb1c7003f22f22efc849f5a4dd151e/src/Automation%20Utils/Fastmail%20Auth.cherri.
from cherri.
Oh I just noticed the decomp
branch is in progress! ๐ฎ
Anything ready to test yet? ๐
from cherri.
Oh I just noticed the
decomp
branch is in progress! ๐ฎAnything ready to test yet? ๐
Thanks for your interest in this feature!
Yes, you can test this. If you use the decomp
branch and build or run from the source, you can import a Shortcut using the --import
flag entering either an iCloud Shortcut URL or a path to an unsigned Shortcut file. (e.g. go run . --import=unsigned.shortcut
)
Keep in mind it is currently in active development so it's likely to be buggy, especially with more complex shortcuts.
from cherri.
This now works very well on the decomp
branch, just need to do more testing and implement more features that require specific implementation to decompile properly.
Now testing decompiling LARGE Shortcuts and comparing then fixing any incorrect decompilation. ๐
from cherri.
I'm not sure we'll ever get perfect decompilation since Cherri while it tries to be as 1-1 as possible, has conveniences and doesn't always translate 1-1. However, I've been making strides in better matching actions that are split into multiple actions for ease of use. I'm excited to see how close we CAN get.
from cherri.
Hmm btw I just tested the latest decomp
branch again and I'm getting a compilation error:
$ go install github.com/electrikmilk/cherri@decomp
go: github.com/electrikmilk/[email protected] requires go >= 1.22; switching to go1.22.2
# github.com/electrikmilk/cherri
../../go/pkg/mod/github.com/electrikmilk/[email protected]/decompile.go:719:18: undefined: actionOutputs
../../go/pkg/mod/github.com/electrikmilk/[email protected]/decompile.go:720:43: undefined: actionOutputs
Any ideas?
from cherri.
Alright so a few updates!
- I was able to resolve that
decomp
branch Go compilation error via vergenzt@d45deae.- I attempted to import all of my Shortcuts! ๐ There were a number of issues. You can view the results at https://github.com/vergenzt/shortcuts/tree/main/src. For the imports that succeeded, there is a
*.cherri
file in the repo next to the corresponding*.plist
/*.json
files (I included both for each Shortcut for ease of comparison). For imports that failed, there is a*.cherri-decompile.log
file containing the stderr panic output.There were a few issues I've noticed so far:
There were quite a few panics. ๐ I haven't dug into the details yet.
Custom actions seemed to not be extracted at all. E.g. the single custom action at https://github.com/vergenzt/shortcuts/blob/62b5893173eb1c7003f22f22efc849f5a4dd151e/src/Automation%20Utils/Fastmail%20Auth.json#L4-L10
{ "WFWorkflowActionIdentifier": "dk.simonbs.DataJar.GetValueIntent", "WFWorkflowActionParameters": { "UUID": "9B76AD6E-10C1-4A4E-A9F0-7CE3F3A21D3D", "keyPath": "fastmail-config" } }vs the empty
*.cherri
file at https://github.com/vergenzt/shortcuts/blob/62b5893173eb1c7003f22f22efc849f5a4dd151e/src/Automation%20Utils/Fastmail%20Auth.cherri.
Yeah, we should probably at least put a raw action if we don't know what the action is by default, fill in the gaps from there so that it's at least there if it's not a standard action.
from cherri.
Btw it turns out that this comment is not true!
Lines 66 to 68 in 68974c0
It's possible to extract the raw shortcut contents from signed shortcut files.
See https://theapplewiki.com/wiki/Apple_Encrypted_Archive:
Signed shortcuts are AEA files but they are actually not encrypted. The 32bit size for the AEA context can be found at location 0x8-0xB in the file, and the size plus 0x495c will be the starting location of an LZFSE compressed Apple Archive. (For an example of this, take a look at libshortcutsign's extract_aa_from_aea function.) After decompression, the magic number is the 4 ASCII characters "AA01".
I have an example of doing this using https://github.com/wader/fq for my own shortcuts repo I started a few weeks ago here:
This is good stuff, thanks!
from cherri.
Related Issues (20)
- Issue with retrieving enums from a list HOT 1
- Issue with retrieving unitType enums from a list HOT 1
- Commented includes are still parsed HOT 4
- Defining version 17 stops the shortcut from being signed successfully HOT 1
- Add to/Subtract from date not producing a valid Shortcut when the magnitude is a variable HOT 2
- `emailAddress`, `phoneNumber`, and `list` do not handle variables correctly HOT 2
- `killApp`, `openApp`, `quitApp`, `hideApp`, and `splitApps` cause the compiler to crash when used with a variable. HOT 1
- Variable arguments to `killAllApps`, `hideAllApps`, and `quitAllApps` are treated as constants HOT 1
- Unable to stop and give a response when input isn't provided HOT 1
- `getListItem` and `getListItems` don't work (properly) with variables HOT 1
- Compiler mistakes `index` (should be number type) for text type in `repeat` loop HOT 2
- Error in Line Printing: Wrong Line Numbers HOT 3
- Shortcuts Failing to sign on macOS 14.4 HOT 3
- WHAT THE HELL. WHERE'S THE EXE!?! HOT 1
- Missing โselect folderโ action
- Setting a variable to the result of an action produces self-referential Set Variable actions that don't work HOT 1
- Nested blocks cause custom actions to exit prematurely HOT 1
- Cherri Playground errors while compiling Shortcuts that define their name right at the end HOT 3
- Custom actions aren't detected as used when only used inside other custom actions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cherri.