yellowbluesky / PixivforMuzei3

Best Pixiv plugin for Muzei 3
GNU General Public License v3.0
174 stars 15 forks source link

Can't login? #155

Closed SettingDust closed 3 years ago

SettingDust commented 3 years ago

Logged in browser, but navigation to account manage page crashed.

Crashed after clicked the first button.

yellowbluesky commented 3 years ago

Thanks for bringing this to my attention, I'll take a look

Works for me on Australian internet: I can login just fine, and I can press the first button "Continue using this account" just fine too

yellowbluesky commented 3 years ago

What version of Android are you on?

SettingDust commented 3 years ago

What version of Android are you on?

11 Updated about a month.

yellowbluesky commented 3 years ago

Can you describe to me exactly what you do and exactly what happens?

A screen recording would be very helpful if you can create and upload one.

It's normal for the screen to turn white and then return to my app's main page once you have pressed the first button

I too am on Android 11 (MIUI 12) and AOSP 11

SettingDust commented 3 years ago

Can you describe to me exactly what you do and exactly what happens?

A screen recording would be very helpful if you can create and upload one.

It's normal for the screen to turn white and then return to my app's main page once you have pressed the first button

I too am on Android 11 (MIUI 12) and ASOP 11

I don't know how to catch crash log without root & xposed. It's crashed.

SettingDust commented 3 years ago

Wait for a moment. Recording

SettingDust commented 3 years ago

https://ws28.cn/f/5chxz44yf8o Can you open it?

yellowbluesky commented 3 years ago

yes I can, watching it now :)

SettingDust commented 3 years ago

yes I can, watching it now :)

In fact. It's just crashed after clicking XD.

yellowbluesky commented 3 years ago

I have an idea for what it could be, but I'll need to investigate and experiment some.

I'll get back to you later with more information or request for information.

SettingDust commented 3 years ago

I have an idea for what it could be, but I'll need to investigate and experiment some.

I'll get back to you later with more information or request for information.

Okay, thanks a lot

yellowbluesky commented 3 years ago

The app is getting stuck because the server response is indicating an error. This is odd, because there is no problem with credentials; you login using the "Continue with existing account" option

Tomorrow I'll provide a build that includes a way for you to send me a copy of the server response; either automatically uplodaing it to pastebin or providing it as text you can copy.

yellowbluesky commented 3 years ago

Hi there, can you try install this build and then try logging in?

https://github.com/yellowbluesky/PixivforMuzei3/releases/tag/3.4.3

The server response is automatically uploaded to my pastebin.

Full disclosure, your access token and refresh token may be revealed to me. I promise to not do anything with them, I have my own account :)

This took me a bit longer than I expected, because of Android Studio updating and changing some settings around.

SettingDust commented 3 years ago

Hi there, can you try install this build and then try logging in?

https://github.com/yellowbluesky/PixivforMuzei3/releases/tag/3.4.3

The server response is automatically uploaded to my pastebin.

Full disclosure, your access token and refresh token may be revealed to me. I promise to not do anything with them, I have my own account :)

This took me a bit longer than I expected, because of Android Studio updating and changing some settings around.

Tried times

yellowbluesky commented 3 years ago

Still crashing?

Well this is awkward, cos I don't see any pastes in my pastebin, i might have set something up wrong :(

yellowbluesky commented 3 years ago

Hi there,

A server response log did eventually show up. There is no error, you login just fine.

Can you try this build please? I had added some code that more gracefully closes the login WebView Activity. https://github.com/yellowbluesky/PixivforMuzei3/releases/tag/3.4.3.1

As a disclaimer, the logging code is still present, let me know if you would rather I remove it immediately.

SettingDust commented 3 years ago

Hi there,

A server response log did eventually show up. There is no error, you login just fine.

Can you try this build please? I had added some code that more gracefully closes the login WebView Activity. https://github.com/yellowbluesky/PixivforMuzei3/releases/tag/3.4.3.1

As a disclaimer, the logging code is still present, let me know if you would rather I remove it immediately.

https://ws28.cn/f/5dy9w6t0yw8

yellowbluesky commented 3 years ago

Ok, I'm hitting the limits of what I can do without having access to logs of some kind.

I'll produce a build that will automatically upload logcat logs for this app to pastebin, I probably should have done this from the beginning

Thanks for your patience in this, I know how frustrating not being able to log in is, and you've always been very good to me and this app

As a final question for now, have you tried uninstalling my app and then reinstalling it?

SettingDust commented 3 years ago

Haven't uninstall before install newest version. Tried after you say that. Same result. :D It's ok. In my view, you should be the one get frustrating. So, what I have is gratitude

SettingDust commented 3 years ago

Btw, the version that translated Night Mode haven't released

