🐑 naive alt-store support

Naive shot at implementing alt store support. Might still be missing important
bits and pices I'm not aware of.
This commit is contained in:
Michael Pöhn 2024-01-29 16:10:34 +01:00
parent 6a84fe1ae8
commit e7a2cb41c4
No known key found for this signature in database
GPG Key ID: 725F386C05529A5A
3 changed files with 52 additions and 0 deletions

View File

@ -4155,6 +4155,7 @@ def is_repo_file(filename, for_gpg_signing=False):
if isinstance(filename, str):
filename = filename.encode('utf-8', errors="surrogateescape")
ignore_files = [
b'altstore-index.json',
b'entry.jar',
b'index-v1.jar',
b'index.css',

View File

@ -71,6 +71,7 @@ def _get_index_excludes(repo_section):
"""
indexes = [
os.path.join(repo_section, 'altstore-index.json'),
os.path.join(repo_section, 'entry.jar'),
os.path.join(repo_section, 'entry.json'),
os.path.join(repo_section, 'entry.json.asc'),

View File

@ -2372,6 +2372,48 @@ def prepare_apps(apps, apks, repodir):
return apps_with_packages
def altstore_index(apps, apks, config, repodir, indent=None):
"""build altstore index for iOS (.ipa) apps
builds index files based on:
https://faq.altstore.io/distribute-your-apps/updating-apps
"""
for lang in ['en']:
idx = {
'name': config['repo_name'],
'description': config['repo_description'],
'apps': [],
}
for packageName, app in apps.items():
# print(app.keys())
print( app['Name'],'.', app['AutoName'])
versions = []
for apk in apks:
if apk['packageName'] == packageName and apk.get('apkName', '').lower().endswith('.ipa'):
v = {
"version": apk["versionName"],
# "buildVersion": "1",
"date": apk["added"].strftime("%Y-%m-%d"),
"localizedDescription": "",
"downloadURL": f"{config['repo_url']}/{apk['apkName']}",
"size": apk['size'],
"minOSVersion": "1.0",
"maxOSVersion": "18.0",
}
versions.append(v)
if len(versions) > 0:
idx['apps'].append({
"name": app.get("Name") or app.get("AutoName"),
'bundleIdentifier': packageName,
'versions': versions,
})
with open(os.path.join(repodir, f'altstore-index.json'), "w", encoding="utf-8") as f:
json.dump(idx, f, indent=indent)
config = None
options = None
start_timestamp = time.gmtime()
@ -2583,6 +2625,14 @@ def main():
# Make the index for the main repo...
fdroidserver.index.make(repoapps, apks, repodirs[0], False)
print(repoapps)
altstore_index(
repoapps,
apks,
config,
repodirs[0],
indent=2 if options.pretty else None
)
git_remote = config.get('binary_transparency_remote')
if git_remote or os.path.isdir(os.path.join('binary_transparency', '.git')):