2 Commits

Author SHA1 Message Date
您的名字 593f1e7444 📱 发布XMBOX v3.0.6 正式版APK
🚀 新特性:
- 修复自动更新功能,支持点击版本号弹窗检查更新
- 智能镜像选择:GitHub API限流时自动切换到Gitee
- 友好错误提示:显示具体的更新失败原因

📦 发布文件:
- mobile-arm64_v8a.apk (36MB) - 适用于大部分现代手机
- mobile-armeabi_v7a.apk (32MB) - 适用于较老设备

🛠️ 技术改进:
- 优化网络请求逻辑,提高成功率
- 配置Gitee镜像加速,提升国内用户体验
- 增强异常处理,避免静默失败
2025-08-06 15:22:16 +08:00
您的名字 a4d671b394 修复自动更新功能并优化Gitee镜像配置
- 修复版本号点击无弹窗问题,添加友好的错误提示
- 更新Gitee镜像配置,使用正确的用户名 ochenoktochen/XMBOX
- 优化更新检测逻辑,支持智能镜像选择和错误处理
- 增强用户体验,显示具体的更新失败原因
- 支持GitHub API限流时自动切换到Gitee镜像源
2025-08-06 14:35:54 +08:00
5 changed files with 54 additions and 4 deletions
@@ -6,6 +6,7 @@ import android.view.View;
import androidx.appcompat.app.AlertDialog;
import com.fongmi.android.tv.App;
import com.fongmi.android.tv.databinding.DialogUpdateBinding;
import com.fongmi.android.tv.utils.Download;
import com.fongmi.android.tv.utils.FileUtil;
@@ -79,13 +80,38 @@ public class Updater implements Download.Callback {
private void doInBackground(Activity activity) {
try {
JSONObject object = new JSONObject(OkHttp.string(getJson()));
String response = OkHttp.string(getJson());
// 检查响应是否包含错误信息
if (response.contains("rate limit exceeded")) {
App.post(() -> Notify.show("检查更新失败:API请求过于频繁,请稍后重试"));
return;
}
if (response.contains("Not Found Project") || response.contains("Not Found")) {
App.post(() -> Notify.show("检查更新失败:更新服务暂时不可用"));
return;
}
JSONObject object = new JSONObject(response);
String name = object.optString("name");
String desc = object.optString("desc");
int code = object.optInt("code");
if (need(code, name)) App.post(() -> show(activity, name, desc));
} catch (Exception e) {
e.printStackTrace();
// 添加用户友好的错误提示
App.post(() -> {
String errorMsg = "检查更新失败";
if (e.getMessage() != null && e.getMessage().contains("rate limit")) {
errorMsg = "检查更新失败:请求过于频繁,请稍后重试";
} else if (e.getMessage() != null && e.getMessage().contains("Not Found")) {
errorMsg = "检查更新失败:更新服务暂时不可用";
} else {
errorMsg = "检查更新失败,请稍后重试";
}
Notify.show(errorMsg);
});
}
}
@@ -7,6 +7,7 @@ import android.view.View;
import androidx.appcompat.app.AlertDialog;
import com.fongmi.android.tv.App;
import com.fongmi.android.tv.databinding.DialogUpdateBinding;
import com.fongmi.android.tv.utils.Download;
import com.fongmi.android.tv.utils.FileUtil;
@@ -124,6 +125,17 @@ public class Updater implements Download.Callback {
String response = OkHttp.string(jsonUrl);
Logger.d("Update check response: " + response);
// 检查响应是否包含错误信息
if (response.contains("rate limit exceeded")) {
App.post(() -> Notify.show("检查更新失败:API请求过于频繁,请稍后重试"));
return;
}
if (response.contains("Not Found Project") || response.contains("Not Found")) {
App.post(() -> Notify.show("检查更新失败:更新服务暂时不可用"));
return;
}
JSONObject release = new JSONObject(response);
String tagName = release.getString("tag_name");
String body = release.getString("body");
@@ -148,6 +160,18 @@ public class Updater implements Download.Callback {
} catch (Exception e) {
Logger.e("Update check failed", e);
e.printStackTrace();
// 添加用户友好的错误提示
App.post(() -> {
String errorMsg = "检查更新失败";
if (e.getMessage() != null && e.getMessage().contains("rate limit")) {
errorMsg = "检查更新失败:请求过于频繁,请稍后重试";
} else if (e.getMessage() != null && e.getMessage().contains("Not Found")) {
errorMsg = "检查更新失败:更新服务暂时不可用";
} else {
errorMsg = "检查更新失败,请稍后重试";
}
Notify.show(errorMsg);
});
}
}
@@ -17,9 +17,9 @@ public class Github {
public static final String URL = "https://raw.githubusercontent.com/Tosencen/XMBOX/main";
public static final String API_URL = "https://api.github.com/repos/Tosencen/XMBOX/releases/latest";
// 国内镜像地址 - 使用Gitee作为示例,实际应替换为您的镜像地址
public static final String CN_URL = "https://gitee.com/tosencen/XMBOX/raw/main";
public static final String CN_API_URL = "https://gitee.com/api/v5/repos/tosencen/XMBOX/releases/latest";
// 国内镜像地址 - 使用Gitee作为镜像
public static final String CN_URL = "https://gitee.com/ochenoktochen/XMBOX/raw/main";
public static final String CN_API_URL = "https://gitee.com/api/v5/repos/ochenoktochen/XMBOX/releases/latest";
// 存储测速结果
private static Boolean useCnMirror = null;
Binary file not shown.
Binary file not shown.