From f9620415a5d403fdc980c04d71cba86f87b78082 Mon Sep 17 00:00:00 2001 From: pancake Date: Thu, 6 Nov 2025 21:42:06 +0100 Subject: [PATCH] Fix rebundling app extensions (Only `.share` for now) --- index.ts | 17 +++++++++++++++-- lib/info-plist.ts | 10 +++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/index.ts b/index.ts index d5b996c..0ad443e 100644 --- a/index.ts +++ b/index.ts @@ -143,6 +143,20 @@ class Applesign { } } + async adjustAllInfoPlists() { + const infoPlistPath = path.join(this.config.appdir, "Info.plist"); + adjustInfoPlist(infoPlistPath, this.config, this.emit.bind(this)); + const ls = new AppDirectory(); + const res = await ls.loadFromDirectory(this.config.appdir); + for (let appex of ls.appexs) { + const lidx = appex.lastIndexOf("/"); + if (lidx !== -1) { + const plistPath = path.join(appex.substring(0, lidx), "Info.plist"); + adjustInfoPlist(plistPath, this.config, this.emit.bind(this)); + } + } + } + async signAppDirectoryInternal(ipadir: string, skipNested: boolean) { fchk(arguments, ["string", "boolean"]); await this._pullMobileProvision(); @@ -174,8 +188,7 @@ class Applesign { if (this.config.insertLibrary !== undefined) { await injectLibrary(this.config); } - const infoPlistPath = path.join(this.config.appdir, "Info.plist"); - adjustInfoPlist(infoPlistPath, this.config, this.emit.bind(this)); + await this.adjustAllInfoPlists(); if (!this.config.pseudoSign) { if (!this.config.mobileprovision) { throw new Error("warning: No mobile provisioning file provided"); diff --git a/lib/info-plist.ts b/lib/info-plist.ts index 74d081c..969ff47 100644 --- a/lib/info-plist.ts +++ b/lib/info-plist.ts @@ -15,13 +15,17 @@ function createEmptyArraysObject(keys: string[]): Record { return Object.fromEntries(keys.map((key) => [key, []])); } -export default function fix( +export default function adjustInfoPlist( file: string, options: ConfigOptions, emit: any, ): void { - if (!options.appdir) { - throw new Error("Invalid parameters for fixPlist"); + let { bundleid, forceFamily, allowHttp } = options; + if (!file) { + throw new Error("Invalid parameters for adjustInfoPlist"); + } + if (file.indexOf(".appex/") != -1) { + bundleid += ".share"; } let changed = false; const data = plist.readFileSync(file);