Skip to content

Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.

C

feat: add mismatch bundle id warning

Vojtěch Škopekd58dbf758f14
diff --git a/README.md b/README.md
index 4eda725c..4e049da5 100644
--- a/README.md
+++ b/README.md
@@ -55,7 +55,23 @@ No IPA is distributed in this repo. [spoti.pw](https://spoti.pw) carries the cur
it is also a source for SideStore, AltStore and Feather: add `https://spoti.pw` and later builds
arrive on their own. Mod Settings → Updates checks the same place.
-The app installs as `com.spotify.client2`, next to the real Spotify rather than over it.
+The app keeps Spotify's own bundle id, `com.spotify.client`, so it installs over the real Spotify
+rather than next to it. That is deliberate: a rewritten bundle id has to match the App ID of the
+profile you sign with, and this build cannot know which profile that will be. Sign a mismatched
+pair and the app installs fine, but tapping the now playing card on the lock screen opens nothing.
+
+### Signing it yourself
+
+Which is what you have to watch for. Feather does not touch the bundle id unless you tell it to, so
+with a certificate whose App ID is fixed you end up with exactly that mismatched pair: set
+**Identifier** in Feather's signing options to the App ID shown in its certificates tab, and leave
+**PPQ protection** off, since it appends a random string to the bundle id and breaks the match
+again. AltStore, SideStore and Sideloadly register an App ID from the bundle id themselves and need
+none of this.
+
+You do not have to work out which of the two you got. A build the lock screen cannot open says so
+once on its first launch, and carries a red row at the top of Mod Settings for as long as it lasts;
+either one names the bundle id to sign under and copies it to the clipboard.
## Build it yourself
@@ -83,7 +99,9 @@ Put the decrypted `.ipa` in `ipa/`, then:
make install # the same, signed with your certificate and pushed to the iPhone over USB
`make install` reads `SIGN_P12`, `SIGN_PROFILE` and `SIGN_P12_PASSWORD` from `.signing.env`; copy
-`.signing.env.example` and fill it in. `BUNDLE_ID=` overrides the bundle id.
+`.signing.env.example` and fill it in. It signs under the App ID of your profile, which is what keeps
+the lock screen player working; `BUNDLE_ID=` overrides the bundle id, and is only safe when you know
+it equals that App ID.
The first build spends about a minute reading Spotify's remote-config flags out of your IPA into
`tweak/Sources/Features/Flags/SGFlagList.m`, so the flag list always matches the Spotify you built from. Later builds
diff --git a/scripts/install.sh b/scripts/install.sh
index 033eeec3..715f4cce 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -21,8 +21,10 @@ SIGNED="${IN%.ipa}-signed.ipa"
command -v zsign >/dev/null || { echo "missing zsign -> brew install zsign" >&2; exit 1; }
command -v ideviceinstaller >/dev/null || { echo "missing ideviceinstaller -> brew install ideviceinstaller" >&2; exit 1; }
-# A profile with a fixed App ID (signing services) may only install when the bundle id equals that
-# App ID. Try the IPA's own bundle id first; fall back to the App ID if iOS rejects the signature.
+# The bundle id has to equal the App ID of the profile. iOS may well install a mismatched pair, but
+# MediaRemote launches the now playing app by its application-identifier entitlement rather than by
+# CFBundleIdentifier, so tapping the lock screen card then asks for a bundle that does not exist and
+# nothing opens. A wildcard App ID needs no rewrite: the entitlement takes the IPA's own bundle id.
PROFILE_PLIST="$(mktemp)"
security cms -D -i "$SIGN_PROFILE" > "$PROFILE_PLIST" 2>/dev/null
APP_ID="$(plutil -extract Entitlements.application-identifier raw -o - "$PROFILE_PLIST" 2>/dev/null || true)"
@@ -34,17 +36,6 @@ sign() { # sign [bundle id]
zsign -k "$SIGN_P12" -p "$SIGN_P12_PASSWORD" -m "$SIGN_PROFILE" ${1:+-b "$1"} -z 1 -o "$SIGNED" "$IN" >/dev/null
}
-sign
+if [ -n "$APP_ID" ] && [ "$APP_ID" != "*" ]; then sign "$APP_ID"; else sign; fi
echo "==> installing $SIGNED"
-set +e
-OUTPUT="$(ideviceinstaller ${WIFI:+-n} install "$SIGNED" 2>&1)"
-STATUS=$?
-set -e
-echo "$OUTPUT" | tail -3
-if [ $STATUS -ne 0 ] && [ -n "$APP_ID" ] && [ "$APP_ID" != "*" ] && echo "$OUTPUT" | grep -qiE "entitlement|application-identifier|signature|ApplicationVerificationFailed"; then
- echo "==> iOS rejected that bundle id with this profile, retrying as $APP_ID"
- sign "$APP_ID"
- ideviceinstaller ${WIFI:+-n} install "$SIGNED" 2>&1 | tail -3
-elif [ $STATUS -ne 0 ]; then
- exit $STATUS
-fi
+ideviceinstaller ${WIFI:+-n} install "$SIGNED" 2>&1 | tail -3
diff --git a/scripts/pipeline.sh b/scripts/pipeline.sh
index b12beadf..09020469 100755
--- a/scripts/pipeline.sh
+++ b/scripts/pipeline.sh
@@ -14,8 +14,14 @@ set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
THEOS="${THEOS:-$HOME/theos}"
FLEX_DEB="$ROOT/vendor/com.hopeless.autoflex_0.0.1_iphoneos-arm.deb"
-# Installs next to the real Spotify instead of replacing it. Override: BUNDLE_ID=com.spotify.client make build
-BUNDLE_ID="${BUNDLE_ID:-com.spotify.client2}"
+# The bundle id is left alone by default, the way EeveeSpotify and the YouTube mods leave it. Rewriting
+# it only works when it ends up equal to the App ID of the profile that signs the IPA, and this build
+# has no idea what that profile will be -- it is picked later, in Feather or whatever else the person
+# signing uses. A mismatched pair still installs, but MediaRemote launches the now playing app by its
+# application-identifier entitlement, so tapping the lock screen card asks for a bundle that does not
+# exist and nothing opens. Set BUNDLE_ID only if you know it matches your App ID; scripts/install.sh
+# reads that App ID out of the profile and can do it safely.
+BUNDLE_ID="${BUNDLE_ID:-}"
mkdir -p "$ROOT/out"
IN="" OUT="" WITH_FLEX=1 INSTALL=0
@@ -68,7 +74,7 @@ FILES=("$TWEAK_DEB")
echo "==> injecting"
# -w drops the Watch app: its companion-app key would still name com.spotify.client and block the install.
-cyan -i "$IN" -o "$OUT" -f "${FILES[@]}" -l "$ROOT/plist/liquid-glass.plist" -b "$BUNDLE_ID" -w -s --overwrite
+cyan -i "$IN" -o "$OUT" -f "${FILES[@]}" -l "$ROOT/plist/liquid-glass.plist" ${BUNDLE_ID:+-b "$BUNDLE_ID"} -w -s --overwrite
echo "==> done: $OUT"
[ "$INSTALL" = 1 ] && exec "$ROOT/scripts/install.sh" "$OUT"
diff --git a/site/altstore.json b/site/altstore.json
index 1046384f..d9fd23b2 100644
--- a/site/altstore.json
+++ b/site/altstore.json
@@ -7,7 +7,7 @@
"apps": [
{
"name": "spotifyglass",
- "bundleIdentifier": "com.spotify.client2",
+ "bundleIdentifier": "com.spotify.client",
"developerName": "vojta",
"subtitle": "Liquid Glass for Spotify",
"localizedDescription": "Like and dislike back on the lock screen widget, speed control and trim silence for music and not only podcasts, Spotify's own Liquid Glass with every flag of it on at once, a pure black AMOLED background, picture in picture, lyrics translations and vocal removal, a tab bar you reorder or add your own links to, no ad on app open and no upsells or tooltips, telemetry blocking with a count of what it stopped, and an editor for every one of Spotify's internal flags.\n\nPurely cosmetic. It does not unlock Premium.",
diff --git a/site/scarlet.json b/site/scarlet.json
index defd1ea1..0293da87 100644
--- a/site/scarlet.json
+++ b/site/scarlet.json
@@ -7,7 +7,7 @@
{
"name": "spotifyglass",
"version": "0.14.1-9.1.78",
- "bundleID": "com.spotify.client2",
+ "bundleID": "com.spotify.client",
"down": "https://files.catbox.moe/REPLACE.ipa",
"description": "Like and dislike back on the lock screen widget, speed control and trim silence for music and not only podcasts, Spotify's own Liquid Glass with every flag of it on at once, a pure black AMOLED background, picture in picture, lyrics translations and vocal removal, a tab bar you reorder or add your own links to, no ad on app open and no upsells or tooltips, telemetry blocking with a count of what it stopped, and an editor for every one of Spotify's internal flags.\n\nPurely cosmetic. It does not unlock Premium.",
"icon": "https://spoti.pw/icon.png",
diff --git a/tweak/Sources/Features/About/About.h b/tweak/Sources/Features/About/About.h
index 0e544133..20a4f28b 100644
--- a/tweak/Sources/Features/About/About.h
+++ b/tweak/Sources/Features/About/About.h
@@ -12,4 +12,14 @@ NSString *SGUpdateNotes(void);
NSString *SGUpdateStatus(void);
void SGCheckForUpdate(BOOL force);
+
+// Whether the now playing card on the lock screen can open this build. It depends on the signature,
+// not on the mod: iOS launches by the App ID of the application-identifier entitlement, so a build
+// whose bundle id is not that App ID cannot be opened from the card. Signing.m says so once.
+extern NSString *const SGSigningHelpURL;
+NSString *SGSigningAppIdentifier(void); // App ID without the team prefix, nil if unreadable
+BOOL SGSigningOpensFromLockScreen(void); // YES when unreadable, so a build that works stays quiet
+SGModRow *SGSigningWarningRow(void); // nil while the signature is sound
+void SGCheckSigningOnce(void);
+
SGModSection *SGAboutSection(void);
diff --git a/tweak/Sources/Features/About/Signing.m b/tweak/Sources/Features/About/Signing.m
new file mode 100644
index 00000000..2cb1d4a1
--- /dev/null
+++ b/tweak/Sources/Features/About/Signing.m
@@ -0,0 +1,121 @@
+// Whether the lock screen can open this build at all. MediaRemote launches the now playing app by
+// the App ID in its application-identifier entitlement, not by CFBundleIdentifier, so a build signed
+// under a profile whose App ID is not the bundle id installs and plays but cannot be opened from the
+// now playing card: iOS asks for a bundle that is not installed and offers the App Store instead.
+// The signature decides this and nothing in the app can change it, so all the mod does is say so --
+// once on the first launch under a signature, and from a red row at the top of Mod Settings for as
+// long as it lasts. Both land on the same sheet, which names the bundle id to sign under and copies
+// it, because that one string is the whole fix.
+#import "Core/SGCore.h"
+#import "Settings/SGPageStyle.h"
+#import "About.h"
+#import <dlfcn.h>
+
+NSString *const SGSigningHelpURL = @"https://github.com/skopevoj/spoti.pw#signing-it-yourself";
+
+static NSString *const kWarned = @"spotifyglass.signing.warned";
+
+// SecTaskCopyValueForEntitlement is not in the iOS SDK, so it is resolved at runtime like the rest
+// of the private API the mod uses. A build that cannot read its own entitlement stays quiet.
+NSString *SGSigningAppIdentifier(void) {
+ static NSString *cached;
+ static dispatch_once_t once;
+ dispatch_once(&once, ^{
+ void *security = dlopen("/System/Library/Frameworks/Security.framework/Security", RTLD_LAZY);
+ if (!security) return;
+ CFTypeRef (*createFromSelf)(CFAllocatorRef) = dlsym(security, "SecTaskCreateFromSelf");
+ CFTypeRef (*copyValue)(CFTypeRef, CFStringRef, CFErrorRef *) = dlsym(security, "SecTaskCopyValueForEntitlement");
+ if (!createFromSelf || !copyValue) return;
+ CFTypeRef task = createFromSelf(NULL);
+ if (!task) return;
+ CFTypeRef value = copyValue(task, CFSTR("application-identifier"), NULL);
+ CFRelease(task);
+ if (!value) return;
+ if (CFGetTypeID(value) == CFStringGetTypeID()) {
+ NSString *identifier = (__bridge NSString *)value;
+ NSRange dot = [identifier rangeOfString:@"."]; // drop the team prefix
+ cached = dot.location == NSNotFound ? [identifier copy]
+ : [identifier substringFromIndex:dot.location + 1];
+ }
+ CFRelease(value);
+ });
+ return cached;
+}
+
+// Unreadable counts as fine: a guess here would cry wolf at a build that works.
+BOOL SGSigningOpensFromLockScreen(void) {
+ NSString *appID = SGSigningAppIdentifier();
+ return !appID || [appID isEqualToString:NSBundle.mainBundle.bundleIdentifier];
+}
+
+static UIViewController *topController(void) {
+ UIViewController *top = nil;
+ for (UIScene *scene in UIApplication.sharedApplication.connectedScenes) {
+ if (![scene isKindOfClass:UIWindowScene.class]) continue;
+ for (UIWindow *window in ((UIWindowScene *)scene).windows) {
+ if (window.hidden) continue;
+ if (!top || window.isKeyWindow) top = window.rootViewController;
+ }
+ }
+ while (top.presentedViewController) top = top.presentedViewController;
+ return top;
+}
+
+// The fix is one string, so the sheet leads with it and Copy is the first action: whoever reads this
+// is on their way back to Feather to paste it into the identifier field.
+static void showFix(void) {
+ NSString *appID = SGSigningAppIdentifier();
+ NSString *bundleID = NSBundle.mainBundle.bundleIdentifier ?: @"?";
+ UIViewController *top = topController();
+ if (!appID || !top) return;
+ NSString *message = [NSString stringWithFormat:
+ @"Sign Spotify again with the bundle id set to\n\n%@\n\n"
+ @"In Feather that is the Identifier field; leave PPQ protection off, it appends a random "
+ @"string and breaks this again.\n\n"
+ @"Why: this build is installed as %@ but signed under the App ID %@. iOS opens the now "
+ @"playing card by the App ID, so it asks for an app that is not there. Nothing else in the "
+ @"mod is affected.", appID, bundleID, appID];
+ UIAlertController *sheet = [UIAlertController alertControllerWithTitle:@"The lock screen cannot open Spotify"
+ message:message
+ preferredStyle:UIAlertControllerStyleAlert];
+ [sheet addAction:[UIAlertAction actionWithTitle:@"Copy the bundle id" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
+ UIPasteboard.generalPasteboard.string = appID;
+ }]];
+ [sheet addAction:[UIAlertAction actionWithTitle:@"Read more" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
+ SGOpenURL(SGSigningHelpURL);
+ }]];
+ [sheet addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:nil]];
+ [top presentViewController:sheet animated:YES completion:nil];
+}
+
+// nil while the signature is sound, which is what keeps the row out of Mod Settings entirely.
+SGModRow *SGSigningWarningRow(void) {
+ if (SGSigningOpensFromLockScreen()) return nil;
+ return SGWarningRow(@"The lock screen cannot open Spotify",
+ @"Signed under a different name than it is installed under. Tap for the one "
+ @"line that fixes it.",
+ ^{ showFix(); });
+}
+
+// Said once per signature: re-signing under a different App ID is a new mistake and says so again,
+// but a build that is simply left broken does not nag on every launch. The row stays either way.
+void SGCheckSigningOnce(void) {
+ if (SGSigningOpensFromLockScreen()) return;
+ NSString *appID = SGSigningAppIdentifier();
+ NSUserDefaults *store = NSUserDefaults.standardUserDefaults;
+ SGLog(@"signing: installed as %@ but signed under %@; the now playing card cannot open this build",
+ NSBundle.mainBundle.bundleIdentifier, appID);
+ if ([[store stringForKey:kWarned] isEqualToString:appID]) return;
+ [store setObject:appID forKey:kWarned];
+
+ // The first activation, plus a moment for Spotify's own start-up screens to get out of the way.
+ __block id token = [NSNotificationCenter.defaultCenter addObserverForName:UIApplicationDidBecomeActiveNotification
+ object:nil
+ queue:nil
+ usingBlock:^(NSNotification *note) {
+ [NSNotificationCenter.defaultCenter removeObserver:token];
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+ showFix();
+ });
+ }];
+}
diff --git a/tweak/Sources/Settings/SGModPage.h b/tweak/Sources/Settings/SGModPage.h
index 1ac936b8..79776a1f 100644
--- a/tweak/Sources/Settings/SGModPage.h
+++ b/tweak/Sources/Settings/SGModPage.h
@@ -17,6 +17,8 @@
@property (nonatomic, copy) NSString *(^value)(void);
@property (nonatomic, copy) void (^action)(void);
@property (nonatomic, copy) NSString *warning;
+@property (nonatomic, strong) UIColor *color; // title, subtitle and symbol, for a warning row
+@property (nonatomic, copy) NSString *symbol;
@end
@interface SGModSection : NSObject
@@ -41,6 +43,8 @@ SGModRow *SGFlagRow(NSString *title, NSString *key); // forces one of Spotify'
SGModRow *SGKillRow(NSString *title, NSString *key); // forces a flag Spotify ships on off
SGModRow *SGStatRow(NSString *title, NSString *(^value)(void));
SGModRow *SGActionRow(NSString *title, NSString *subtitle, void (^action)(void));
+// Red, with a warning symbol: something is wrong and tapping the row says what to do about it.
+SGModRow *SGWarningRow(NSString *title, NSString *subtitle, void (^action)(void));
SGModRow *SGPageRow(NSString *title, UIViewController *(^page)(void));
SGModRow *SGLinkRow(NSString *title, NSString *subtitle, NSString *url);
SGModRow *SGStatActionRow(NSString *title, NSString *subtitle, NSString *(^value)(void), void (^action)(void));
diff --git a/tweak/Sources/Settings/SGModPage.m b/tweak/Sources/Settings/SGModPage.m
index ce9724ba..6f826f63 100644
--- a/tweak/Sources/Settings/SGModPage.m
+++ b/tweak/Sources/Settings/SGModPage.m
@@ -70,6 +70,15 @@ SGModRow *SGActionRow(NSString *title, NSString *subtitle, void (^action)(void))
return row;
}
+// Red, with a warning symbol. SGFillCell tints the title and the symbol; the cell below takes the
+// colour down to the subtitle too, so the whole row reads as the warning it is.
+SGModRow *SGWarningRow(NSString *title, NSString *subtitle, void (^action)(void)) {
+ SGModRow *row = SGActionRow(title, subtitle, action);
+ row.color = SGRed();
+ row.symbol = @"exclamationmark.triangle.fill";
+ return row;
+}
+
// No subtitle: a list of pages reads as a list, not as a wall of explanations.
SGModRow *SGPageRow(NSString *title, UIViewController *(^page)(void)) {
SGModRow *row = [SGModRow new];
@@ -206,7 +215,12 @@ static BOOL flagRowLocked(SGModRow *row) {
- (UITableViewCell *)tableView:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)path {
UITableViewCell *cell = SGDequeueCell(table, @"row");
SGModRow *row = [self rowAt:path];
- SGFillCell(cell, row.title, row.subtitle, nil, nil);
+ SGFillCell(cell, row.title, row.subtitle, row.color, row.symbol);
+ if (row.color) {
+ UIListContentConfiguration *content = (UIListContentConfiguration *)cell.contentConfiguration;
+ content.secondaryTextProperties.color = row.color;
+ cell.contentConfiguration = content;
+ }
if (row.key) {
UISwitch *toggle = [UISwitch new];
diff --git a/tweak/Sources/Settings/SGModSettings.x b/tweak/Sources/Settings/SGModSettings.x
index 6983fc65..de169cde 100644
--- a/tweak/Sources/Settings/SGModSettings.x
+++ b/tweak/Sources/Settings/SGModSettings.x
@@ -28,7 +28,12 @@ static char kRowKey, kInsetKey;
static UIViewController *modSettingsPage(void) {
// Opening the page is the only thing that asks; the cache keeps it to once every six hours.
SGCheckForUpdate(NO);
- return [[SGModPage alloc] initWithTitle:@"Mod Settings" intro:nil sections:@[
+ NSMutableArray<SGModSection *> *sections = [NSMutableArray array];
+ // A build the lock screen cannot open leads the page, above the tweaks: it is the one thing here
+ // that no switch can put right, and it is worth reading before anything else.
+ SGModRow *signing = SGSigningWarningRow();
+ if (signing) [sections addObject:SGSection(nil, @[signing])];
+ [sections addObjectsFromArray:@[
SGSection(nil, @[
SGPageRow(@"UI Tweaks", ^UIViewController *{ return SGAppearanceSettingsPage(); }),
SGPageRow(@"Navbar", ^UIViewController *{ return SGNavbarSettingsPage(); }),
@@ -44,7 +49,8 @@ static UIViewController *modSettingsPage(void) {
SGPageRow(@"All flags", ^UIViewController *{ return SGAllFlagsPage(); }),
]),
SGAboutSection(),
- ] footer:nil];
+ ]];
+ return [[SGModPage alloc] initWithTitle:@"Mod Settings" intro:nil sections:sections footer:nil];
}
#pragma mark - row in the settings list
@@ -169,4 +175,5 @@ static BOOL isSettingsRoot(UIViewController *list) {
%init;
SGRequireClasses(@[@"_TtC21Settings_PlatformImpl26SettingsListViewController"]);
SGRegisterPages();
+ SGCheckSigningOnce();
}
diff --git a/tweak/Sources/Settings/SGPageStyle.h b/tweak/Sources/Settings/SGPageStyle.h
index 3f0e67ea..f8254c2d 100644
--- a/tweak/Sources/Settings/SGPageStyle.h
+++ b/tweak/Sources/Settings/SGPageStyle.h
@@ -4,6 +4,7 @@
UIColor *SGGrey(void);
UIColor *SGGreen(void);
+UIColor *SGRed(void);
UIColor *SGPageBackground(void);
UIFont *SGTitleFont(void);
UIFont *SGSubtitleFont(void);
diff --git a/tweak/Sources/Settings/SGPageStyle.m b/tweak/Sources/Settings/SGPageStyle.m
index 8a61680c..91d56dbf 100644
--- a/tweak/Sources/Settings/SGPageStyle.m
+++ b/tweak/Sources/Settings/SGPageStyle.m
@@ -67,6 +67,7 @@ void SGInsetForBars(UITableView *table) {
}
UIColor *SGGreen(void) { return [UIColor colorWithRed:0x1E / 255.0 green:0xD7 / 255.0 blue:0x60 / 255.0 alpha:1]; }
+UIColor *SGRed(void) { return [UIColor colorWithRed:0xF1 / 255.0 green:0x5E / 255.0 blue:0x6B / 255.0 alpha:1]; }
UIColor *SGPageBackground(void) { return [UIColor colorWithWhite:0x12 / 255.0 alpha:1]; }
const CGFloat SGSectionHeaderHeight = 38;