frozenpandaman / s3s

Successor to splatnet2statink. Takes battle data from the SplatNet 3 app and uploads it to stat.ink!
https://github.com/frozenpandaman/s3s/wiki
GNU General Public License v3.0
403 stars 72 forks source link

s3s cannot refresh tokens anymore #62

Closed strohitv closed 2 years ago

strohitv commented 2 years ago

Hey, I'm using s3s from a Raspberry Pi on Raspian OS.

Today it stopped working, telling me Got non-JSON response from Nintendo (in api/bullet_tokens step: everytime it has to refresh the tokens. A quick test using Windows worked perfectly fine and if I copy the config.txt with the newly received tokens from Windows to the Raspberry Pi, it works again.

I don't know the cause but it would be nice if you could fix the issue or help me find the reason for it. (in the image it says Blank tokens, but that's just because I manually removed them in hope it would help)

s3s_windows_vs_linux

strohitv commented 2 years ago

Update: I forgot to git pull on Windows. With the newest version, it also doesn't work on Windows anymore.

Last version I used on Windows was 0.1.5, this one works.

frozenpandaman commented 2 years ago

I can't seem to replicate this – it works for me:

image

I think your edit to your second comment is saying you've fixed the issue by updating, though, so I'll close this.

ethanl21 commented 2 years ago

In the prefetch_checks() function of s3s.py, gen_new_tokens() depends on the global variable WEB_VIEW_VERSION but is called before WEB_VIEW_VERSION is set to the correct value immediately below. This will cause get_bullet() in iksm.py to POST with the header X-Web-View-Ver set to unknown, returning a 400 status code and causing @strohitv 's error above.

I tried setting WEB_VIEW_VER to the fallback value in utils.py when regenerating from blank tokens, and s3s seems to work as expected.

def gen_new_tokens(reason, force=False):
    '''Attempts to generate new tokens when the saved ones have expired.'''

    manual_entry = False
    if force != True: # unless we force our way through
        if reason == "blank":
            print("Blank token(s).")

            global WEB_VIEW_VERSION
            WEB_VIEW_VERSION = utils.FALLBACK_WEB_VIEW_VERSION
niyari commented 2 years ago

バージョンの文字列を取得するタイミングを間違えて移動させていました。 具体的には 313b17a のコミットです。

frozenpandaman commented 2 years ago

@niyari Was just about to tag you & mention #38 :)

I did a decent amount of refactoring of iksm.py & utils.py and the functions in there and will push the changes to the repo when I get home shortly.

The new version should fetch both the NSO app version and SplatNet 3 version/revision at the start, when the script is run, and then store those globally, using the fallback variables upon encountering an error. I'll of course test it for me, from existing cookies & starting from scratch both, but if you guys could test it out when it's live too that'd be great!

frozenpandaman commented 2 years ago

I think this should be taken care of now. @niyari If you have the ability & time to look over the changes I made in 487ab59 and let me know any feedback you might have, I'd appreciate your thoughts on the refactoring!

strohitv commented 2 years ago

I think your edit to your second comment is saying you've fixed the issue by updating, though, so I'll close this.

No, what I meant was that when I use 0.1.9, it didn't work, but older versions (0.1.5) did work.


However, the problem is fixed now and 0.1.10 works again. Thank you very much!