made force-https an option in mobile settings. removed plugin from build
This commit is contained in:
parent
530c3cecf1
commit
f6e6b76249
17
build.py
17
build.py
@ -196,15 +196,6 @@ for fn in glob.glob("plugins/*.user.js"):
|
|||||||
metafn = fn.replace('.user.js', '.meta.js')
|
metafn = fn.replace('.user.js', '.meta.js')
|
||||||
saveScriptAndMeta(script, os.path.join(outDir,fn), os.path.join(outDir,metafn))
|
saveScriptAndMeta(script, os.path.join(outDir,fn), os.path.join(outDir,metafn))
|
||||||
|
|
||||||
def copytree(src, dst, symlinks=False, ignore=None):
|
|
||||||
for item in os.listdir(src):
|
|
||||||
s = os.path.join(src, item)
|
|
||||||
d = os.path.join(dst, item)
|
|
||||||
if os.path.isdir(s):
|
|
||||||
shutil.copytree(s, d, symlinks, ignore)
|
|
||||||
else:
|
|
||||||
shutil.copy2(s, d)
|
|
||||||
|
|
||||||
# if we're building mobile too
|
# if we're building mobile too
|
||||||
if buildMobile:
|
if buildMobile:
|
||||||
if buildMobile not in ['debug','release','copyonly']:
|
if buildMobile not in ['debug','release','copyonly']:
|
||||||
@ -228,13 +219,9 @@ if buildMobile:
|
|||||||
shutil.copy(os.path.join(outDir,"total-conversion-build.user.js"), "mobile/assets/total-conversion-build.user.js")
|
shutil.copy(os.path.join(outDir,"total-conversion-build.user.js"), "mobile/assets/total-conversion-build.user.js")
|
||||||
# copy the user location script into the mobile folder.
|
# copy the user location script into the mobile folder.
|
||||||
shutil.copy(os.path.join(outDir,"user-location.user.js"), "mobile/assets/user-location.user.js")
|
shutil.copy(os.path.join(outDir,"user-location.user.js"), "mobile/assets/user-location.user.js")
|
||||||
|
|
||||||
# also copy plugins
|
# also copy plugins
|
||||||
try:
|
shutil.rmtree("mobile/assets/plugins")
|
||||||
os.makedirs("mobile/assets/plugins")
|
shutil.copytree(os.path.join(outDir,"plugins"), "mobile/assets/plugins", ignore=shutil.ignore_patterns('*.meta.js', 'force-https*'))
|
||||||
except:
|
|
||||||
pass
|
|
||||||
copytree(os.path.join(outDir,"plugins"), "mobile/assets/plugins")
|
|
||||||
|
|
||||||
|
|
||||||
if buildMobile != 'copyonly':
|
if buildMobile != 'copyonly':
|
||||||
|
2
mobile/.gitignore
vendored
2
mobile/.gitignore
vendored
@ -6,6 +6,6 @@ gen/
|
|||||||
libs/
|
libs/
|
||||||
proguard-project.txt
|
proguard-project.txt
|
||||||
local.properties
|
local.properties
|
||||||
assets/iitc.js
|
assets/total-conversion-build.user.js
|
||||||
assets/user-location.user.js
|
assets/user-location.user.js
|
||||||
assets/plugins/
|
assets/plugins/
|
||||||
|
@ -37,6 +37,8 @@
|
|||||||
<string name="pref_force_desktop_sum">Nice for tablets, looks awful on smartphones</string>
|
<string name="pref_force_desktop_sum">Nice for tablets, looks awful on smartphones</string>
|
||||||
<string name="pref_user_loc">Display user location</string>
|
<string name="pref_user_loc">Display user location</string>
|
||||||
<string name="pref_user_loc_sum">Show users position on map</string>
|
<string name="pref_user_loc_sum">Show users position on map</string>
|
||||||
|
<string name="pref_force_https">Force https</string>
|
||||||
|
<string name="pref_force_https_sum">Disabling may improve performance</string>
|
||||||
<string name="pref_developer_options">Developer options</string>
|
<string name="pref_developer_options">Developer options</string>
|
||||||
<string name="pref_enable_dev_mode">Enable developer mode</string>
|
<string name="pref_enable_dev_mode">Enable developer mode</string>
|
||||||
<string name="pref_enable_dev_mode_sum">If enabled, all IITC sources will be loaded from external storage of the Android device.
|
<string name="pref_enable_dev_mode_sum">If enabled, all IITC sources will be loaded from external storage of the Android device.
|
||||||
|
@ -36,6 +36,11 @@
|
|||||||
android:key="pref_plugins"
|
android:key="pref_plugins"
|
||||||
android:title="@string/pref_plugins"
|
android:title="@string/pref_plugins"
|
||||||
android:dialogTitle="@string/pref_plugins_title"/>
|
android:dialogTitle="@string/pref_plugins_title"/>
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="pref_force_https"
|
||||||
|
android:title="@string/pref_force_https"
|
||||||
|
android:summary="@string/pref_force_https_sum"
|
||||||
|
android:defaultValue="true" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
|
@ -114,7 +114,6 @@ public class IITC_Mobile extends Activity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Log.d("iitcm", "no intent...loading " + intel_url);
|
|
||||||
this.loadUrl(intel_url);
|
this.loadUrl(intel_url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -260,9 +259,8 @@ public class IITC_Mobile extends Activity {
|
|||||||
// plugins are injected onPageFinished
|
// plugins are injected onPageFinished
|
||||||
public void loadUrl(String url) {
|
public void loadUrl(String url) {
|
||||||
url = addUrlParam(url);
|
url = addUrlParam(url);
|
||||||
Log.d("iitcm", "injecting js...");
|
Log.d("iitcm", "injecting main-script...");
|
||||||
injectJS();
|
injectJS();
|
||||||
Log.d("iitcm", "loading url: " + url);
|
|
||||||
iitc_view.loadUrl(url);
|
iitc_view.loadUrl(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@ public class IITC_Settings extends Activity {
|
|||||||
ArrayList<String> asset_values = new ArrayList<String>();
|
ArrayList<String> asset_values = new ArrayList<String>();
|
||||||
|
|
||||||
for (int i = 0; i < asset_array.length ; i++) {
|
for (int i = 0; i < asset_array.length ; i++) {
|
||||||
if (asset_array[i].endsWith("user.js")) {
|
|
||||||
// find user plugin name for user readable entries
|
// find user plugin name for user readable entries
|
||||||
Scanner s = null;
|
Scanner s = null;
|
||||||
String src = "";
|
String src = "";
|
||||||
@ -55,7 +54,6 @@ public class IITC_Settings extends Activity {
|
|||||||
// real value
|
// real value
|
||||||
asset_values.add(asset_array[i]);
|
asset_values.add(asset_array[i]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Bundle bundle = getIntent().getExtras();
|
Bundle bundle = getIntent().getExtras();
|
||||||
bundle.putStringArray("ASSETS", (String[]) asset_list.toArray(new String[0]));
|
bundle.putStringArray("ASSETS", (String[]) asset_list.toArray(new String[0]));
|
||||||
|
@ -2,8 +2,10 @@ package com.cradle.iitc_mobile;
|
|||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.webkit.WebChromeClient;
|
import android.webkit.WebChromeClient;
|
||||||
@ -65,6 +67,20 @@ public class IITC_WebView extends WebView {
|
|||||||
}
|
}
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadUrl(String url) {
|
||||||
|
if (!url.startsWith("javascript:")) {
|
||||||
|
// force https if enabled in settings
|
||||||
|
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||||
|
if (sharedPref.getBoolean("pref_force_https", true))
|
||||||
|
url = url.replace("http://", "https://");
|
||||||
|
else
|
||||||
|
url = url.replace("https://", "http://");
|
||||||
|
Log.d("iitcm", "loading url: " + url);
|
||||||
|
}
|
||||||
|
super.loadUrl(url);
|
||||||
|
}
|
||||||
|
|
||||||
public IITC_WebViewClient getWebViewClient() {
|
public IITC_WebViewClient getWebViewClient() {
|
||||||
return this.webclient;
|
return this.webclient;
|
||||||
}
|
}
|
||||||
@ -79,7 +95,7 @@ public class IITC_WebView extends WebView {
|
|||||||
Log.d("iitcm", "not connected to wifi...load tiles from cache");
|
Log.d("iitcm", "not connected to wifi...load tiles from cache");
|
||||||
settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
|
settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
|
||||||
} else {
|
} else {
|
||||||
Log.d("iitcm", "connected to wifi...load tiles network");
|
Log.d("iitcm", "connected to wifi...load tiles from network");
|
||||||
settings.setCacheMode(WebSettings.LOAD_DEFAULT);
|
settings.setCacheMode(WebSettings.LOAD_DEFAULT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,8 +135,6 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
String[] plugin_array = plugin_list.toArray(new String[0]);
|
String[] plugin_array = plugin_list.toArray(new String[0]);
|
||||||
|
|
||||||
for(int i = 0; i < plugin_list.size(); i++) {
|
for(int i = 0; i < plugin_list.size(); i++) {
|
||||||
if (plugin_array[i].endsWith("user.js"));
|
|
||||||
{
|
|
||||||
Log.d("iitcm", "adding plugin " + plugin_array[i]);
|
Log.d("iitcm", "adding plugin " + plugin_array[i]);
|
||||||
Scanner s = null;
|
Scanner s = null;
|
||||||
String src = "";
|
String src = "";
|
||||||
@ -157,7 +155,6 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
view.loadUrl("javascript:" + src);
|
view.loadUrl("javascript:" + src);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// inject the user location script if enabled in settings
|
// inject the user location script if enabled in settings
|
||||||
if (sharedPref.getBoolean("pref_user_loc", false))
|
if (sharedPref.getBoolean("pref_user_loc", false))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user