Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
UjuiUjuMandan committed Sep 18, 2024
1 parent 83a7c8a commit 387b81f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ import com.antony.muzei.pixiv.provider.exceptions.FilterMatchNotFoundException
import com.antony.muzei.pixiv.provider.network.OkHttpSingleton
import com.antony.muzei.pixiv.provider.network.PixivImageDownloadService
import com.antony.muzei.pixiv.provider.network.RestClient
import com.antony.muzei.pixiv.provider.network.RubyHttpDns
import com.antony.muzei.pixiv.provider.network.interceptor.ImageIntegrityInterceptor
import com.antony.muzei.pixiv.provider.network.interceptor.StandardImageHttpHeaderInterceptor
import com.antony.muzei.pixiv.provider.network.moshi.AuthArtwork
import com.antony.muzei.pixiv.provider.network.moshi.Contents
import com.antony.muzei.pixiv.provider.network.moshi.RankingArtwork
import com.antony.muzei.pixiv.util.DoHUtils
import com.antony.muzei.pixiv.util.HostManager
import com.google.android.apps.muzei.api.provider.Artwork
import com.google.android.apps.muzei.api.provider.ProviderContract
Expand Down Expand Up @@ -447,6 +447,7 @@ class PixivArtWorker(context: Context, workerParams: WorkerParameters) :
//.addNetworkInterceptor(NetworkTrafficLogInterceptor())
.addInterceptor(StandardImageHttpHeaderInterceptor())
.addInterceptor(ImageIntegrityInterceptor())
.dns(RubyHttpDns.getInstance())
.build()

imageHttpClient.newCall(remoteFileExtenstionRequest).execute().let {
Expand Down Expand Up @@ -610,7 +611,7 @@ class PixivArtWorker(context: Context, workerParams: WorkerParameters) :
//.addInterceptor(NetworkTrafficLogInterceptor())
.addInterceptor(StandardImageHttpHeaderInterceptor())
.addInterceptor(ImageIntegrityInterceptor())
.dns(DoHUtils.createDohDnsClient())
.dns(RubyHttpDns.getInstance())
.build()

imageHttpClient.newCall(request).execute().body
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,14 @@

package com.antony.muzei.pixiv.provider.network;

import android.util.Log;

import com.antony.muzei.pixiv.util.DoHUtils;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;

import okhttp3.Dns;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.dnsoverhttps.DnsOverHttps;

/*
This class is called only when network bypass is enabled
Expand All @@ -42,12 +40,14 @@ public class RubyHttpDns implements Dns {
* 210.129.120.55 www.pixiv.net
*/

public static List<InetAddress> newDns = new ArrayList<>();
private static RubyHttpDns sHttpDns = null;
private Dns dohDns;

private static final String DOH_URL = "https://1.0.0.1/dns-query";
private RubyHttpDns() {
dohDns = DoHUtils.createDohDnsClient();
dohDns = new DnsOverHttps.Builder().client(new OkHttpClient())
.url(HttpUrl.get(DOH_URL))
.build();
}


Expand Down
17 changes: 0 additions & 17 deletions app/src/main/java/com/antony/muzei/pixiv/util/DoHUtils.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ public class HostManager {
public static final String HOST_NEW = "i.pixiv.cat";
private static final String HTTP_HEAD = "http://";

private String host;

private HostManager() {
}

public static HostManager get() {
return SingletonHolder.INSTANCE;
}
Expand Down

0 comments on commit 387b81f

Please sign in to comment.