Skip to content

Commit

Permalink
fix: 修复gitee page暂停问题
Browse files Browse the repository at this point in the history
  • Loading branch information
goweii committed May 26, 2024
1 parent 1be2c24 commit 0f5ef3e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ object CssStyleManager {
private const val headRegex = "(<head[\\s\\S]*?>)([\\s\\S]*?)(</head>)"
private const val scriptRegex = "(<script[\\s\\S]*?>)([\\s\\S]*?)(</script>)"
private const val styleRegex = "(<style[\\s\\S]*?>)([\\s\\S]*?)(</style>)"
private const val url = "https://goweii.gitee.io/wanandroidserver/web/css/"
private const val url = "https://goweii/web/css/"

private val disableJsModifyCssScript = """
// 将 style 属性设置为只读
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 0f5ef3e

Please sign in to comment.