服务器 Http访问验证部分代码整理

This commit is contained in:
ZhanGSKen 2025-04-02 19:43:42 +08:00
parent 7fd10086eb
commit a9ce480f9f
4 changed files with 12 additions and 8 deletions

View File

@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle #Created by .winboll/winboll_app_build.gradle
#Mon Mar 31 19:41:19 HKT 2025 #Wed Apr 02 11:42:36 GMT 2025
stageCount=5 stageCount=5
libraryProject=libaes libraryProject=libaes
baseVersion=15.2 baseVersion=15.2
publishVersion=15.2.4 publishVersion=15.2.4
buildCount=0 buildCount=5
baseBetaVersion=15.2.5 baseBetaVersion=15.2.5

View File

@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle #Created by .winboll/winboll_app_build.gradle
#Mon Mar 31 19:41:08 HKT 2025 #Wed Apr 02 11:42:36 GMT 2025
stageCount=5 stageCount=5
libraryProject=libaes libraryProject=libaes
baseVersion=15.2 baseVersion=15.2
publishVersion=15.2.4 publishVersion=15.2.4
buildCount=0 buildCount=5
baseBetaVersion=15.2.5 baseBetaVersion=15.2.5

View File

@ -324,14 +324,17 @@ public class AboutView extends LinearLayout {
PrefUtils.saveString(mContext, "metDevUserName", metDevUserName.getText().toString()); PrefUtils.saveString(mContext, "metDevUserName", metDevUserName.getText().toString());
PrefUtils.saveString(mContext, "metDevUserPassword", metDevUserPassword.getText().toString()); PrefUtils.saveString(mContext, "metDevUserPassword", metDevUserPassword.getText().toString());
} else { } else {
credential = Credentials.basic("WinBoll", "WinBollPowerByZhanGSKen"); String username = "WinBoll";
String password = "WinBollPowerByZhanGSKen";
credential = Credentials.basic(username, password);
} }
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder() Request request = new Request.Builder()
.url(szUrl) .url(szUrl)
.header("Accept", "text/plain") // 设置正确的Content-Type头 .header("Accept", "text/plain") // 设置正确的Content-Type头
.header("Authorization", credential) .header("Authorization", credential)
.build(); .build();
OkHttpClient client = new OkHttpClient();
Call call = client.newCall(request); Call call = client.newCall(request);
call.enqueue(new Callback() { call.enqueue(new Callback() {
@Override @Override

View File

@ -252,6 +252,7 @@ public class WinBollServiceStatusView extends LinearLayout {
username = "WinBoll"; username = "WinBoll";
password = "WinBollPowerByZhanGSKen"; password = "WinBollPowerByZhanGSKen";
} }
LogUtils.d(TAG, String.format("Connection Start. targetUrl %s", targetUrl)); LogUtils.d(TAG, String.format("Connection Start. targetUrl %s", targetUrl));
WinBollServerConnectionThread thread = new WinBollServerConnectionThread( WinBollServerConnectionThread thread = new WinBollServerConnectionThread(
targetUrl, targetUrl,