Remove dead fallback token, add error log if capi call fails (#1289)
I tested and the fallback key you are using is dead. 401s. Unusable.
This commit is contained in:
parent
670648e3a2
commit
a8190836b9
1 changed files with 6 additions and 39 deletions
|
@ -56,37 +56,6 @@ Vue.component("animated-number", {
|
|||
},
|
||||
});
|
||||
|
||||
function fallbackinitMusicKit() {
|
||||
const request = new XMLHttpRequest();
|
||||
|
||||
function loadAlternateKey() {
|
||||
let parsedJson = JSON.parse(this.responseText);
|
||||
MusicKit.configure({
|
||||
developerToken: parsedJson.developerToken,
|
||||
app: {
|
||||
name: "Apple Music",
|
||||
build: "1978.4.1",
|
||||
version: "1.0",
|
||||
},
|
||||
sourceType: 24,
|
||||
suppressErrorDialog: true,
|
||||
});
|
||||
setTimeout(() => {
|
||||
app.init();
|
||||
if (app.cfg.visual.window_background_style == "mica" && !app.isDev) {
|
||||
app.spawnMica();
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
request.addEventListener("load", loadAlternateKey);
|
||||
request.open(
|
||||
"GET",
|
||||
"https://raw.githubusercontent.com/lujjjh/LitoMusic/main/token.json"
|
||||
);
|
||||
request.send();
|
||||
}
|
||||
|
||||
function initMusicKit() {
|
||||
if(!this.responseText) {
|
||||
console.log("Using stored token")
|
||||
|
@ -125,14 +94,12 @@ function capiInit() {
|
|||
request.timeout = 5000;
|
||||
request.addEventListener("load", initMusicKit);
|
||||
request.onreadystatechange = function (aEvt) {
|
||||
if (request.readyState == 4) {
|
||||
if (request.status != 200) {
|
||||
if (request.readyState == 4 && request.status != 200) {
|
||||
if(localStorage.getItem("lastToken") != null) {
|
||||
initMusicKit()
|
||||
} else {
|
||||
fallbackinitMusicKit()
|
||||
console.error(`Failed to load capi, cannot get token [${request.status}]`)
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
request.open("GET", "https://api.cider.sh/v1/");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue