Feature: Enable in-app updates for private repository

- Added Gitea API token authentication to UpdateManager
- Now can check releases from private repository
- Bumped version to 10.0.5
This commit is contained in:
renato97
2026-01-26 22:08:51 +01:00
parent e3aafd3290
commit 5bd1a2737d
2 changed files with 9 additions and 3 deletions

View File

@@ -8,8 +8,8 @@ android {
applicationId "com.streamplayer" applicationId "com.streamplayer"
minSdk 21 minSdk 21
targetSdk 33 targetSdk 33
versionCode 100400 versionCode 100500
versionName "10.0.4" versionName "10.0.5"
buildConfigField "String", "DEVICE_REGISTRY_URL", '"http://194.163.191.200:4000"' buildConfigField "String", "DEVICE_REGISTRY_URL", '"http://194.163.191.200:4000"'
} }

View File

@@ -45,6 +45,7 @@ public class UpdateManager {
private static final String TAG = "UpdateManager"; private static final String TAG = "UpdateManager";
private static final String LATEST_RELEASE_URL = private static final String LATEST_RELEASE_URL =
"https://gitea.cbcren.online/api/v1/repos/renato97/app/releases/latest"; "https://gitea.cbcren.online/api/v1/repos/renato97/app/releases/latest";
private static final String GITEA_TOKEN = "4b94b3610136529861af0821040a801906821a0f";
private final Context appContext; private final Context appContext;
private final Handler mainHandler; private final Handler mainHandler;
@@ -74,6 +75,7 @@ public class UpdateManager {
try { try {
Request request = new Request.Builder() Request request = new Request.Builder()
.url(LATEST_RELEASE_URL) .url(LATEST_RELEASE_URL)
.header("Authorization", "token " + GITEA_TOKEN)
.get() .get()
.build(); .build();
try (Response response = httpClient.newCall(request).execute()) { try (Response response = httpClient.newCall(request).execute()) {
@@ -247,7 +249,11 @@ public class UpdateManager {
if (TextUtils.isEmpty(url)) { if (TextUtils.isEmpty(url)) {
continue; continue;
} }
Request request = new Request.Builder().url(url).get().build(); Request request = new Request.Builder()
.url(url)
.header("Authorization", "token " + GITEA_TOKEN)
.get()
.build();
try (Response response = httpClient.newCall(request).execute()) { try (Response response = httpClient.newCall(request).execute()) {
if (!response.isSuccessful() || response.body() == null) { if (!response.isSuccessful() || response.body() == null) {
continue; continue;