jobobby04 / Lanraragi-Fakku-Tagger

A quick and dirty program that connects to your LANraragi instance, and re-tags all galleries using different metadata grabbers.
Mozilla Public License 2.0
9 stars 1 forks source link

Won't authenticate to FAKKU #2

Closed shinji257 closed 6 months ago

shinji257 commented 1 year ago

Whenever I try to supply my fakku_sid it reports back that the login failed. Same fakku_sid works with your missing galleries app.

shinji257 commented 1 year ago
PS P:\git> java -jar .\LanraragiFakkuTagger-1.5.jar Etx8CFvhTJiWtc http://10.0.0.149:3000 redactedfakkusid 0 0 resetAllTags debug
[main] INFO Main - Getting lanraragi metadata plugins
[main] INFO io.ktor.client.HttpClient - REQUEST: http://10.0.0.149:3000/api/plugins/metadata
METHOD: HttpMethod(value=GET)
[DefaultDispatcher-worker-1] INFO io.ktor.client.HttpClient - RESPONSE: 200 OK
METHOD: HttpMethod(value=GET)
FROM: http://10.0.0.149:3000/api/plugins/metadata
[DefaultDispatcher-worker-1] INFO Main - Getting all lanraragi galleries
[DefaultDispatcher-worker-1] INFO io.ktor.client.HttpClient - REQUEST: http://10.0.0.149:3000/api/archives
METHOD: HttpMethod(value=GET)
[DefaultDispatcher-worker-2] INFO io.ktor.client.HttpClient - RESPONSE: 200 OK
METHOD: HttpMethod(value=GET)
FROM: http://10.0.0.149:3000/api/archives
[DefaultDispatcher-worker-2] INFO Main - Getting FAKKU page to check login status
[DefaultDispatcher-worker-2] INFO io.ktor.client.HttpClient - REQUEST: https://www.fakku.net/subscription
METHOD: HttpMethod(value=GET)
[DefaultDispatcher-worker-3] INFO io.ktor.client.HttpClient - RESPONSE: 302
METHOD: HttpMethod(value=GET)
FROM: https://www.fakku.net/subscription
[DefaultDispatcher-worker-3] INFO io.ktor.client.HttpClient - REQUEST: https://www.fakku.net/
METHOD: HttpMethod(value=GET)
[DefaultDispatcher-worker-2] INFO io.ktor.client.HttpClient - RESPONSE: 200
METHOD: HttpMethod(value=GET)
FROM: https://www.fakku.net/
[DefaultDispatcher-worker-2] INFO Main - Checking FAKKU login
[DefaultDispatcher-worker-2] INFO Main - Failed FAKKU login, retry with a new sid cookie

EDIT: For now I just edited my copy to skip the check. I know I have a sub. The only thing that I won't know is when my sid becomes invalid as it won't yell at me about it.

This looks to be the problem code segment but you would know better than me. Just my observation. It's the portion I commented out for my workaround here. I'm figuring the page changed and something about it is causing this check to fail now.

    logger.info("Getting FAKKU page to check login status")
    val fakkuPage = client.get("https://www.fakku.net/subscription") {
        expectSuccess = true
    }.bodyAsText()
    logger.info("Checking FAKKU login")
    if (
        Jsoup.parse(fakkuPage)
            .body()
            .selectFirst(".button-green-600")
            ?.attr("href")
            .equals("/subscription/payment")
            .not()
    ) {
        logger.info("Failed FAKKU login, retry with a new sid cookie")
        exitProcess(205)
    }    
jobobby04 commented 1 year ago

My missing galleries app does not test the cookie. Make sure your still logged in on Fakku, it likes to invalidate the cookie whenever it wants

shinji257 commented 1 year ago

Yes but this one (that I bugged on) still does based on the commit from 8 months ago. I even copied the code block that checks.

https://github.com/jobobby04/Lanraragi-Fakku-Tagger/blob/0e98fab1a4e60df422c97a198f176d832b933338/src/main/kotlin/com/jobobby/koromo/Main.kt#L141-L159

jobobby04 commented 1 year ago

? I tested the code with a valid sid cookie and it works fine for me, so unless your using a invalid sid cookie it shouldn't have problems

shinji257 commented 1 year ago

I couldn't get it to work at the time with the same cookie on both. Just in case it is an id10t moment can you provide the command line on how you are doing it? I'll try it later on and see what happens.

I'll note that the cookie I'm using right now with the check Skipper works fine. I know since my login has controversial content enabled and tried it on something that would have been blocked otherwise.

shinji257 commented 1 year ago

Yea. Still fails with that code block in place and I don't know why it works for you but not for me. Coming off my patched version I went and tried again with your build and I tried both with and without fakku_sid as a prefix for the cookie. I then followed it up with using against your missing galleries script and it worked fine immediately. Had it look at the tentacles prefix on purpose since that one is a controversial category and blocked for unauthenticated sessions. It grabbed the pages fine. When I removed the cookie from the command for that it failed with a 403 response.

image

Debug run for reference: image

jobobby04 commented 1 year ago

Hmm for fakku, are you subscribed to Fakku unlimited?

shinji257 commented 1 year ago

Yes.

jobobby04 commented 1 year ago

That must be why, to check if the login works, I test if there is a subscribe button

jobobby04 commented 1 year ago

If you go to https://www.fakku.net/subscription is there a big green button? If there is, can you right click it and copy the link to send it here

shinji257 commented 1 year ago

When I go there I just get redirected to the homepage as I'm already subscribed. This is actually indicated in the 302 (Found redirect) response in the debug output earlier.

jobobby04 commented 1 year ago

Huh, ok. I can work with that

jobobby04 commented 1 year ago

@shinji257 Can you try this build and give me the output if it doesnt work? LanraragiFakkuTagger-1.7-SNAPSHOT.zip