yellowbluesky commented 3 years ago

This time lucky I hope

https://github.com/yellowbluesky/PixivforMuzei3/releases/tag/3.4.3.2

I removed Kotlin coroutines, and replaced them with traditional Threads and Runnables.

SettingDust commented 3 years ago

This time lucky I hope

https://github.com/yellowbluesky/PixivforMuzei3/releases/tag/3.4.3.2

I removed Kotlin coroutines, and replaced them with traditional Threads and Runnables.

Tried, crashed. Isn't there a way to export log?

SettingDust commented 3 years ago

I can login with https://github.com/james58899/MuzeiPixivSource. It's seems that it's won't navigate to another page after login.

Maybe @james58899 can give some advice?

james58899 commented 3 years ago

I can login with https://github.com/james58899/MuzeiPixivSource. It's seems that it's won't navigate to another page after login.

Maybe @james58899 can give some advice?

Try connect to computer and using adb logcat to get crash stacktrace.

I can also login successfully on both apps.

SettingDust commented 3 years ago

I can login with https://github.com/james58899/MuzeiPixivSource. It's seems that it's won't navigate to another page after login.

Maybe @james58899 can give some advice?

Try connect to computer and using adb logcat to get crash stacktrace.

I can also login successfully on both apps.

Okay

SettingDust commented 3 years ago

image

I'm done!

yellowbluesky commented 3 years ago

Hello there,

Can you please try this build? https://github.com/yellowbluesky/PixivforMuzei3/releases/tag/3.4.3.3

From the logcat you posted, my CustomClientHeaderInterceptor was causing a hang in the networking library. This interceptor was necessary under the old login and authentication scheme.

I tested it myself, and I can still login fine without the interceptor. To be honest, I still don't know why only you were having this why

let me know how it goes

@SettingDust thank you for taking the time to get the logcat for me @james58899 thank you for your time in trying my app out and helping SettingDust out, and also thank you for having high quality code available for my reference.

SettingDust commented 3 years ago

New stacktrace.

image

SettingDust commented 3 years ago

I tested it myself, and I can still login fine without the interceptor. To be honest, I still don't know why only you were having this why

In fact, me too. I can login with any other app to pixiv. Such as @james58899's

yellowbluesky commented 3 years ago

From the latest logcat, your configuration seems to external function calls that do networking

At this point, I've almost completely eliminated all such function calls, hopefully this will do the trick.

https://github.com/yellowbluesky/PixivforMuzei3/releases/tag/3.4.3.4.1

SettingDust commented 3 years ago

From the latest logcat, your configuration seems to external function calls that do networking

At this point, I've almost completely eliminated all such function calls, hopefully this will do the trick.

https://github.com/yellowbluesky/PixivforMuzei3/releases/tag/3.4.3.4.1

Okay! Logged :D Trying to download artwork

SettingDust commented 3 years ago

It's can't download artworks. It's seems that a network problem. But I can use any other pixiv app and pixiv.net in browser. Weird :(

image

yellowbluesky commented 3 years ago

Thanks for your patience while we work through this

https://github.com/yellowbluesky/PixivforMuzei3/releases/tag/3.4.3.5

let me know how this goes

I've increased the OkHttp timeouts and refreshed some networking code. I'm hoping that this will fix it, I'm hesitant to remove all interceptors like we did for LoginActivityWebview; this will complicate the code and make it harder to maintain.

If you still get errors, could you please provide logcats for both a ranking mode and a logged in mode?

SettingDust commented 3 years ago

Daily:

