diff --git a/.gitignore b/.gitignore index f8390f6..3ea670a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -/cmd/urf/urf \ No newline at end of file +/cmd/urf/urf +/cmd/urf/urf-* \ No newline at end of file diff --git a/README.md b/README.md index c67eef5..d01431f 100644 --- a/README.md +++ b/README.md @@ -14,25 +14,39 @@ most (if not all) keys are technically optional. here's an example repo with eve ```json { - "name": "hello!", - "identifier": "fyi.zxcvbn.repo.test", - "iconURL": "https://example.com/path/to/some/icon.png", - "caption": "a *short* description of your repo!", - "description": "this can be a longer description and include stuff like your links or something, idk", - "apps": [ - { - "name": "app name", - "developerName": "zx", - "bundleID": "fyi.zxcvbn.app", - "caption": "just like the repo's caption", - "description": "just like the repo's description", - "downloadURL": "https://example.com/path/to/some/app.ipa", - "iconURL": "https://example.com/hopefully/path/to/itunes/icon.png", - "version": "1.2", - "date": "2024-12-18", - "size": 1073741824 - } - ] + "name": "hello!", + "identifier": "fyi.zxcvbn.repo.test", + "iconURL": "https://example.com/path/to/some/icon.png", + "caption": "a *short* description of your repo!", + "description": "this can be a longer description and include stuff like your links or something, idk", + "apps": [ + { + "name": "app name", + "developerName": "zx", + "bundleID": "fyi.zxcvbn.app", + "caption": "just like the repo's caption", + "description": "just like the repo's description", + "downloadURL": "https://example.com/path/to/some/app.ipa", + "iconURL": "https://example.com/hopefully/path/to/itunes/icon.png", + "version": "1.2", + "date": "2024-12-18", + "size": 1073741824 + } + ], + "permissions": { + "fyi.zxcvbn.app": { + "entitlements": [ + "aps-environment", + "com.apple.developer.associated-domains", + "keychain-access-groups", + "com.apple.security.application-groups" + ], + "privacy": { + "NSBluetoothAlwaysUsageDescription": "example", + "NSFaceIDUsageDescription": "for face id" + } + } + } } ``` @@ -46,6 +60,8 @@ you can see the output for this example in the `examples/` directory. `description` is the big text describing your repo. this is only shown in some apps so feel free to exclude it. +`permissions` translates to the `appPermissions` key in the AltStore format. this is required according to my memory and [AltStore docs](https://faq.altstore.io/developers/make-a-source#apppermissions-app-permissions-object). if you're going to upload multiple versions of an app with the same bundle id, chances are their permissions are the same too, which is why `permissions` is a map of bundle ids to permissions. + ### app `developerName` is only shown in some apps. exclude it if you want. diff --git a/cmd/.DS_Store b/cmd/.DS_Store new file mode 100644 index 0000000..18c8e66 Binary files /dev/null and b/cmd/.DS_Store differ diff --git a/converters.go b/converters.go index 155c849..71b2d7e 100644 --- a/converters.go +++ b/converters.go @@ -96,6 +96,10 @@ func ConvertToAltStore(uni *repos.Universal) *repos.AltStore { IconURL: orig.IconURL, } + if permissions, ok := uni.Permissions[bundle]; ok { + app.Permissions = permissions + } + for _, idx := range idxs { origIdx := uni.Apps[idx] app.Versions = append(app.Versions, repos.AltStoreAppVersion{ @@ -135,3 +139,14 @@ func ConvertToScarlet(uni *repos.Universal) *repos.Scarlet { return &r } + +// a convenience function that returns all formatted repos. +func ConvertToAll(uni *repos.Universal) *repos.All { + return &repos.All{ + ESign: ConvertToESign(uni), + GBox: ConvertToGBox(uni), + Feather: ConvertToFeather(uni), + AltStore: ConvertToAltStore(uni), + Scarlet: ConvertToScarlet(uni), + } +} diff --git a/example.json b/example.json index 1d42716..8a8d404 100644 --- a/example.json +++ b/example.json @@ -5,17 +5,31 @@ "caption": "a *short* description of your repo!", "description": "this can be a longer description and include stuff like your links or something, idk", "apps": [ - { - "name": "app name", - "developerName": "zx", - "bundleID": "fyi.zxcvbn.app", - "caption": "just like the repo's caption", - "description": "just like the repo's description", - "downloadURL": "https://example.com/path/to/some/app.ipa", - "iconURL": "https://example.com/hopefully/path/to/itunes/icon.png", - "version": "1.2", - "date": "2024-12-18", - "size": 1073741824 + { + "name": "app name", + "developerName": "zx", + "bundleID": "fyi.zxcvbn.app", + "caption": "just like the repo's caption", + "description": "just like the repo's description", + "downloadURL": "https://example.com/path/to/some/app.ipa", + "iconURL": "https://example.com/hopefully/path/to/itunes/icon.png", + "version": "1.2", + "date": "2024-12-18", + "size": 1073741824 + } + ], + "permissions": { + "fyi.zxcvbn.app": { + "entitlements": [ + "aps-environment", + "com.apple.developer.associated-domains", + "keychain-access-groups", + "com.apple.security.application-groups" + ], + "privacy": { + "NSBluetoothAlwaysUsageDescription": "example", + "NSFaceIDUsageDescription": "for face id" } - ] + } + } } \ No newline at end of file diff --git a/examples/example.altstore.json b/examples/example.altstore.json index f1dd398..93581d7 100755 --- a/examples/example.altstore.json +++ b/examples/example.altstore.json @@ -17,7 +17,19 @@ "downloadURL": "https://example.com/path/to/some/app.ipa", "localizedDescription": "just like the repo's description" } - ] + ], + "appPermissions": { + "entitlements": [ + "aps-environment", + "com.apple.developer.associated-domains", + "keychain-access-groups", + "com.apple.security.application-groups" + ], + "privacy": { + "NSBluetoothAlwaysUsageDescription": "example", + "NSFaceIDUsageDescription": "for face id" + } + } } ] } \ No newline at end of file diff --git a/repos/all.go b/repos/all.go new file mode 100644 index 0000000..7fe4762 --- /dev/null +++ b/repos/all.go @@ -0,0 +1,9 @@ +package repos + +type All struct { + ESign *ESign + GBox *GBox + Feather *Feather + AltStore *AltStore + Scarlet *Scarlet +} diff --git a/repos/altstore.go b/repos/altstore.go index e858346..b416683 100644 --- a/repos/altstore.go +++ b/repos/altstore.go @@ -16,6 +16,7 @@ type AltStoreApp struct { Description string `json:"localizedDescription"` IconURL string `json:"iconURL"` Versions []AltStoreAppVersion `json:"versions"` + Permissions UniversalPermissions `json:"appPermissions"` } type AltStore struct { diff --git a/repos/universal.go b/repos/universal.go index cc44b82..9e269ac 100644 --- a/repos/universal.go +++ b/repos/universal.go @@ -1,5 +1,10 @@ package repos +type UniversalPermissions struct { + Entitlements []string `json:"entitlements"` + Privacy map[string]string `json:"privacy"` +} + type UniversalApp struct { Name string `json:"name"` DeveloperName string `json:"developerName"` @@ -14,10 +19,11 @@ type UniversalApp struct { } type Universal struct { - Name string `json:"name"` - Identifier string `json:"identifier"` - IconURL string `json:"iconURL"` - Caption string `json:"caption"` - Description string `json:"description"` - Apps []UniversalApp `json:"apps"` + Name string `json:"name"` + Identifier string `json:"identifier"` + IconURL string `json:"iconURL"` + Caption string `json:"caption"` + Description string `json:"description"` + Apps []UniversalApp `json:"apps"` + Permissions map[string]UniversalPermissions `json:"permissions"` }