From eb1981fd1034537da317016075557bd0b2cb0986 Mon Sep 17 00:00:00 2001 From: M M Arif Date: Sat, 6 Sep 2025 14:47:32 +0500 Subject: [PATCH] Add user agent, improve strings and README --- README.md | 2 -- .../mian/gitnex/clients/GlideHttpClient.java | 20 +++++++++++++++++++ .../mian/gitnex/clients/RetrofitClient.java | 17 ++++++++++++++++ app/src/main/res/values/strings.xml | 10 +++++----- 4 files changed, 42 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 6a2348a8..967f66c0 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,6 @@ GitNex is licensed under the GPLv3 License. Please refer to the LICENSE file for Please make sure that you are on the latest stable release or later for a better app experience. -Check the version [compatibility page](https://codeberg.org/gitnex/GitNex/wiki/Compatibility), which lists all the supported versions along with their compatibility ratios. - ## Build from source Option 1 - Download the source code, open it in Android Studio, and build it there. diff --git a/app/src/main/java/org/mian/gitnex/clients/GlideHttpClient.java b/app/src/main/java/org/mian/gitnex/clients/GlideHttpClient.java index 1f3f7b18..2c5956f2 100644 --- a/app/src/main/java/org/mian/gitnex/clients/GlideHttpClient.java +++ b/app/src/main/java/org/mian/gitnex/clients/GlideHttpClient.java @@ -6,7 +6,9 @@ import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; import javax.net.ssl.X509TrustManager; import okhttp3.OkHttpClient; +import okhttp3.Request; import org.gitnex.tea4j.v2.auth.ApiKeyAuth; +import org.mian.gitnex.helpers.AppUtil; import org.mian.gitnex.helpers.ssl.MemorizingTrustManager; /** @@ -30,6 +32,24 @@ public class GlideHttpClient { .hostnameVerifier( memorizingTrustManager.wrapHostnameVerifier( HttpsURLConnection.getDefaultHostnameVerifier())) + .addInterceptor( + chain -> { + Request originalRequest = chain.request(); + Request modifiedRequest = + originalRequest + .newBuilder() + .header( + "User-Agent", + "GitNex/" + + AppUtil.getAppVersion( + context) + + " (Android " + + android.os.Build.VERSION + .RELEASE + + ")") + .build(); + return chain.proceed(modifiedRequest); + }) .addInterceptor(auth); return builder.build(); diff --git a/app/src/main/java/org/mian/gitnex/clients/RetrofitClient.java b/app/src/main/java/org/mian/gitnex/clients/RetrofitClient.java index 16d7113a..a13b71a9 100644 --- a/app/src/main/java/org/mian/gitnex/clients/RetrofitClient.java +++ b/app/src/main/java/org/mian/gitnex/clients/RetrofitClient.java @@ -80,6 +80,23 @@ public class RetrofitClient { memorizingTrustManager.wrapHostnameVerifier( HttpsURLConnection.getDefaultHostnameVerifier())); + okHttpClient.addInterceptor( + chain -> { + Request originalRequest = chain.request(); + Request modifiedRequest = + originalRequest + .newBuilder() + .header( + "User-Agent", + "GitNex/" + + AppUtil.getAppVersion(context) + + " (Android " + + android.os.Build.VERSION.RELEASE + + ")") + .build(); + return chain.proceed(modifiedRequest); + }); + if (cacheFile != null) { int cacheSize = CACHE_SIZE_MB; try { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index cc1714aa..90fb9092 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -315,7 +315,7 @@ • Members of this team do not have any permissions. • Members of this team can view team repositories. • Members of this team can view and push to team repositories. - • Members of this team can push to and from team repositories and add collaborators. + • Team members can push to and pull from team repositories and add collaborators to them. • Members of this team have owner permissions. show all Org members @@ -339,7 +339,7 @@ Access Controls Members can view and clone team repositories Members can read and push to team repositories - Members can pull and push to team repositories and add collaborators to them + Members can pull from and push to team repositories and add collaborators to them %1$s%2$s,\u0020 %1$s%2$s,\u0020 Please enter team name @@ -638,7 +638,7 @@ Delete branch after merge Merge may fail if you are not authorized to merge this Pull Request. Disabled Merge button means that there are conflicts OR other things to fix before Merge - This branch belong to a forked repository + This branch belongs to a forked repository Merge comment Pull Request was merged successfully Pull Request is not available for merge @@ -818,7 +818,7 @@ It seems that the account for URI %1$s does not exist in the app. You can add one by tapping on the Add New Account button. Go to App - GitNex cannot handle the requested resource. You can open an issue at the project repository as an improvement, providing details of the work. Just launch a default screen for now from the buttons below; it can be changed from settings. + GitNex cannot handle the requested resource. You can open an issue in the project repository for improvement, providing details of the work. Launch the default screen from the buttons below; it can be changed in settings. Biometric Authentication Unlock using your biometric credentials @@ -864,7 +864,7 @@ Tag deleted A tag attached to a release cannot be deleted directly Use Custom Tabs - No application found to open this link. SSH URLs and URLs with another prefix the http:// or https:// are not supported by most browser + No application was found to open this link. SSH URLs and URLs with prefixes other than http:// or https:// are not supported by most browsers %s \u25CF not logged in Follow system (Light/Dark)