samuelthomas2774 / nxapi

Nintendo Switch Online/Parental Controls app APIs. Show your Nintendo Switch presence in Discord, get friend notifications on desktop, and download and access SplatNet 2, NookLink, SplatNet 3 and Parental Controls data. Mirror of https://gitlab.fancy.org.uk/samuel/nxapi.git.
GNU Affero General Public License v3.0
413 stars 34 forks source link

QR code scanning support? #30

Open Impeta opened 1 year ago

Impeta commented 1 year ago

First and foremost, thanks so much for the very convenient and versatile application for interacting NSO's services on desktops! To my unluckiness, I couldn't for the life of me get the NSO app to boot up on my phone, so my stumbling upon your tool has nearly made my day! Works like a charm in my Linux! I really, really appreciate such a kind soul like you to come front and take matters in your own hands. 💝

Now, exploring through my Splatnet 3 interface, I notice it has a option for QR code capture. As obvious, it's completely nonfunctional and unsupported. I was wondering, if that's possible, if you could please try implement support of it? I'm sure it's doable.

Splatoon's official Twitter has already upload a QR code to scan, though only one so far, so that might be pretty low priority right now for you.

samuelthomas2774 commented 1 year ago

Hi, this is something I'm planning to add at some point. Currently I think it's the only thing the official app is required for (other than voice chat). As SplatNet 3 QR codes are just text (T- followed by a random UUID) this will just be a text input initially. (SplatNet 3 actually has a fallback using window.prompt when used in a normal browser.)

For scanning actual QR codes (in SplatNet 3 or NookLink), I'm not sure how the best way to handle this is yet, as scanning QR codes on a computer/laptop isn't great lol. (Deep links would have been more appropriate for all SplatNet 3 codes so far anyway as the primary distribution method is Twitter.) Currently I'm thinking about adding a window that can be switched between camera or file input (or for SplatNet 3, text input), and just using the source selected in the app as the default.

(Also just so you don't miss one, there's actually two codes! @frozenpandaman has a list of them here: https://github.com/frozenpandaman/s3s/wiki/list-of-qr-codes)


The Nintendo Switch Online app has two different modes for reading QR codes: - A streaming QR code reader, where the web app opens the QR code reader, then calls a function in the web app when a QR code is scanned, but stays open until the web app closes it in case more QR codes need to be scanned in a series. This is used by NookLink. - A QR code reader for event checkins, which is used by SplatNet 3. The QR code reader API is partially there but as the app doesn't have a QR code reader it just returns an error: https://github.com/samuelthomas2774/nxapi/blob/main/src/app/main/webservices.ts#L350-L399 (or for the API that NookLink uses, just... empty data, because there's no way for it to report an error).

Edit: just to add, if you're not using s3s, you can still copy the _gtoken cookie from the SplatNet 3 window developer tools and use it in your normal browser following the same instructions. The only reason the text input can't just work in the app is because Electron doesn't support window.prompt.

frozenpandaman commented 1 year ago

@Impeta If you use s3s to generate your cookies in a human-readable format, you can just access SplatNet 3 via your web browser with its full functionality, including the QR reader which just takes text input:

https://github.com/frozenpandaman/s3s#accessing-splatnet-3-from-your-browser

image