remove siri play-as-radio restriction

This commit is contained in:
eevee
2025-06-15 05:03:39 +03:00
parent 58fe124ce6
commit 727fd664ef
2 changed files with 29 additions and 0 deletions
@@ -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
}
}