diff --git a/app/src/main/java/com/fox2code/mmm/androidacy/AndroidacyRepoData.java b/app/src/main/java/com/fox2code/mmm/androidacy/AndroidacyRepoData.java index 0a77530..8d205a7 100644 --- a/app/src/main/java/com/fox2code/mmm/androidacy/AndroidacyRepoData.java +++ b/app/src/main/java/com/fox2code/mmm/androidacy/AndroidacyRepoData.java @@ -74,8 +74,8 @@ public final class AndroidacyRepoData extends RepoData { long time = System.currentTimeMillis(); if (this.androidacyBlockade > time) return false; this.androidacyBlockade = time + 30_000L; - // Get token from androidacy_token shared preference - String token = this.cachedPreferences.getString("androidacy_token", null); + // Get token from androidacy_api_token shared preference + String token = this.cachedPreferences.getString("androidacy_api_token", null); if (token != null) { try { Http.doHttpGet("https://" + this.host + "/auth/me?token=" + token, true); @@ -89,7 +89,7 @@ public final class AndroidacyRepoData extends RepoData { Log.w(TAG, "Invalid token, resetting..."); // Remove saved preference SharedPreferences.Editor editor = this.cachedPreferences.edit(); - editor.remove("androidacy_token"); + editor.remove("androidacy_api_token"); editor.apply(); this.token = token = null; } @@ -97,12 +97,16 @@ public final class AndroidacyRepoData extends RepoData { if (token == null) { try { Log.i(TAG, "Refreshing token..."); + // POST request to https://production-api.androidacy.com/auth/register token = new String(Http.doHttpPost( "https://" + this.host + "/auth/register", "foxmmm=true", true), StandardCharsets.UTF_8); + // Parse token + JSONObject jsonObject = new JSONObject(token); + token = jsonObject.getString("token"); // Save token to shared preference SharedPreferences.Editor editor = this.cachedPreferences.edit(); - editor.putString("androidacy_token", token); + editor.putString("androidacy_api_token", token); editor.apply(); } catch (Exception e) { if ("Received error code: 419".equals(e.getMessage()) || diff --git a/app/src/main/java/com/fox2code/mmm/repo/RepoManager.java b/app/src/main/java/com/fox2code/mmm/repo/RepoManager.java index 3fc42a6..26b85bd 100644 --- a/app/src/main/java/com/fox2code/mmm/repo/RepoManager.java +++ b/app/src/main/java/com/fox2code/mmm/repo/RepoManager.java @@ -36,7 +36,7 @@ public final class RepoManager { "https://cdn.jsdelivr.net/gh/Magisk-Modules-Alt-Repo/json@main/modules.json"; public static final String ANDROIDACY_MAGISK_REPO_ENDPOINT = - "https://api.androidacy.com/magisk/repo"; + "https://production-api.androidacy.com/magisk/repo"; public static final String ANDROIDACY_TEST_MAGISK_REPO_ENDPOINT = "https://staging-api.androidacy.com/magisk/repo"; public static final String ANDROIDACY_MAGISK_REPO_HOMEPAGE = diff --git a/app/src/main/java/com/fox2code/mmm/settings/SettingsActivity.java b/app/src/main/java/com/fox2code/mmm/settings/SettingsActivity.java index d92c519..f2e0400 100644 --- a/app/src/main/java/com/fox2code/mmm/settings/SettingsActivity.java +++ b/app/src/main/java/com/fox2code/mmm/settings/SettingsActivity.java @@ -270,6 +270,12 @@ public class SettingsActivity extends FoxActivity implements LanguageActivity { "https://github.com/Fox2Code/FoxMagiskModuleManager"); return true; }); + // Add a listener to pref_androidacy_repo_api_key to update the api key in shared preferences + findPreference("pref_androidacy_repo_api_key").setOnPreferenceChangeListener((preference, newValue) -> { + MainApplication.getSharedPreferences().edit() + .putString("androidacy_api_token", String.valueOf(newValue)).apply(); + return true; + }); findPreference("pref_support").setOnPreferenceClickListener(p -> { devModeStep = 0; IntentHelper.openUrl(p.getContext(), "https://t.me/Fox2Code_Chat"); diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 4f11bdc..741e0e2 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -93,4 +93,5 @@ Repozitář povolen Repozitář zakázán If you disable this, the developer will not get automatic bug reports, and this may make troubleshooting harder + Androidacy API Key diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index cdb56aa..c0e3ed8 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -103,4 +103,5 @@ Deinstallieren Konfig If you disable this, the developer will not get automatic bug reports, and this may make troubleshooting harder + Androidacy API Key diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 520c77d..5c26ca9 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -144,4 +144,5 @@ Μεταφράστηκε απο Tha_14 If you disable this, the developer will not get automatic bug reports, and this may make troubleshooting harder + Androidacy API Key diff --git a/app/src/main/res/values-es-rMX/strings.xml b/app/src/main/res/values-es-rMX/strings.xml index 43ef05e..e8ef531 100644 --- a/app/src/main/res/values-es-rMX/strings.xml +++ b/app/src/main/res/values-es-rMX/strings.xml @@ -128,4 +128,5 @@ Restaurar módulos Esta operación requiere una conexión a Internet. If you disable this, the developer will not get automatic bug reports, and this may make troubleshooting harder + Androidacy API Key diff --git a/app/src/main/res/values-et/strings.xml b/app/src/main/res/values-et/strings.xml index ca51e6b..33720c9 100644 --- a/app/src/main/res/values-et/strings.xml +++ b/app/src/main/res/values-et/strings.xml @@ -88,4 +88,5 @@ Hoidla lubatud Hoidla keelatud If you disable this, the developer will not get automatic bug reports, and this may make troubleshooting harder + Androidacy API Key diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 87eab18..205d017 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -128,4 +128,5 @@ Restaurer les modules Cette opération requière une connexion internet If you disable this, the developer will not get automatic bug reports, and this may make troubleshooting harder + Androidacy API Key diff --git a/app/src/main/res/values-id/strings.xml b/app/src/main/res/values-id/strings.xml index 83931fb..dbef5f2 100644 --- a/app/src/main/res/values-id/strings.xml +++ b/app/src/main/res/values-id/strings.xml @@ -94,4 +94,5 @@ Repo diaktifkan Repo dinonaktifkan If you disable this, the developer will not get automatic bug reports, and this may make troubleshooting harder + Androidacy API Key diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 32c54cd..1725d8c 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -149,4 +149,5 @@ Traduzione di tugaia56 If you disable this, the developer will not get automatic bug reports, and this may make troubleshooting harder + Androidacy API Key diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 923042a..78cb62a 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -41,4 +41,5 @@ 開発者モードが有効です Force English language If you disable this, the developer will not get automatic bug reports, and this may make troubleshooting harder + Androidacy API Key diff --git a/app/src/main/res/values-nb-rNO/strings.xml b/app/src/main/res/values-nb-rNO/strings.xml index 521a3f9..048de70 100644 --- a/app/src/main/res/values-nb-rNO/strings.xml +++ b/app/src/main/res/values-nb-rNO/strings.xml @@ -95,4 +95,5 @@ Pakkebrønn på Pakkebrønn av If you disable this, the developer will not get automatic bug reports, and this may make troubleshooting harder + Androidacy API Key diff --git a/app/src/main/res/values-night-v31/strings.xml b/app/src/main/res/values-night-v31/strings.xml index 56b553c..1258a33 100644 --- a/app/src/main/res/values-night-v31/strings.xml +++ b/app/src/main/res/values-night-v31/strings.xml @@ -1,4 +1,5 @@ If you disable this, the developer will not get automatic bug reports, and this may make troubleshooting harder + Androidacy API Key \ No newline at end of file diff --git a/app/src/main/res/values-night/strings.xml b/app/src/main/res/values-night/strings.xml index 56b553c..1258a33 100644 --- a/app/src/main/res/values-night/strings.xml +++ b/app/src/main/res/values-night/strings.xml @@ -1,4 +1,5 @@ If you disable this, the developer will not get automatic bug reports, and this may make troubleshooting harder + Androidacy API Key \ No newline at end of file diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 73f8383..7e9b6fd 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -147,4 +147,5 @@ Tłumaczenie: Daviteusz If you disable this, the developer will not get automatic bug reports, and this may make troubleshooting harder + Androidacy API Key diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 1977166..594810b 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -149,4 +149,5 @@ Traduzido por mi007d e DanGLES3 If you disable this, the developer will not get automatic bug reports, and this may make troubleshooting harder + Androidacy API Key diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index 9ee1fc3..33d5330 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -138,4 +138,5 @@ Tradus de Fox2Code If you disable this, the developer will not get automatic bug reports, and this may make troubleshooting harder + Androidacy API Key diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 5ab9ad7..560cd61 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -124,4 +124,5 @@ Восстановить модули Для этого действия потребуется подключение к Интернету If you disable this, the developer will not get automatic bug reports, and this may make troubleshooting harder + Androidacy API Key diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 1ffe0c4..41c29ec 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -93,4 +93,5 @@ Repozitár povolený Repozitár zakázaný If you disable this, the developer will not get automatic bug reports, and this may make troubleshooting harder + Androidacy API Key diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index c8790fd..547460b 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -147,4 +147,5 @@ Alprnn357 tarafından çevrildi If you disable this, the developer will not get automatic bug reports, and this may make troubleshooting harder + Androidacy API Key diff --git a/app/src/main/res/values-v23/strings.xml b/app/src/main/res/values-v23/strings.xml index 56b553c..1258a33 100644 --- a/app/src/main/res/values-v23/strings.xml +++ b/app/src/main/res/values-v23/strings.xml @@ -1,4 +1,5 @@ If you disable this, the developer will not get automatic bug reports, and this may make troubleshooting harder + Androidacy API Key \ No newline at end of file diff --git a/app/src/main/res/values-v31/strings.xml b/app/src/main/res/values-v31/strings.xml index 56b553c..1258a33 100644 --- a/app/src/main/res/values-v31/strings.xml +++ b/app/src/main/res/values-v31/strings.xml @@ -1,4 +1,5 @@ If you disable this, the developer will not get automatic bug reports, and this may make troubleshooting harder + Androidacy API Key \ No newline at end of file diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index 997aaee..dd9348f 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -123,4 +123,5 @@ Khôi phục mô-đun Quá trình này yêu cầu kết nối internet If you disable this, the developer will not get automatic bug reports, and this may make troubleshooting harder + Androidacy API Key diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 0fa7ca6..2f66551 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -150,4 +150,5 @@ 由ender-zhao翻译 If you disable this, the developer will not get automatic bug reports, and this may make troubleshooting harder + Androidacy API Key diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 21979bb..5021afb 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -140,4 +140,5 @@ 由 OrStudio.tw(@crcky5322) 提供美妙的翻譯 If you disable this, the developer will not get automatic bug reports, and this may make troubleshooting harder + Androidacy API Key diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7074e48..677f632 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -154,4 +154,6 @@ Translated by Fox2Code Automatically report bugs and performance to the developers If you disable this, the developer will not get automatic bug reports, and this may make troubleshooting harder + Androidacy API Key + Use a custom API key for Androidacy diff --git a/app/src/main/res/xml/repo_preferences.xml b/app/src/main/res/xml/repo_preferences.xml index a0b7c46..0ddc6f7 100644 --- a/app/src/main/res/xml/repo_preferences.xml +++ b/app/src/main/res/xml/repo_preferences.xml @@ -59,6 +59,13 @@ app:icon="@drawable/ic_baseline_upload_file_24" app:title="@string/submit_modules" app:singleLineTitle="false" /> + +