开发站与公开站API接口调试完成

This commit is contained in:
ZhanGSKen 2025-03-30 01:36:24 +08:00
parent b1e2a018d8
commit d474eb6158
5 changed files with 16 additions and 25 deletions

View File

@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Sat Mar 29 16:59:59 GMT 2025
#Sat Mar 29 17:35:04 GMT 2025
stageCount=2
libraryProject=libaes
baseVersion=15.2
publishVersion=15.2.1
buildCount=25
buildCount=38
baseBetaVersion=15.2.2

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="false">www.winboll.cc</domain>
<domain includeSubdomains="false">dev.winboll.cc</domain>
<domain includeSubdomains="true">winboll.cc</domain>
</domain-config>
</network-security-config>

View File

@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Sat Mar 29 16:59:59 GMT 2025
#Sat Mar 29 17:35:04 GMT 2025
stageCount=2
libraryProject=libaes
baseVersion=15.2
publishVersion=15.2.1
buildCount=25
buildCount=38
baseBetaVersion=15.2.2

View File

@ -27,7 +27,7 @@ public class WinBollClientService extends Service implements IWinBollClientServi
MyServiceConnection mMyServiceConnection;
volatile boolean mIsWinBollClientThreadRunning;
volatile boolean mIsEnableService;
WinBollClientThread mWinBollClientThread;
volatile WinBollClientThread mWinBollClientThread;
public boolean isWinBollClientThreadRunning() {
return mIsWinBollClientThreadRunning;
@ -80,7 +80,7 @@ public class WinBollClientService extends Service implements IWinBollClientServi
return mIsEnableService ? Service.START_STICKY: super.onStartCommand(intent, flags, startId);
}
void runMainThread() {
synchronized void runMainThread() {
if (mWinBollClientThread == null) {
ToastUtils.show("runMainThread()");
mWinBollClientThread = new WinBollClientThread();
@ -163,7 +163,7 @@ public class WinBollClientService extends Service implements IWinBollClientServi
// 设置运行状态
mIsWinBollClientThreadRunning = true;
ToastUtils.show("run()");
LogUtils.d(TAG, "WinBollClientThread run()");
// 唤醒守护进程
//wakeupAndBindAssistant();
@ -178,7 +178,7 @@ public class WinBollClientService extends Service implements IWinBollClientServi
username = "WinBoll";
password = "WinBollPowerByZhanGSKen";
}
targetUrl = "https://" + (GlobalApplication.isDebuging() ?"dev": "www") + ".winboll.cc/api"; // 替换为实际测试的URL
targetUrl = "https://" + (GlobalApplication.isDebuging() ?"dev.winboll": "winboll") + ".cc/api/"; // 替换为实际测试的URL
while (mIsEnableService) {
// 显示运行状态

View File

@ -7,14 +7,12 @@ package cc.winboll.studio.libaes.winboll;
*/
import cc.winboll.studio.libappbase.LogUtils;
import java.io.IOException;
import okhttp3.Authenticator;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Credentials;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.Route;
public class WinBollServerConnectionTestThread extends Thread {
@ -45,23 +43,17 @@ public class WinBollServerConnectionTestThread extends Thread {
@Override
public void run() {
LogUtils.d(TAG, String.format("run() url %s\nusername %s\npassword %s", url, username, password));
OkHttpClient client = new OkHttpClient.Builder()
.connectTimeout(connectTimeout, java.util.concurrent.TimeUnit.MILLISECONDS)
.readTimeout(readTimeout, java.util.concurrent.TimeUnit.MILLISECONDS)
.authenticator(new Authenticator() {
@Override
public Request authenticate(Route route, Response response) throws IOException {
return response.request().newBuilder()
.header("Authorization", Credentials.basic(username, password))
.build();
}
})
.build();
// 构建包含认证信息的请求
String credential = Credentials.basic(username, password);
LogUtils.d(TAG, String.format("credential %s", credential));
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url(url)
.header("Accept", "text/plain") // 设置正确的Content-Type头
.header("Authorization", credential)
.build();
Call call = client.newCall(request);
call.enqueue(new Callback() {
@Override