torikushiii / hoyolab-auto

Auto check-in and others for any Hoyoverse games
https://ko-fi.com/torikushiii
GNU Affero General Public License v3.0
110 stars 24 forks source link

Code Redeem Issue #60

Closed Antivash closed 3 months ago

Antivash commented 3 months ago

I'm not entirely sure what is going on, but I appear to have an issue with the code redeem option. I am seeing a 403 error with it. Attempted to look through the past issues or documentation, I can't seem to find an explanation to what is going on with it beyond the error in terminal.

Issue persists on both Windows and Linux. Originally I wondered if it was the UserAgent option at the top, but after replacing it with the below, the issue continues.

Config with sensitive info removed. Screenshot One (Run on windows) Screenshot Two (Run on Linux)

torikushiii commented 3 months ago

can you try accessing this website? https://www.pcgamesn.com/zenless-zone-zero/codes

it says that you're forbidden from accessing the page

Antivash commented 3 months ago

I can on all browsers I've tried it with, but they all require me to do a human verification thing

torikushiii commented 3 months ago

oh it's just their cloudflare bot detection, this doesn't really an issue since there's another 3 website still working fine and still looking for codes.

you can either go here https://github.com/torikushiii/hoyolab-auto/blob/main/crons/code-redeem/resolvers/zenless/defaults/pcgames.js and change this from log to debug

https://github.com/torikushiii/hoyolab-auto/blob/d739a39a6f4b6a584989e856bf5405b797424cec/crons/code-redeem/resolvers/zenless/defaults/pcgames.js#L8-L15

to

if (res.statusCode !== 200) {
    app.Logger.debug("ZenlessZoneZero:PCGamesN", {  // changed to debug
        message: "Failed to fetch data from PCGamesN.",
        statusCode: res.statusCode
    });

    return [];
}

this will silently drops the error message.

there’s another method you could try by go to the website again, verify that you’re a human, and then replace your user-agent in the config file. However, you mentioned that it still doesn’t work.

Antivash commented 3 months ago

Ahh, I see. I thought I might have configured it wrong. I'll go ahead and make the edit to drop the error. Thank you for helping.