diff --git a/app/src/main/java/per/goweii/wanandroid/http/GoweiiHostInterceptor.kt b/app/src/main/java/per/goweii/wanandroid/http/GoweiiHostInterceptor.kt index f9beafb6..fa47b2c0 100644 --- a/app/src/main/java/per/goweii/wanandroid/http/GoweiiHostInterceptor.kt +++ b/app/src/main/java/per/goweii/wanandroid/http/GoweiiHostInterceptor.kt @@ -4,10 +4,13 @@ import android.net.Uri import okhttp3.HttpUrl import okhttp3.Interceptor import okhttp3.Response +import per.goweii.basic.utils.LogUtils import java.io.IOException class GoweiiHostInterceptor : Interceptor { companion object { + private const val TAG = "GoweiiHostInterceptor" + private const val GOWEII_HOST = "goweii" private const val GITEE_PAGE_SERVER_BASE_URL = "https://goweii.gitee.io/wanandroidserver" @@ -37,6 +40,7 @@ class GoweiiHostInterceptor : Interceptor { private fun Interceptor.Chain.tryWithBaseUrl(baseUrl: HttpUrl): Response { val httpUrl = request().url().replaceWithBaseUrl(baseUrl) + LogUtils.d(TAG, "tryWithBaseUrl: $httpUrl") return proceed(request().newBuilder().url(httpUrl).build()) } diff --git a/app/src/main/java/per/goweii/wanandroid/utils/web/css/CssStyleManager.kt b/app/src/main/java/per/goweii/wanandroid/utils/web/css/CssStyleManager.kt index 6f61abfb..b2737d7c 100644 --- a/app/src/main/java/per/goweii/wanandroid/utils/web/css/CssStyleManager.kt +++ b/app/src/main/java/per/goweii/wanandroid/utils/web/css/CssStyleManager.kt @@ -14,7 +14,7 @@ object CssStyleManager { private const val headRegex = "(
)([\\s\\S]*?)()" private const val scriptRegex = "()" private const val styleRegex = "()" - private const val url = "https://goweii.gitee.io/wanandroidserver/web/css/" + private const val url = "https://goweii/web/css/" private val disableJsModifyCssScript = """ // 将 style 属性设置为只读 diff --git a/app/src/main/java/per/goweii/wanandroid/utils/web/interceptor/WebHttpClient.kt b/app/src/main/java/per/goweii/wanandroid/utils/web/interceptor/WebHttpClient.kt index c08bb4fb..929348a7 100644 --- a/app/src/main/java/per/goweii/wanandroid/utils/web/interceptor/WebHttpClient.kt +++ b/app/src/main/java/per/goweii/wanandroid/utils/web/interceptor/WebHttpClient.kt @@ -3,14 +3,17 @@ package per.goweii.wanandroid.utils.web.interceptor import okhttp3.Call import okhttp3.OkHttpClient import okhttp3.Request +import per.goweii.rxhttp.core.RxHttp +import per.goweii.wanandroid.http.GoweiiHostInterceptor /** * @author CuiZhen * @date 2020/2/25 */ object WebHttpClient { - - private val okHttpClient: OkHttpClient = OkHttpClient.Builder().build() + private val okHttpClient: OkHttpClient = OkHttpClient.Builder() + .addInterceptor(GoweiiHostInterceptor()) + .build() fun request( url: String,