mirror of
https://github.com/whoeevee/EeveeSpotifyReborn.git
synced 2026-01-09 00:23:20 +01:00
remove siri play-as-radio restriction
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import Orion
|
||||
import Intents
|
||||
|
||||
class INMediaItemHook: ClassHook<INMediaItem> {
|
||||
func identifier() -> String {
|
||||
var identifier = orig.identifier()
|
||||
|
||||
if identifier.contains("play-command") {
|
||||
let components = identifier.components(separatedBy: ":")
|
||||
let jsonData = Data(base64Encoded: components[2])!
|
||||
var json = try! JSONSerialization.jsonObject(with: jsonData) as! [String: Any]
|
||||
|
||||
if let feedbackDetails = json["feedback_details"] as? [String: Any],
|
||||
feedbackDetails["restriction"] as? String == "play-as-radio" {
|
||||
var context = json["context"] as! [String: Any]
|
||||
|
||||
let urlString = context["url"] as! String
|
||||
context["url"] = urlString.removeMatches(":station")
|
||||
|
||||
json["context"] = context
|
||||
|
||||
let newData = try! JSONSerialization.data(withJSONObject: json)
|
||||
identifier = "spotify:play-command:\(newData.base64EncodedString())"
|
||||
}
|
||||
}
|
||||
|
||||
return identifier
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user