Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rebundling apps with app extensions (.share only for now) #124

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,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 signAppDirectory (ipadir, skipNested) {
fchk(arguments, ['string', 'boolean']);
await this._pullMobileProvision();
Expand Down Expand Up @@ -162,8 +176,7 @@ class Applesign {
if (this.config.insertLibrary !== undefined) {
await insertLibrary(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');
Expand Down
13 changes: 8 additions & 5 deletions lib/info-plist.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ const plist = require('simple-plist');
const appleDevices = ['iPhone', 'iPad', 'AppleTV', 'AppleWatch'];
const objectFromEntries = (x) => Array.from(x, (k) => ({ [k]: [] })); // ES7 is not yet here

function fix (file, options, emit) {
const { appdir, bundleid, forceFamily, allowHttp } = options;
if (!file || !appdir) {
throw new Error('Invalid parameters for fixPlist');
function adjustInfoPlist (file, options, emit) {
let { bundleid, forceFamily, allowHttp } = options;
if (!file) {
throw new Error('Invalid parameters for adjustInfoPlist');
}
if (file.indexOf('.appex/') != -1) {
bundleid += '.share';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

network extensions may use: .network-extension so this is just a partial fix.

Probably the way to go is to check for the NSExtension array and see which is the NSExtensionPrincipalClass used for each appex

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.SiriExtension for NSExtension.NSExtensionPointIdentifier == com.apple.intents-service

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

com.apple.networkextension.packet-tunnel -> network-extension

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this happen only if bundleId is defined? AFAIK overriding the bundle id is optional

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOL for the single letter contributor

}
let changed = false;
const data = plist.readFileSync(file);
Expand Down Expand Up @@ -116,4 +119,4 @@ function supportedDevices (data) {
return have;
}

module.exports = fix;
module.exports = adjustInfoPlist;