pvrs12 / Anesidora

Anesidora - Pandora extension for Firefox
Other
31 stars 8 forks source link

fix #77, attempt fix #76 #78

Closed hucario closed 3 years ago

hucario commented 3 years ago

oh alright it's just got all my other commits too

I only wanted those two latest ones but whatever

pvrs12 commented 3 years ago

That's alright. I may need to cherrypick them to make it merge well though.

It's happening because of the squash&merge i did a few commits ago. Your repo is out of date with mine. You may need to do a force to get it back in sync.

hucario commented 3 years ago

pushed a commit that should fix #76 - edits partnerLogin to read this:

async function partnerLogin() {
    if (localStorage.username !== "" && localStorage.password !== "") {
        let request = JSON.stringify({
            "username": "android",
            "password": "AC7IBG09A3DTSYM4R41UJWL07VLN8JI7",
            "version": "5",
            "deviceModel": "android-generic",
            "includeUrls": true
        });
        let response = await sendRequest(true, false, "auth.partnerLogin", request);
        var b = stringToBytes(decrypt(response.result.syncTime));
        // skip 4 bytes of garbage
        var s = "", i;
        for (i = 4; i < b.length; i++) {
            s += String.fromCharCode(b[i]);
        }
        syncTime = parseInt(s);
        clientStartTime = parseInt((new Date().getTime() + "").substr(0, 10));
        // if it didn't work we wouldn't be here so this wouldn't run. so, we're here and the login succeeded
    dontRetryPartnerLogin = false;
        return await userLogin(response);
    }
}
hucario commented 3 years ago

wait, I'm an idiot and I need to move that line to userLogin. Whoops

hucario commented 3 years ago

alright now it reads this in userLogin:

    let res = await sendRequest(true, true, parameters, request);
    if (res.stat == "fail") {
        return "uncool credentials";
    }
    // we good apparently
    dontRetryPartnerLogin = false;
hucario commented 3 years ago

explanation of previous commit: because I made the handler an async function it would actually return a Promise instead of false so instead I made it a synchronous function that executes an async function but doesn't wait and just returns false:

async function doesntWorkAsHandler() {
   await etcetera();
   goToPlayerPaneOrSomething();
   return false;
} // returns a Promise that resolves to false
function doesWork() {
    (async() => {
        await etcetera();
        goToPlayerPaneOrSomething();
    })();
    return false;
} // actually returns false
hucario commented 3 years ago

*previous commit doesn't exist, please don't realize I don't test nearly as much as I should

pvrs12 commented 3 years ago

going to hold off on these for now.

LMK when we're good to merge

pvrs12 commented 3 years ago

https://github.com/pvrs12/Anesidora/pull/79 without any extras. will add more as you do 👉😎👉

hucario commented 3 years ago

think I'm ready now unless someone opens another issue

pvrs12 commented 3 years ago

Fantastic! I'll be doing it under #79