added GM/TM option 'require secure updates' for plugin updates
This commit is contained in:
parent
dcd6fce41e
commit
2a3441003b
@ -135,6 +135,8 @@
|
|||||||
<string name="pref_update_plugins_interval_sum">How often IITCm should search for new plugin versions</string>
|
<string name="pref_update_plugins_interval_sum">How often IITCm should search for new plugin versions</string>
|
||||||
<string name="pref_force_plugin_update">Force plugin update</string>
|
<string name="pref_force_plugin_update">Force plugin update</string>
|
||||||
<string name="pref_force_plugin_update_sum">Update all enabled user plugins</string>
|
<string name="pref_force_plugin_update_sum">Update all enabled user plugins</string>
|
||||||
|
<string name="pref_secure_updates">Require secure updates</string>
|
||||||
|
<string name="pref_secure_updates_sum">If enabled, only https updates are handled</string>
|
||||||
|
|
||||||
<string-array name="pref_hide_fullscreen">
|
<string-array name="pref_hide_fullscreen">
|
||||||
<item>System Bar</item>
|
<item>System Bar</item>
|
||||||
|
@ -106,6 +106,11 @@
|
|||||||
android:key="pref_force_plugin_update"
|
android:key="pref_force_plugin_update"
|
||||||
android:title="@string/pref_force_plugin_update"
|
android:title="@string/pref_force_plugin_update"
|
||||||
android:summary="@string/pref_force_plugin_update_sum"/>
|
android:summary="@string/pref_force_plugin_update_sum"/>
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:key="pref_secure_updates"
|
||||||
|
android:summary="@string/pref_secure_updates_sum"
|
||||||
|
android:title="@string/pref_secure_updates"/>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="pref_advanced_tweaks_cat"
|
android:key="pref_advanced_tweaks_cat"
|
||||||
|
@ -205,6 +205,7 @@ public class IITC_Mobile extends Activity
|
|||||||
} else if (key.equals("pref_press_twice_to_exit")
|
} else if (key.equals("pref_press_twice_to_exit")
|
||||||
|| key.equals("pref_share_selected_tab")
|
|| key.equals("pref_share_selected_tab")
|
||||||
|| key.equals("pref_messages")
|
|| key.equals("pref_messages")
|
||||||
|
|| key.equals("pref_secure_updates")
|
||||||
|| key.equals("pref_external_storage")) {
|
|| key.equals("pref_external_storage")) {
|
||||||
// no reload needed
|
// no reload needed
|
||||||
return;
|
return;
|
||||||
|
@ -41,11 +41,17 @@ public class UpdateScript extends AsyncTask<String, Void, Boolean> {
|
|||||||
final String downloadURL = mScriptInfo.get("downloadURL");
|
final String downloadURL = mScriptInfo.get("downloadURL");
|
||||||
if (updateURL == null) updateURL = downloadURL;
|
if (updateURL == null) updateURL = downloadURL;
|
||||||
|
|
||||||
|
// check for https protocol
|
||||||
|
final URL url = new URL(updateURL);
|
||||||
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mActivity);
|
||||||
|
Boolean secureUpdates = prefs.getBoolean("pref_secure_updates", true);
|
||||||
|
if (!url.getProtocol().equals("https") && secureUpdates) return false;
|
||||||
|
|
||||||
// get remote script meta information
|
// get remote script meta information
|
||||||
final File local_file = new File(mFilePath);
|
final InputStream is = url.openStream();
|
||||||
final InputStream is = new URL(updateURL).openStream();
|
|
||||||
final String local_version = mScriptInfo.get("version");
|
|
||||||
final String remote_version = IITC_FileManager.getScriptInfo(IITC_FileManager.readStream(is)).get("version");
|
final String remote_version = IITC_FileManager.getScriptInfo(IITC_FileManager.readStream(is)).get("version");
|
||||||
|
final File local_file = new File(mFilePath);
|
||||||
|
final String local_version = mScriptInfo.get("version");
|
||||||
|
|
||||||
// update script if neccessary
|
// update script if neccessary
|
||||||
if (local_version.compareTo(remote_version) < 0) {
|
if (local_version.compareTo(remote_version) < 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user