05-18 20:52:36.885 11952 12105 W System.err: java.io.IOException: unexpected end of stream on https://www.pixiv.net/...
05-18 20:52:36.885 11952 12105 W System.err:    at okhttp3.internal.http1.Http1ExchangeCodec.readResponseHeaders(Http1ExchangeCodec.kt:13)
05-18 20:52:36.885 11952 12105 W System.err:    at okhttp3.internal.connection.RealConnection.createTunnel(RealConnection.kt:9)
05-18 20:52:36.885 11952 12105 W System.err:    at okhttp3.internal.connection.RealConnection.connectTunnel(RealConnection.kt:4)
05-18 20:52:36.886 11952 12105 W System.err:    at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:14)
05-18 20:52:36.886 11952 12105 W System.err:    at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:43)
05-18 20:52:36.886 11952 12105 W System.err:    at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:1)
05-18 20:52:36.886 11952 12105 W System.err:    at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:7)
05-18 20:52:36.886 11952 12105 W System.err:    at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:6)
05-18 20:52:36.886 11952 12105 W System.err:    at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:2)
05-18 20:52:36.886 11952 12105 W System.err:    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:12)
05-18 20:52:36.886 11952 12105 W System.err:    at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:20)
05-18 20:52:36.886 11952 12105 W System.err:    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:12)
05-18 20:52:36.886 11952 12105 W System.err:    at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:22)
05-18 20:52:36.887 11952 12105 W System.err:    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:12)
05-18 20:52:36.887 11952 12105 W System.err:    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:6)
05-18 20:52:36.887 11952 12105 W System.err:    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:12)
05-18 20:52:36.887 11952 12105 W System.err:    at com.antony.muzei.pixiv.provider.network.RestClient$getRetrofitRankingInstance$$inlined$invoke$1.intercept(Interceptor.kt:11)
05-18 20:52:36.887 11952 12105 W System.err:    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:12)
05-18 20:52:36.887 11952 12105 W System.err:    at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:16)
05-18 20:52:36.888 11952 12105 W System.err:    at okhttp3.internal.connection.RealCall.execute(RealCall.kt:9)
05-18 20:52:36.888 11952 12105 W System.err:    at retrofit2.OkHttpCall.execute(OkHttpCall.java:8)
05-18 20:52:36.888 11952 12105 W System.err:    at retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall.execute(DefaultCallAdapterFactory.java:1)
05-18 20:52:36.888 11952 12105 W System.err:    at com.antony.muzei.pixiv.provider.PixivArtWorker.getArtwork(PixivArtWorker.kt:39)
05-18 20:52:36.888 11952 12105 W System.err:    at com.antony.muzei.pixiv.provider.PixivArtWorker.doWork(PixivArtWorker.kt:3)
05-18 20:52:36.888 11952 12105 W System.err:    at androidx.work.Worker$1.run(Worker.java:1)
05-18 20:52:36.888 11952 12105 W System.err:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
05-18 20:52:36.888 11952 12105 W System.err:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
05-18 20:52:36.889 11952 12105 W System.err:    at java.lang.Thread.run(Thread.java:923)
05-18 20:52:36.889 11952 12105 W System.err: Caused by: java.io.EOFException: \n not found: limit=0 content=鈥?
05-18 20:52:36.889 11952 12105 W System.err:    at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.kt:22)
05-18 20:52:36.889 11952 12105 W System.err:    at okhttp3.internal.http1.Http1ExchangeCodec.readHeaderLine(Http1ExchangeCodec.kt:1)
05-18 20:52:36.889 11952 12105 W System.err:    at okhttp3.internal.http1.Http1ExchangeCodec.readResponseHeaders(Http1ExchangeCodec.kt:2)
05-18 20:52:36.889 11952 12105 W System.err:    ... 27 more

Recommend:

05-18 20:39:31.204   645  5746 W System.err: java.io.IOException: unexpected end of stream on https://app-api.pixiv.net/...
05-18 20:39:31.204   645  5746 W System.err:    at okhttp3.internal.http1.Http1ExchangeCodec.readResponseHeaders(Http1ExchangeCodec.kt:13)
05-18 20:39:31.204   645  5746 W System.err:    at okhttp3.internal.connection.RealConnection.createTunnel(RealConnection.kt:9)
05-18 20:39:31.204   645  5746 W System.err:    at okhttp3.internal.connection.RealConnection.connectTunnel(RealConnection.kt:4)
05-18 20:39:31.204   645  5746 W System.err:    at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:14)
05-18 20:39:31.204   645  5746 W System.err:    at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:43)
05-18 20:39:31.204   645  5746 W System.err:    at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:1)
05-18 20:39:31.205   645  5746 W System.err:    at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:7)
05-18 20:39:31.205   645  5746 W System.err:    at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:6)
05-18 20:39:31.205   645  5746 W System.err:    at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:2)
05-18 20:39:31.205   645  5746 W System.err:    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:12)
05-18 20:39:31.205   645  5746 W System.err:    at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:20)
05-18 20:39:31.205   645  5746 W System.err:    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:12)
05-18 20:39:31.205   645  5746 W System.err:    at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:22)
05-18 20:39:31.205   645  5746 W System.err:    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:12)
05-18 20:39:31.205   645  5746 W System.err:    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:6)
05-18 20:39:31.205   645  5746 W System.err:    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:12)
05-18 20:39:31.205   645  5746 W System.err:    at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:16)
05-18 20:39:31.205   645  5746 W System.err:    at okhttp3.internal.connection.RealCall.execute(RealCall.kt:9)
05-18 20:39:31.205   645  5746 W System.err:    at retrofit2.OkHttpCall.execute(OkHttpCall.java:8)
05-18 20:39:31.205   645  5746 W System.err:    at retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall.execute(DefaultCallAdapterFactory.java:1)
05-18 20:39:31.205   645  5746 W System.err:    at com.antony.muzei.pixiv.provider.PixivArtWorker.getArtwork(PixivArtWorker.kt:25)
05-18 20:39:31.205   645  5746 W System.err:    at com.antony.muzei.pixiv.provider.PixivArtWorker.doWork(PixivArtWorker.kt:3)
05-18 20:39:31.205   645  5746 W System.err:    at androidx.work.Worker$1.run(Worker.java:1)
05-18 20:39:31.206   645  5746 W System.err:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
05-18 20:39:31.206   645  5746 W System.err:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
05-18 20:39:31.206   645  5746 W System.err:    at java.lang.Thread.run(Thread.java:923)
05-18 20:39:31.206   645  5746 W System.err: Caused by: java.io.EOFException: \n not found: limit=0 content=鈥?
05-18 20:39:31.206   645  5746 W System.err:    at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.kt:22)
05-18 20:39:31.206   645  5746 W System.err:    at okhttp3.internal.http1.Http1ExchangeCodec.readHeaderLine(Http1ExchangeCodec.kt:1)
05-18 20:39:31.206   645  5746 W System.err:    at okhttp3.internal.http1.Http1ExchangeCodec.readResponseHeaders(Http1ExchangeCodec.kt:2)
05-18 20:39:31.206   645  5746 W System.err:    ... 25 more
yellowbluesky commented 3 years ago

