yellowbluesky / PixivforMuzei3

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

3.4.3.8 can't download images #162

Closed linsui closed 2 years ago

linsui commented 3 years ago

I use 3.4.3.8 from F-Droid which can't download new images while 3.4.3.1 works for me. My device is Android 11. Could you please take a look? Thanks!

mslxl commented 3 years ago

I have the same problem in Android 11 (but I am not sure whether the problem is related to OS or not)

I live in China now(I guess linsui is live in China too since his repo was written in Chinese ). I have tried 3.4.3.1 and it worked for me without VPN, but 3.4.3.8 didn't though I have enabled network filter passby.

Btw, the 3.4.3.8 can load images normally with VPN, so I think there must be wrong in the activation of SNI, not in system.

mslxl commented 3 years ago

The logcat on my device is as follows. It seems that it is not a problem of system. I may not be able to find the problem which caused it, but I'll try my best to fix it.

Logcat ``` W/System.err: java.net.SocketTimeoutException: failed to connect to www.pixiv.net/157.240.1.33 (port 443) from /192.168.1.101 (port 42184) after 60000ms W/System.err: at libcore.io.IoBridge.connectErrno(IoBridge.java:190) at libcore.io.IoBridge.connect(IoBridge.java:134) at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:142) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:390) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:230) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:212) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:436) at java.net.Socket.connect(Socket.java:631) at okhttp3.internal.platform.Platform.connectSocket(Platform.kt:117) at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:283) at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:195) W/System.err: at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:235) at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:108) at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:76) at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:245) at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100) at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:82) W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100) at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83) W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:74) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100) at com.antony.muzei.pixiv.provider.network.RestClient$getRetrofitRankingInstance$$inlined$invoke$1.intercept(Interceptor.kt:86) W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100) at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:197) at okhttp3.internal.connection.RealCall.execute(RealCall.kt:148) at retrofit2.OkHttpCall.execute(OkHttpCall.java:204) W/System.err: at retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall.execute(DefaultCallAdapterFactory.java:108) at com.antony.muzei.pixiv.provider.PixivArtWorker.getArtwork(PixivArtWorker.kt:1012) at com.antony.muzei.pixiv.provider.PixivArtWorker.doWork(PixivArtWorker.kt:1060) at androidx.work.Worker$1.run(Worker.java:85) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:923) ```
mslxl commented 3 years ago

@linsui 试试这个: https://github.com/mslxl/PixivforMuzei3/releases/download/3.4.3.8-fix/app-prod-debug.apk ,在我这边能正常加载图片了。 因为签名不一样,可能需要重新安装,安装后启用 绕过网络过滤 后再清除缓存试一下,因为网速可能比较慢,多刷新几遍。 如果可行的话我就提 pr


I have created a new instance when pref_enableNetworkBypass was changed. If it is effective for linsui, I will make a pr

linsui commented 3 years ago

It doesn't work for me.

mslxl commented 3 years ago

Well, it is so strange. I am using ColorOS, which is based on Android 11 too. I also test the app on AVD(Pixel_3a_API_30_x86). The app is working on these systems. Could you provide more information about your system and relevant logs? Thanks.

Image: App on AVD(Pixel_3a_API_30_x86) ![DeepinScreenshot_select-area_20210702111714](https://user-images.githubusercontent.com/11132880/124216066-ee1cbb80-db27-11eb-97ce-bb6a0c7e3d4c.png)
linsui commented 3 years ago

The problem may be related to the network. But 3.4.3.1 works.

mslxl commented 3 years ago

(I am not good at English so I am not sure I express my meaning accurately. If you can understand Chinese, referred the below words 我不太擅长英语,下面的英语表达可能会不太准确。如果您能懂中文的话就看下面的中文版吧)

3.4.3.1 enables Network Bypass according to system language, while 3.4.3.8 uses an independent switch to enable Network Bypass . I found the code related to Network Bypass would not apply to OKHttpClient instance when I enable the Enable Network Bypass switch, so I guess there must be a problem. That is why I changed the code. Actually, my version is working on my device(I am in China too and I am using SD Telecom). Now I have a new guess: the different systems would process background service differently, if the old background service were not be killed, the OKHttpClient instance would not be changed. Can you help me by trying the following step and send the result to me?

  1. Install PixivforMuzei3 3.4.3.8
  2. Open PixivforMuzei3, enter the ADVANCE SETTINGS page and enable the Enable Network Bypass switch
  3. Active PixivforMuzei3 in Muzei
  4. Reboot your device
  5. Clear image cache in PixivforMuzei3's settings
  6. Open Muzei and try to borrow PixivforMuzei3, refresh it. (It may be failed due to slow network)
  7. Wait a minute(My network is slow, so I need to wait a long time). If it is failed, return to step 5 and retry.

If it works, I will force restart the app when Enable Network Bypass was changed. If it keeps failing, then I do not know where exist mistakes


3.4.3.1 通过系统语言判断是否启用 Network Bypass , 3.4.3.8 则将它独立成了一个开关。我发现系统在 Enable Network Bypass 开关切换后,OKHttpClient 实例并不会变,我感觉问题一定在这,所以我修改了代码,修改后的代码在我这边能正常运行(我使用山东电信)。我个人猜测可能不同的系统对后台服务有不同的处理方式,因此导至了差异。 能按照下面的步骤试一下码?

  1. 安装 PixivforMuzei3 3.4.3.8
  2. 打开这个应用,启用绕过网络过滤
  3. 在 Muzei 中激活这个应用
  4. 重启设备(目的是彻底重新启动 Muzei 和这个应用
  5. 在这个应用中清除图片缓存
  6. 打开Muzei,再打开这个应用的刘揽,多刷新几遍 (我也有时侯成功)
  7. 等一会,观查是否正常(在我这边图片下载要等很长时间,但是总有图片能正常加载) 如果能正常工作,也许可以通过在绕过网络过滤开关变化后强置重启这个应用来解觉这个问题 如果反复失败,那么我也不知道那里有问题了。
linsui commented 3 years ago

It works for me this time. I'm not sure if it's because the reboot... Thanks!

yellowbluesky commented 3 years ago

Thank you the two of you, I really appreciate the investigative work and effort you put into this.

I've been very busy the past months with COVID and my new job

yellowbluesky commented 3 years ago

@mslxl would you like to be credited within my app, if yes is linking to your Github acceptable?

Linsui, could you please test this build out? https://github.com/yellowbluesky/PixivforMuzei3/releases/tag/3.4.3.9 Only change is merging of mslxl's code that should fix the issue you are having.

mslxl commented 3 years ago

Yes, I would be very happy if I can be credited within your app.

:smile:

On Jul 7, 2021 at 19:04, Antony @.***> wrote:

@mslxl would you like to be credited within my app, if yes is linking to your Github acceptable?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.