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:
@@ -8,8 +8,8 @@ android {
|
||||
applicationId "com.streamplayer"
|
||||
minSdk 21
|
||||
targetSdk 33
|
||||
versionCode 100400
|
||||
versionName "10.0.4"
|
||||
versionCode 100500
|
||||
versionName "10.0.5"
|
||||
buildConfigField "String", "DEVICE_REGISTRY_URL", '"http://194.163.191.200:4000"'
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ public class UpdateManager {
|
||||
private static final String TAG = "UpdateManager";
|
||||
private static final String LATEST_RELEASE_URL =
|
||||
"https://gitea.cbcren.online/api/v1/repos/renato97/app/releases/latest";
|
||||
private static final String GITEA_TOKEN = "4b94b3610136529861af0821040a801906821a0f";
|
||||
|
||||
private final Context appContext;
|
||||
private final Handler mainHandler;
|
||||
@@ -74,6 +75,7 @@ public class UpdateManager {
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(LATEST_RELEASE_URL)
|
||||
.header("Authorization", "token " + GITEA_TOKEN)
|
||||
.get()
|
||||
.build();
|
||||
try (Response response = httpClient.newCall(request).execute()) {
|
||||
@@ -247,7 +249,11 @@ public class UpdateManager {
|
||||
if (TextUtils.isEmpty(url)) {
|
||||
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()) {
|
||||
if (!response.isSuccessful() || response.body() == null) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user