The latest set of errors, in particular "\n not found" is quite unusual, there aren't many search hits for this error code

In the latest build I've disabled gzip compression of the JSON for both ranking modes and auth modes, this was the recommended fix ok the official okhttp repo.

Let me know if this works

https://github.com/yellowbluesky/PixivforMuzei3/releases/tag/3.4.3.7

SettingDust commented 3 years ago

The latest set of errors, in particular "\n not found" is quite unusual, there aren't many search hits for this error code

In the latest build I've disabled gzip compression of the JSON for both ranking modes and auth modes, this was the recommended fix ok the official okhttp repo.

Let me know if this works

https://github.com/yellowbluesky/PixivforMuzei3/releases/tag/3.4.3.7

Same stack

SettingDust commented 3 years ago

I've searched for this. https://github.com/square/okhttp/issues/5390#issuecomment-610001882 I think the reason is server close the connection. But why?

SettingDust commented 3 years ago

Wait. It's weird. It's seems ok. WTF? I close the VPN and it's download images with any mode. But why? It should download normally with vpn like any other app. Strangely

yellowbluesky commented 3 years ago

I've searched for this. square/okhttp#5390 (comment) I think the reason is server close the connection. But why?

I already do this, I set retryOnConnectionFailure to true https://github.com/yellowbluesky/PixivforMuzei3/blob/master/app/src/main/java/com/antony/muzei/pixiv/provider/network/OkHttpSingleton.kt#L34

Wait. It's weird. It's seems ok. WTF? I close the VPN and it's download images with any mode. But why? It should download normally with vpn like any other app. Strangely

Did you try closing your VPN in any of the previous builds

Glad to hear that its working normally for you however :)

SettingDust commented 3 years ago

Did you try closing your VPN in any of the previous builds

Haven't.

160 try to don't use bypass sni always. Maybe it is the reason why can't proxy work.

yellowbluesky commented 3 years ago

Hi there, can you please try build 3.4.3.4.1 with VPN off, and let me know if ranking artwork can be downloaded? I'm not happy with the changes made, if we do not need them the better

You may have to uninstall your current app version, as Android complains if you downgrade an app.

https://github.com/yellowbluesky/PixivforMuzei3/releases/tag/3.4.3.4.1

I'm working on adding a toggle to the settings that enables or disables the SNI bypass, incorporating #160

SettingDust commented 3 years ago

Tried. I can download images without proxy and login in daily. And I can download without proxy but login recommend mode. And I can bookmark images without proxy. In fact, it's seems that I can do anything without proxy beside login with webview XD. But the speed is slower. Make sense

yellowbluesky commented 3 years ago

Fantastic, thank you very much for your time helping me, I really appreciate it

I'll try to get a build out tonight or tomorrow

yellowbluesky commented 3 years ago

One more thing sorry, does 3.4.3.3 work when VPN is disabled?

https://github.com/yellowbluesky/PixivforMuzei3/releases/tag/3.4.3.3

SettingDust commented 3 years ago

One more thing sorry, does 3.4.3.3 work when VPN is disabled?

https://github.com/yellowbluesky/PixivforMuzei3/releases/tag/3.4.3.3

Yes. Downloaded images with daily mode without proxy and crashed when login

yellowbluesky commented 3 years ago

Ok, thank you to everyone who helped on this issue.

I believe it to be fixed, and I've pushed it out to production. Expect to see 3.4.3.8 in the Play Store or F-Droid in teh coming days, or download it now from the Github.