From 0aeccd1f86f0057e2e0c450c71180636f00716c9 Mon Sep 17 00:00:00 2001 From: HuanCheng65 <22636177+HuanCheng65@users.noreply.github.com> Date: Mon, 17 Jul 2023 09:08:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=A5=BC=E4=B8=AD=E6=A5=BC=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=98=B5=E7=A7=B0=E4=B8=BA=E6=97=A7=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/huanchengfly/tieba/post/api/ProtobufRequest.kt | 4 +++- .../post/api/interfaces/impls/MixedTiebaApiImpl.kt | 10 +++++++--- .../tieba/post/api/retrofit/RetrofitTiebaApi.kt | 9 --------- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/huanchengfly/tieba/post/api/ProtobufRequest.kt b/app/src/main/java/com/huanchengfly/tieba/post/api/ProtobufRequest.kt index bc02a01e..1f8a163a 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/api/ProtobufRequest.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/api/ProtobufRequest.kt @@ -32,11 +32,13 @@ fun buildProtobufRequestBody( return MyMultipartBody.Builder(BOUNDARY) .apply { setType(MyMultipartBody.FORM) + if (clientVersion != ClientVersion.TIEBA_V12) { + addFormDataPart(Param.CLIENT_VERSION, clientVersion.version) + } if (needSToken) { val sToken = AccountUtil.getSToken() if (sToken != null) addFormDataPart(Param.STOKEN, sToken) } - addFormDataPart(Param.CLIENT_VERSION, clientVersion.version) addFormDataPart("data", "file", data.encode().toRequestBody()) } .build() diff --git a/app/src/main/java/com/huanchengfly/tieba/post/api/interfaces/impls/MixedTiebaApiImpl.kt b/app/src/main/java/com/huanchengfly/tieba/post/api/interfaces/impls/MixedTiebaApiImpl.kt index 1c5330eb..5e1e1fab 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/api/interfaces/impls/MixedTiebaApiImpl.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/api/interfaces/impls/MixedTiebaApiImpl.kt @@ -947,8 +947,10 @@ object MixedTiebaApiImpl : ITiebaApi { with_group = 1, yuelaou_locate = "" ) - ) - ) + ), + clientVersion = ClientVersion.TIEBA_V12 + ), + forumName = forumName ) } @@ -1130,7 +1132,9 @@ object MixedTiebaApiImpl : ITiebaApi { is_comm_reverse = 0, ori_ugc_type = 0 ) - ) + ), + clientVersion = ClientVersion.TIEBA_V12, + needSToken = false ) ) } diff --git a/app/src/main/java/com/huanchengfly/tieba/post/api/retrofit/RetrofitTiebaApi.kt b/app/src/main/java/com/huanchengfly/tieba/post/api/retrofit/RetrofitTiebaApi.kt index ddac4e99..d08aa675 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/api/retrofit/RetrofitTiebaApi.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/api/retrofit/RetrofitTiebaApi.kt @@ -220,15 +220,6 @@ object RetrofitTiebaApi { Header.USER_AGENT to { "bdtb for Android ${ClientVersion.TIEBA_V12.version}" }, Header.X_BD_DATA_TYPE to { "protobuf" }, ), - defaultCommonParamInterceptor - Param.OS_VERSION + CommonParamInterceptor( - Param.CUID to { CuidUtils.getNewCuid() }, - Param.CUID_GALAXY2 to { CuidUtils.getNewCuid() }, - Param.CUID_GID to { "" }, - Param.FROM to { "tieba" }, - Param.CLIENT_VERSION to { ClientVersion.TIEBA_V12.version }, - Param.CUID_GALAXY3 to { UIDUtil.getAid() }, - Param.OAID to { UIDUtil.getOAID() }, - ), stParamInterceptor, ) }