20.0: Updater: Add server choices

Also fixes .onion support

TODO: Test and backport to previous branches

Signed-off-by: Tavi <tavi@divested.dev>
This commit is contained in:
Tavi 2024-05-18 12:50:02 -04:00
parent d01a7b9e92
commit 67e962e0f6
No known key found for this signature in database
GPG Key ID: E599F62ECBAEAF2E
10 changed files with 237 additions and 16 deletions

View File

@ -0,0 +1,199 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tavi <tavi@divested.dev>
Date: Sat, 18 May 2024 11:21:24 -0400
Subject: [PATCH] Add server choices
Change-Id: I43524f0567eabff163ce81c4a93cf145542a3d5d
Signed-off-by: Tavi <tavi@divested.dev>
---
app/src/main/AndroidManifest.xml | 3 ++-
.../lineageos/updater/UpdatesActivity.java | 3 +++
.../org/lineageos/updater/misc/Constants.java | 11 ++++++++
.../org/lineageos/updater/misc/Utils.java | 27 ++++++++++++++++---
.../main/res/layout/preferences_dialog.xml | 22 +++++++++++++++
app/src/main/res/values/arrays.xml | 7 +++++
app/src/main/res/values/strings.xml | 5 ++++
.../main/res/xml/network_security_config.xml | 8 ++++++
8 files changed, 81 insertions(+), 5 deletions(-)
create mode 100644 app/src/main/res/xml/network_security_config.xml
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 6041740..a4cdf95 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -29,7 +29,8 @@
android:requestLegacyExternalStorage="true"
android:supportsRtl="true"
android:theme="@style/AppTheme"
- android:usesCleartextTraffic="false">
+ android:usesCleartextTraffic="false"
+ android:networkSecurityConfig="@xml/network_security_config">
<activity
android:name=".UpdatesActivity"
diff --git a/app/src/main/java/org/lineageos/updater/UpdatesActivity.java b/app/src/main/java/org/lineageos/updater/UpdatesActivity.java
index 387eea0..cd91968 100644
--- a/app/src/main/java/org/lineageos/updater/UpdatesActivity.java
+++ b/app/src/main/java/org/lineageos/updater/UpdatesActivity.java
@@ -573,6 +573,7 @@ public class UpdatesActivity extends UpdatesListActivity implements UpdateImport
private void showPreferencesDialog() {
View view = LayoutInflater.from(this).inflate(R.layout.preferences_dialog, null);
Spinner autoCheckInterval = view.findViewById(R.id.preferences_auto_updates_check_interval);
+ Spinner serverChoice = view.findViewById(R.id.preferences_server_choice);
SwitchCompat onionRouting = view.findViewById(R.id.preferences_onion_routing);
SwitchCompat autoDelete = view.findViewById(R.id.preferences_auto_delete_updates);
SwitchCompat meteredNetworkWarning = view.findViewById(
@@ -627,6 +628,8 @@ public class UpdatesActivity extends UpdatesListActivity implements UpdateImport
prefs.edit()
.putInt(Constants.PREF_AUTO_UPDATES_CHECK_INTERVAL,
autoCheckInterval.getSelectedItemPosition())
+ .putInt(Constants.PREF_SERVER_CHOICE,
+ serverChoice.getSelectedItemPosition())
.putBoolean(Constants.PREF_ONION_ROUTING,
onionRouting.isChecked() && Utils.isOrbotInstalled(getApplicationContext()))
.putBoolean(Constants.PREF_AUTO_DELETE_UPDATES, autoDelete.isChecked())
diff --git a/app/src/main/java/org/lineageos/updater/misc/Constants.java b/app/src/main/java/org/lineageos/updater/misc/Constants.java
index 825e1a0..eac5451 100644
--- a/app/src/main/java/org/lineageos/updater/misc/Constants.java
+++ b/app/src/main/java/org/lineageos/updater/misc/Constants.java
@@ -17,8 +17,19 @@ public final class Constants {
public static final int AUTO_UPDATES_CHECK_INTERVAL_WEEKLY = 2;
public static final int AUTO_UPDATES_CHECK_INTERVAL_MONTHLY = 3;
+ public static final int PREF_SERVER_CHOICE_PRIMARY = 0;
+ public static final int PREF_SERVER_CHOICE_SECONDARY = 1;
+ public static final int PREF_SERVER_CHOICE_ONION_PRIMARY = 2;
+ public static final int PREF_SERVER_CHOICE_ONION_SECONDARY = 3;
+
+ public static final String PREF_SERVER_CHOICE_PRIMARY_ACTUAL = "0OTA_SERVER_CLEARNET_PRIMARY0";
+ public static final String PREF_SERVER_CHOICE_SECONDARY_ACTUAL = "0OTA_SERVER_CLEARNET_SECONDARY0";
+ public static final String PREF_SERVER_CHOICE_ONION_PRIMARY_ACTUAL = "0OTA_SERVER_ONION_PRIMARY0";
+ public static final String PREF_SERVER_CHOICE_ONION_SECONDARY_ACTUAL = "0OTA_SERVER_ONION_SECONDARY0";
+
public static final String PREF_LAST_UPDATE_CHECK = "last_update_check";
public static final String PREF_AUTO_UPDATES_CHECK_INTERVAL = "auto_updates_check_interval";
+ public static final String PREF_SERVER_CHOICE = "server_choice";
public static final String PREF_ONION_ROUTING = "onion_routing";
public static final String PREF_AUTO_DELETE_UPDATES = "auto_delete_updates";
public static final String PREF_AB_PERF_MODE = "ab_perf_mode";
diff --git a/app/src/main/java/org/lineageos/updater/misc/Utils.java b/app/src/main/java/org/lineageos/updater/misc/Utils.java
index 3d4aab9..efcd363 100644
--- a/app/src/main/java/org/lineageos/updater/misc/Utils.java
+++ b/app/src/main/java/org/lineageos/updater/misc/Utils.java
@@ -201,14 +201,33 @@ public class Utils {
return listening;
}
+ public static int getServerChoiceSetting(Context context) {
+ SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
+ return preferences.getInt(Constants.PREF_SERVER_CHOICE,
+ Constants.PREF_SERVER_CHOICE_PRIMARY);
+ }
+
+ public static String getServerBaseUrl(Context context) {
+ switch (Utils.getServerChoiceSetting(context)) {
+ case Constants.PREF_SERVER_CHOICE_PRIMARY:
+ default:
+ return Constants.PREF_SERVER_CHOICE_PRIMARY_ACTUAL;
+ case Constants.PREF_SERVER_CHOICE_SECONDARY_ACTUAL:
+ return Constants.PREF_SERVER_CHOICE_PRIMARY_ACTUAL;
+ case Constants.PREF_SERVER_CHOICE_ONION_PRIMARY:
+ return Constants.PREF_SERVER_CHOICE_ONION_PRIMARY_ACTUAL;
+ case Constants.PREF_SERVER_CHOICE_ONION_SECONDARY:
+ return Constants.PREF_SERVER_CHOICE_ONION_SECONDARY_ACTUAL;
+ }
+ }
+
public static String getServerURL(Context context) {
String incrementalVersion = SystemProperties.get(Constants.PROP_BUILD_VERSION_INCREMENTAL);
String device = SystemProperties.get(Constants.PROP_NEXT_DEVICE,
SystemProperties.get(Constants.PROP_DEVICE));
- String server = "0OTA_SERVER_CLEARNET0";
- String serverOnion = "0OTA_SERVER_ONION0";
- if(serverOnion.toLowerCase().startsWith("http") && isOnionRoutingEnabled(context)) {
- server = serverOnion;
+ String server = getServerBaseUrl(context);
+ if (!isOnionRoutingEnabled(context) && server.contains(".onion/")) {
+ server = Constants.PREF_SERVER_CHOICE_PRIMARY_ACTUAL;
}
return server + "?base=LineageOS&device=" + device + "&inc=" + incrementalVersion;
diff --git a/app/src/main/res/layout/preferences_dialog.xml b/app/src/main/res/layout/preferences_dialog.xml
index 8a01e3d..495cb5c 100644
--- a/app/src/main/res/layout/preferences_dialog.xml
+++ b/app/src/main/res/layout/preferences_dialog.xml
@@ -33,6 +33,28 @@
android:entries="@array/menu_auto_updates_check_interval_entries" />
</LinearLayout>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="16dp"
+ android:orientation="horizontal">
+
+ <TextView
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/menu_server_choice"
+ android:textColor="@color/inverted"
+ android:textSize="16sp" />
+
+ <Spinner
+ android:id="@+id/preferences_server_choice"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:entries="@array/menu_server_choice_entries" />
+ </LinearLayout>
+
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/preferences_onion_routing"
android:layout_width="match_parent"
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
index cc90a3f..2940af9 100644
--- a/app/src/main/res/values/arrays.xml
+++ b/app/src/main/res/values/arrays.xml
@@ -10,4 +10,11 @@
<item>@string/menu_auto_updates_check_interval_weekly</item>
<item>@string/menu_auto_updates_check_interval_monthly</item>
</string-array>
+
+ <string-array name="menu_server_choice_entries" translatable="false">
+ <item>@string/menu_server_choice_primary</item>
+ <item>@string/menu_server_choice_secondary</item>
+ <item>@string/menu_server_choice_onion_primary</item>
+ <item>@string/menu_server_choice_onion_secondary</item>
+ </string-array>
</resources>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index ac159a8..c947659 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -59,6 +59,11 @@
<string name="menu_auto_updates_check_interval_weekly">Once a week</string>
<string name="menu_auto_updates_check_interval_monthly">Once a month</string>
<string name="menu_auto_updates_check_interval_never">Never</string>
+ <string name="menu_server_choice">Server Choice</string>
+ <string name="menu_server_choice_primary">Primary</string>
+ <string name="menu_server_choice_secondary">0OTA_SERVER_CLEARNET_SECONDARY_NAME0</string>
+ <string name="menu_server_choice_onion_primary">Onion #1</string>
+ <string name="menu_server_choice_onion_secondary">Onion #2</string>
<string name="menu_onion_routing">Perform requests over Tor</string>
<string name="menu_auto_delete_updates">Delete updates when installed</string>
<string name="menu_delete_update">Delete</string>
diff --git a/app/src/main/res/xml/network_security_config.xml b/app/src/main/res/xml/network_security_config.xml
new file mode 100644
index 0000000..09b655b
--- /dev/null
+++ b/app/src/main/res/xml/network_security_config.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<network-security-config>
+ <domain-config cleartextTrafficPermitted="true">
+ <domain includeSubdomains="false">0OTA_SERVER_ONION_DOMAIN_PRIMARY0</domain>
+ <domain includeSubdomains="false">0OTA_SERVER_ONION_DOMAIN_SECONDARY0</domain>
+ </domain-config>
+</network-security-config>
+

View File

@ -58,8 +58,8 @@ sed -i '/.*setup_services/s/LineageOS/'"$DOS_BRANDING_NAME"'/g' res/values*/stri
fi; fi;
if enter "packages/apps/Updater"; then if enter "packages/apps/Updater"; then
sed -i 's|0OTA_SERVER_CLEARNET0|'"$DOS_BRANDING_SERVER_OTA"'|' src/org/lineageos/updater/misc/Utils.java; sed -i 's|0OTA_SERVER_CLEARNET0|'"$DOS_OTA_SERVER_LEGACY"'|' src/org/lineageos/updater/misc/Utils.java;
sed -i 's|0OTA_SERVER_ONION0|'"$DOS_BRANDING_SERVER_OTA_ONION"'|' src/org/lineageos/updater/misc/Utils.java; sed -i 's|0OTA_SERVER_ONION0|'"$DOS_OTA_SERVER_LEGACY"'|' src/org/lineageos/updater/misc/Utils.java;
sed -i 's|>LineageOS|>'"$DOS_BRANDING_NAME"'|' res/values*/strings.xml; sed -i 's|>LineageOS|>'"$DOS_BRANDING_NAME"'|' res/values*/strings.xml;
sed -i 's|https://download.lineageos.org/<xliff:g id="device_name">%1$s</xliff:g>/changes|'"$DOS_BRANDING_LINK_NEWS"'|g' res/values*/strings.xml; sed -i 's|https://download.lineageos.org/<xliff:g id="device_name">%1$s</xliff:g>/changes|'"$DOS_BRANDING_LINK_NEWS"'|g' res/values*/strings.xml;
fi; fi;

View File

@ -69,8 +69,8 @@ sed -i '/.*setup_services/s/LineageOS/'"$DOS_BRANDING_NAME"'/g' res/values*/stri
fi; fi;
if enter "packages/apps/Updater"; then if enter "packages/apps/Updater"; then
sed -i 's|0OTA_SERVER_CLEARNET0|'"$DOS_BRANDING_SERVER_OTA"'|' src/org/lineageos/updater/misc/Utils.java; sed -i 's|0OTA_SERVER_CLEARNET0|'"$DOS_OTA_SERVER_LEGACY"'|' src/org/lineageos/updater/misc/Utils.java;
sed -i 's|0OTA_SERVER_ONION0|'"$DOS_BRANDING_SERVER_OTA_ONION"'|' src/org/lineageos/updater/misc/Utils.java; sed -i 's|0OTA_SERVER_ONION0|'"$DOS_OTA_SERVER_LEGACY"'|' src/org/lineageos/updater/misc/Utils.java;
sed -i 's|>LineageOS|>'"$DOS_BRANDING_NAME"'|' res/values*/strings.xml; sed -i 's|>LineageOS|>'"$DOS_BRANDING_NAME"'|' res/values*/strings.xml;
sed -i 's|https://download.lineageos.org/<xliff:g id="device_name">%1$s</xliff:g>/changes|'"$DOS_BRANDING_LINK_NEWS"'|g' res/values*/strings.xml; sed -i 's|https://download.lineageos.org/<xliff:g id="device_name">%1$s</xliff:g>/changes|'"$DOS_BRANDING_LINK_NEWS"'|g' res/values*/strings.xml;
fi; fi;

View File

@ -69,8 +69,8 @@ sed -i '/.*setup_services/s/LineageOS/'"$DOS_BRANDING_NAME"'/g' res/values*/stri
fi; fi;
if enter "packages/apps/Updater"; then if enter "packages/apps/Updater"; then
sed -i 's|0OTA_SERVER_CLEARNET0|'"$DOS_BRANDING_SERVER_OTA"'|' src/org/lineageos/updater/misc/Utils.java; sed -i 's|0OTA_SERVER_CLEARNET0|'"$DOS_OTA_SERVER_LEGACY"'|' src/org/lineageos/updater/misc/Utils.java;
sed -i 's|0OTA_SERVER_ONION0|'"$DOS_BRANDING_SERVER_OTA_ONION"'|' src/org/lineageos/updater/misc/Utils.java; sed -i 's|0OTA_SERVER_ONION0|'"$DOS_OTA_SERVER_LEGACY"'|' src/org/lineageos/updater/misc/Utils.java;
sed -i 's|>LineageOS|>'"$DOS_BRANDING_NAME"'|' res/values*/strings.xml; sed -i 's|>LineageOS|>'"$DOS_BRANDING_NAME"'|' res/values*/strings.xml;
sed -i 's|https://download.lineageos.org/<xliff:g id="device_name">%1$s</xliff:g>/changes|'"$DOS_BRANDING_LINK_NEWS"'|g' res/values*/strings.xml; sed -i 's|https://download.lineageos.org/<xliff:g id="device_name">%1$s</xliff:g>/changes|'"$DOS_BRANDING_LINK_NEWS"'|g' res/values*/strings.xml;
fi; fi;

View File

@ -76,8 +76,8 @@ sed -i '/.*setup_services/s/LineageOS/'"$DOS_BRANDING_NAME"'/g' res/values*/stri
fi; fi;
if enter "packages/apps/Updater"; then if enter "packages/apps/Updater"; then
sed -i 's|0OTA_SERVER_CLEARNET0|'"$DOS_BRANDING_SERVER_OTA"'|' src/org/lineageos/updater/misc/Utils.java; sed -i 's|0OTA_SERVER_CLEARNET0|'"$DOS_OTA_SERVER_LEGACY"'|' src/org/lineageos/updater/misc/Utils.java;
sed -i 's|0OTA_SERVER_ONION0|'"$DOS_BRANDING_SERVER_OTA_ONION"'|' src/org/lineageos/updater/misc/Utils.java; sed -i 's|0OTA_SERVER_ONION0|'"$DOS_OTA_SERVER_LEGACY"'|' src/org/lineageos/updater/misc/Utils.java;
sed -i 's|>LineageOS|>'"$DOS_BRANDING_NAME"'|' res/values*/strings.xml; sed -i 's|>LineageOS|>'"$DOS_BRANDING_NAME"'|' res/values*/strings.xml;
sed -i 's|https://download.lineageos.org/<xliff:g id="device_name">%1$s</xliff:g>/changes|'"$DOS_BRANDING_LINK_NEWS"'|g' res/values*/strings.xml; sed -i 's|https://download.lineageos.org/<xliff:g id="device_name">%1$s</xliff:g>/changes|'"$DOS_BRANDING_LINK_NEWS"'|g' res/values*/strings.xml;
fi; fi;

View File

@ -76,8 +76,8 @@ sed -i '/.*update_recovery/s/Lineage/'"$DOS_BRANDING_NAME"'/g' res/values*/strin
fi; fi;
if enter "packages/apps/Updater"; then if enter "packages/apps/Updater"; then
sed -i 's|0OTA_SERVER_CLEARNET0|'"$DOS_BRANDING_SERVER_OTA"'|' src/org/lineageos/updater/misc/Utils.java; sed -i 's|0OTA_SERVER_CLEARNET0|'"$DOS_OTA_SERVER_LEGACY"'|' src/org/lineageos/updater/misc/Utils.java;
sed -i 's|0OTA_SERVER_ONION0|'"$DOS_BRANDING_SERVER_OTA_ONION"'|' src/org/lineageos/updater/misc/Utils.java; sed -i 's|0OTA_SERVER_ONION0|'"$DOS_OTA_SERVER_LEGACY"'|' src/org/lineageos/updater/misc/Utils.java;
sed -i 's|>LineageOS|>'"$DOS_BRANDING_NAME"'|' res/values*/strings.xml; sed -i 's|>LineageOS|>'"$DOS_BRANDING_NAME"'|' res/values*/strings.xml;
sed -i '/.*toast_forced_update_recovery/s/Lineage/'"$DOS_BRANDING_NAME"'/g' res/values*/strings.xml; sed -i '/.*toast_forced_update_recovery/s/Lineage/'"$DOS_BRANDING_NAME"'/g' res/values*/strings.xml;
sed -i '/.*info_dialog_message/s/Lineage/'"$DOS_BRANDING_NAME"'/g' res/values*/strings.xml; sed -i '/.*info_dialog_message/s/Lineage/'"$DOS_BRANDING_NAME"'/g' res/values*/strings.xml;

View File

@ -76,8 +76,8 @@ sed -i '/.*update_recovery/s/Lineage/'"$DOS_BRANDING_NAME"'/g' res/values*/strin
fi; fi;
if enter "packages/apps/Updater"; then if enter "packages/apps/Updater"; then
sed -i 's|0OTA_SERVER_CLEARNET0|'"$DOS_BRANDING_SERVER_OTA"'|' src/org/lineageos/updater/misc/Utils.java; sed -i 's|0OTA_SERVER_CLEARNET0|'"$DOS_OTA_SERVER_LEGACY"'|' src/org/lineageos/updater/misc/Utils.java;
sed -i 's|0OTA_SERVER_ONION0|'"$DOS_BRANDING_SERVER_OTA_ONION"'|' src/org/lineageos/updater/misc/Utils.java; sed -i 's|0OTA_SERVER_ONION0|'"$DOS_OTA_SERVER_LEGACY"'|' src/org/lineageos/updater/misc/Utils.java;
sed -i 's|>LineageOS|>'"$DOS_BRANDING_NAME"'|' res/values*/strings.xml; sed -i 's|>LineageOS|>'"$DOS_BRANDING_NAME"'|' res/values*/strings.xml;
sed -i '/.*toast_forced_update_recovery/s/Lineage/'"$DOS_BRANDING_NAME"'/g' res/values*/strings.xml; sed -i '/.*toast_forced_update_recovery/s/Lineage/'"$DOS_BRANDING_NAME"'/g' res/values*/strings.xml;
sed -i '/.*info_dialog_message/s/Lineage/'"$DOS_BRANDING_NAME"'/g' res/values*/strings.xml; sed -i '/.*info_dialog_message/s/Lineage/'"$DOS_BRANDING_NAME"'/g' res/values*/strings.xml;

View File

@ -365,6 +365,7 @@ fi;
if enterAndClear "packages/apps/Updater"; then if enterAndClear "packages/apps/Updater"; then
applyPatch "$DOS_PATCHES/android_packages_apps_Updater/0001-Server.patch"; #Switch to our server (DivestOS) applyPatch "$DOS_PATCHES/android_packages_apps_Updater/0001-Server.patch"; #Switch to our server (DivestOS)
applyPatch "$DOS_PATCHES/android_packages_apps_Updater/0002-Tor_Support.patch"; #Add Tor support (DivestOS) applyPatch "$DOS_PATCHES/android_packages_apps_Updater/0002-Tor_Support.patch"; #Add Tor support (DivestOS)
if [ "$DOS_OTA_SERVER_EXTENDED" = true ]; then applyPatch "$DOS_PATCHES/android_packages_apps_Updater/0003-Server_Choices.patch"; fi; #Add server choices (DivestOS)
sed -i 's/PROP_BUILD_VERSION_INCREMENTAL);/PROP_BUILD_VERSION_INCREMENTAL).replaceAll("\\\\.", "");/' app/src/main/java/org/lineageos/updater/misc/Utils.java; #Remove periods from incremental version sed -i 's/PROP_BUILD_VERSION_INCREMENTAL);/PROP_BUILD_VERSION_INCREMENTAL).replaceAll("\\\\.", "");/' app/src/main/java/org/lineageos/updater/misc/Utils.java; #Remove periods from incremental version
#TODO: Remove changelog #TODO: Remove changelog
fi; fi;

View File

@ -77,8 +77,20 @@ sed -i '/.*update_recovery/s/Lineage/'"$DOS_BRANDING_NAME"'/g' res/values*/strin
fi; fi;
if enter "packages/apps/Updater"; then if enter "packages/apps/Updater"; then
sed -i 's|0OTA_SERVER_CLEARNET0|'"$DOS_BRANDING_SERVER_OTA"'|' app/src/main/java/org/lineageos/updater/misc/Utils.java; if [ "$DOS_OTA_SERVER_EXTENDED" = true ]; then
sed -i 's|0OTA_SERVER_ONION0|'"$DOS_BRANDING_SERVER_OTA_ONION"'|' app/src/main/java/org/lineageos/updater/misc/Utils.java; sed -i 's|0OTA_SERVER_CLEARNET_PRIMARY0|'"$DOS_OTA_SERVER_PRIMARY"'|' app/src/main/java/org/lineageos/updater/misc/Constants.java;
sed -i 's|0OTA_SERVER_CLEARNET_SECONDARY0|'"$DOS_OTA_SERVER_SECONDARY"'|' app/src/main/java/org/lineageos/updater/misc/Constants.java;
sed -i 's|0OTA_SERVER_ONION_PRIMARY0|'"$DOS_OTA_SERVER_ONION_PRIMARY"'|' app/src/main/java/org/lineageos/updater/misc/Constants.java;
sed -i 's|0OTA_SERVER_ONION_SECONDARY0|'"$DOS_OTA_SERVER_ONION_SECONDARY"'|' app/src/main/java/org/lineageos/updater/misc/Constants.java;
sed -i 's|0OTA_SERVER_CLEARNET_SECONDARY_NAME0|'"$DOS_OTA_SERVER_SECONDARY_NAME"'|' app/src/main/res/values/strings.xml;
sed -i 's|0OTA_SERVER_ONION_DOMAIN_PRIMARY0|'"$DOS_OTA_SERVER_ONION_DOMAIN_PRIMARY"'|' app/src/main/res/xml/network_security_config.xml;
sed -i 's|0OTA_SERVER_ONION_DOMAIN_SECONDARY0|'"$DOS_OTA_SERVER_ONION_DOMAIN_SECONDARY"'|' app/src/main/res/xml/network_security_config.xml;
else
sed -i 's|0OTA_SERVER_CLEARNET0|'"$DOS_OTA_SERVER_LEGACY"'|' app/src/main/java/org/lineageos/updater/misc/Utils.java;
sed -i 's|0OTA_SERVER_ONION0|'"$DOS_OTA_SERVER_LEGACY"'|' app/src/main/java/org/lineageos/updater/misc/Utils.java;
fi;
sed -i 's|>LineageOS|>'"$DOS_BRANDING_NAME"'|' app/src/main/res/values*/strings.xml; sed -i 's|>LineageOS|>'"$DOS_BRANDING_NAME"'|' app/src/main/res/values*/strings.xml;
sed -i '/.*toast_forced_update_recovery/s/Lineage/'"$DOS_BRANDING_NAME"'/g' app/src/main/res/values*/strings.xml; sed -i '/.*toast_forced_update_recovery/s/Lineage/'"$DOS_BRANDING_NAME"'/g' app/src/main/res/values*/strings.xml;
sed -i '/.*info_dialog_message/s/Lineage/'"$DOS_BRANDING_NAME"'/g' app/src/main/res/values*/strings.xml; sed -i '/.*info_dialog_message/s/Lineage/'"$DOS_BRANDING_NAME"'/g' app/src/main/res/values*/strings.xml;

View File

@ -99,8 +99,17 @@ export DOS_BRANDING_BOOTANIMATION_COLOR="#FF5722-#03A9F4"; #plasma
export DOS_BRANDING_LINK_ABOUT="https://divestos.org/pages/about"; export DOS_BRANDING_LINK_ABOUT="https://divestos.org/pages/about";
export DOS_BRANDING_LINK_NEWS="https://divestos.org/pages/news"; export DOS_BRANDING_LINK_NEWS="https://divestos.org/pages/news";
export DOS_BRANDING_LINK_PRIVACY="https://divestos.org/pages/privacy_policy"; export DOS_BRANDING_LINK_PRIVACY="https://divestos.org/pages/privacy_policy";
export DOS_BRANDING_SERVER_OTA="https://divestos.org/updater.php";
export DOS_BRANDING_SERVER_OTA_ONION="$DOS_BRANDING_SERVER_OTA"; #TODO: need to handle allow cleartext #OTAs
export DOS_OTA_SERVER_LEGACY="https://divestos.org/updater.php";
export DOS_OTA_SERVER_EXTENDED=true; #Enable to provide mutliple choices as set below
export DOS_OTA_SERVER_PRIMARY="https://divestos.org/updater.php";
export DOS_OTA_SERVER_SECONDARY="https://divestos.eeyo.re/updater.php";
export DOS_OTA_SERVER_SECONDARY_NAME="Cloudflare";
export DOS_OTA_SERVER_ONION_PRIMARY="http://divestoseb5nncsydt7zzf5hrfg44md4bxqjs5ifcv4t7gt7u6ohjyyd.onion/updater.php";
export DOS_OTA_SERVER_ONION_SECONDARY="http://2ceyag7ppvhliszes2v25n5lmpwhzqrc7sv72apqka6hwggfi42y2uid.onion/updater.php";
export DOS_OTA_SERVER_ONION_DOMAIN_PRIMARY="divestoseb5nncsydt7zzf5hrfg44md4bxqjs5ifcv4t7gt7u6ohjyyd.onion"; #Used for network security config
export DOS_OTA_SERVER_ONION_DOMAIN_SECONDARY="2ceyag7ppvhliszes2v25n5lmpwhzqrc7sv72apqka6hwggfi42y2uid.onion";
#Theme #Theme
export DOS_THEME_50="FFCA28"; #Amber 400 export DOS_THEME_50="FFCA28"; #Amber 400