Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.
C
feat: Clear Keychain on the Mod page removes every API key Vitrine keeps
My-Name-Is-Jeffe98e44e8496d
diff --git a/docs/tweaks.md b/docs/tweaks.mdindex 77a3f54b..6ddec43d 100644--- a/docs/tweaks.md+++ b/docs/tweaks.md@@ -669,7 +669,9 @@ App:Every key a feature stores starts with `spotifyglass.`, whatever it holds: Reset all settings onthe Mod page removes by that prefix and has no list to keep up to date. It leaves `SGKeyStock` behind,-which makes every unset switch read off, so a reset is stock Spotify whatever switches exist.+which makes every unset switch read off, so a reset is stock Spotify whatever switches exist. The API keys+(each AI translator's, the OpenAI-compatible server, Spicy Lyrics') live in the Keychain, which a reset leaves+alone; Clear Keychain beside it deletes each by its own service and keeps the settings.A hook reads its switch when it runs (`SGEnabled`, `SGHidden`, `SGFlag` from Core/SGPrefs.h), so achange shows after Spotify restarts; the tab editor on the Navbar page is the exception and applies as soon as the bar lays@@ -864,7 +866,7 @@ Auto / Off / On control per flag (a text field for the number and text ones), an(the row reads out where the build stands and opens the changelog of everything newer than it, readfrom the releases Release Please cuts, with Check now, the release to get, all the releases and Tellme when one is out, the sheet a newer release brings up a few seconds after Spotify opens), the-build and Spotify's version, the site and the repo, What's New and the welcome tour again, and Reset all+build and Spotify's version, the site and the repo, What's New and the welcome tour again, Clear Keychain and Reset allsettings. A flag switch on a page forces that one flag and off leaves Spotify's own value, so the Allflags page is where a flag goes back to Auto. Spotify ships its newer design behind several flags atonce, and the redesign is built on it (the glass navigation bar, the new player slider, the sheet stylediff --git a/tweak/Sources/App/About/AboutSettings.m b/tweak/Sources/App/About/AboutSettings.mindex cae8f5f2..713d8ad9 100644--- a/tweak/Sources/App/About/AboutSettings.m+++ b/tweak/Sources/App/About/AboutSettings.m@@ -4,6 +4,8 @@#import "App/Onboarding/Onboarding.h"#import "Shared/AutoMix/AutoMix.h"#import "Shared/Lossless/LosslessQuality.h"+#import "Shared/LyricsSources/LyricsSources.h"+#import "Shared/LyricsTranslation/LyricsTranslation.h"// Every key of the mod's is under one prefix, so a reset is a sweep of the defaults with the stock// marker of SGPrefs.h left behind; the hooks read them at launch, so it ends in a restart.@@ -32,6 +34,20 @@ static void confirmReset(void) {[SGTopController() presentViewController:alert animated:YES completion:nil];}+// Reset all leaves the Keychain alone, so a key outlives a reset; this takes every item Vitrine keeps there.+static void confirmClearKeychain(void) {+ UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Clear Keychain?"+ message:@"The Gemini, OpenAI-compatible and Anthropic API keys, the OpenAI-compatible server and the Spicy Lyrics key are removed from this iPhone. Settings stay as they are."+ preferredStyle:UIAlertControllerStyleAlert];+ [alert addAction:[UIAlertAction actionWithTitle:@"Clear Keychain" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {+ SGAIForgetKeys();+ SGSpicyLyricsForgetKey();+ SGLog(@"reset: keychain cleared");+ }]];+ [alert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]];+ [SGTopController() presentViewController:alert animated:YES completion:nil];+}+static SGModRow *withSymbol(SGModRow *row, NSString *symbol) {row.symbol = symbol;return row;@@ -42,6 +58,8 @@ static SGModRow *withSymbol(SGModRow *row, NSString *symbol) {UIViewController *SGAboutPage(void) {SGModRow *reset = withSymbol(SGActionRow(@"Reset all settings", nil, ^{ confirmReset(); }), @"trash");reset.color = SGRed();+ SGModRow *clearKeys = withSymbol(SGActionRow(@"Clear Keychain", nil, ^{ confirmClearKeychain(); }), @"key");+ clearKeys.color = SGRed();NSString *spotify = SGSpotifyVersion();if ([SGSpotifyLikelyWorksVersions containsObject:spotify]) spotify = [spotify stringByAppendingString:@", likely works"];else if (![SGSpotifySupportedVersions containsObject:spotify]) spotify = [NSString stringWithFormat:@"%@, made for %@", spotify, SGSpotifyMadeFor];@@ -74,6 +92,6 @@ UIViewController *SGAboutPage(void) {withSymbol(SGActionRow(@"Share diagnostics", @"For a bug report: versions, ad counts, this launch's log and Spotify's config. Song names can show.",^{ SGShareDiagnostics(); }), @"stethoscope"),]),- SGSection(nil, @[reset]),+ SGSection(nil, @[clearKeys, reset]),] footer:nil];}diff --git a/tweak/Sources/Shared/LyricsSources/LyricsSources.h b/tweak/Sources/Shared/LyricsSources/LyricsSources.hindex 0f96846f..fde10123 100644--- a/tweak/Sources/Shared/LyricsSources/LyricsSources.h+++ b/tweak/Sources/Shared/LyricsSources/LyricsSources.h@@ -227,6 +227,8 @@ NSNumber *SGGeniusSongIn(NSDictionary *response, NSString *title, NSString *arti// lines, nil when it has none.extern NSString *const SGSpicyLyricsKey;BOOL SGSpicyLyricsKeySet(void);+// Removes the key from the Keychain (Mod > Clear Keychain).+void SGSpicyLyricsForgetKey(void);NSString *SGSpicyLyricsStatus(void);@class SGModRow;SGModRow *SGSpicyLyricsKeyRow(void);diff --git a/tweak/Sources/Shared/LyricsSources/SpicyLyrics.m b/tweak/Sources/Shared/LyricsSources/SpicyLyrics.mindex 5e62073f..1706f975 100644--- a/tweak/Sources/Shared/LyricsSources/SpicyLyrics.m+++ b/tweak/Sources/Shared/LyricsSources/SpicyLyrics.m@@ -441,6 +441,13 @@ static void setKey(NSString *key) {SGLyricsSetOrder(order);}+// Clear Keychain: the key goes and its refusal is forgotten; the lyrics order is a setting, so it stays.+void SGSpicyLyricsForgetKey(void) {+ storeKey(nil);+ sg_refused = nil;+ sg_refusedUntil = 0;+}+static void askForKey(NSString *problem) {NSString *how = @"Sign up at Spicy Lyrics for Developers, create an application, turn on client access with "@"No origin header allowed, and paste its publishable key (sl_pk_). The key stays on this iPhone.";diff --git a/tweak/Sources/Shared/LyricsTranslation/LyricsTranslation.h b/tweak/Sources/Shared/LyricsTranslation/LyricsTranslation.hindex 16f219e0..225b4e5e 100644--- a/tweak/Sources/Shared/LyricsTranslation/LyricsTranslation.h+++ b/tweak/Sources/Shared/LyricsTranslation/LyricsTranslation.h@@ -34,6 +34,8 @@ SGModRow *SGTranslateEverySongRow(void);// The chosen provider has its key, a model and, for an OpenAI-compatible one, a usable server URL.BOOL SGAITranslatorReady(void);+// Removes every provider's key and the OpenAI-compatible server from the Keychain (Mod > Clear Keychain).+void SGAIForgetKeys(void);// The menu item's words: "Gemini", "Anthropic", or an OpenAI-compatible server's model; and who gets the lyrics.NSString *SGAITranslatorName(void);NSString *SGAITranslatorRecipient(void);diff --git a/tweak/Sources/Shared/LyricsTranslation/LyricsTranslation.m b/tweak/Sources/Shared/LyricsTranslation/LyricsTranslation.mindex 59368870..39915ca4 100644--- a/tweak/Sources/Shared/LyricsTranslation/LyricsTranslation.m+++ b/tweak/Sources/Shared/LyricsTranslation/LyricsTranslation.m@@ -512,6 +512,15 @@ static void translatorChanged(void) {[NSNotificationCenter.defaultCenter postNotificationName:SGLyricsTranslationsDidChangeNotification object:nil];}+void SGAIForgetKeys(void) {+ // One delete per provider's own service, every account in it (key and server), never another app's items.+ for (NSUInteger i = 0; i < kProviderCount; i++) {+ SecItemDelete((__bridge CFDictionaryRef)@{(__bridge id)kSecClass: (__bridge id)kSecClassGenericPassword,+ (__bridge id)kSecAttrService: kProviders[i].service});+ }+ translatorChanged();+}+static void configure(UITextField *field, NSString *placeholder) {field.placeholder = placeholder;field.autocorrectionType = UITextAutocorrectionTypeNo;