Mercurial > 510Connectbot
changeset 466:12e2d9dd95df stable-1.9.3-6
add delete_deployment and autolaunch keys to the deployment.connections file
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Thu, 05 Sep 2019 09:24:55 -0700 |
parents | 7c8aebcc882a |
children | bf8c2af0f106 |
files | app/src/main/AndroidManifest.xml app/src/main/java/com/five_ten_sg/connectbot/HostListActivity.java xml/510connectbot.in |
diffstat | 3 files changed, 37 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/app/src/main/AndroidManifest.xml Mon Aug 19 11:12:40 2019 -0700 +++ b/app/src/main/AndroidManifest.xml Thu Sep 05 09:24:55 2019 -0700 @@ -17,8 +17,8 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.five_ten_sg.connectbot" - android:versionName="1.9.3-5" - android:versionCode="1935" + android:versionName="1.9.3-6" + android:versionCode="1936" android:installLocation="auto"> <!-- permissions must match HostListActivity.java -->
--- a/app/src/main/java/com/five_ten_sg/connectbot/HostListActivity.java Mon Aug 19 11:12:40 2019 -0700 +++ b/app/src/main/java/com/five_ten_sg/connectbot/HostListActivity.java Thu Sep 05 09:24:55 2019 -0700 @@ -198,7 +198,8 @@ // connect with hosts database, read deployment file, and populate list hostdb = new HostDatabase(this); - createDeploymentHosts(); // build hosts from a deployment text file + // build hosts from a deployment text file + Uri launch = createDeploymentHosts(); updateList(); // check for eula agreement, which might be set from the deployment file @@ -264,6 +265,12 @@ }); transportSpinner.setAdapter(transportSelection); this.inflater = LayoutInflater.from(this); + + if (launch != null) { + Intent contents = new Intent(Intent.ACTION_VIEW, launch); + contents.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + startActivity(contents); + } } public void checkp(String [] perms) { @@ -423,8 +430,10 @@ return true; } - private void createDeploymentHosts() { + private Uri createDeploymentHosts() { + Uri launch = null; try { + boolean del = true; String fn = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "deployment.connections"; BufferedReader reader = new BufferedReader(new FileReader(fn)); @@ -451,6 +460,11 @@ } if (uri.getScheme().equals("global")) { + String dd = "delete_deployment"; + if (values.containsKey(dd)) { + String sv = values.getAsString(dd); + del = Boolean.parseBoolean(sv); + } Editor editor = prefs.edit(); HashMap<String, String> types = new HashMap<String, String>(); types.put("memkeys", "boolean"); @@ -522,6 +536,13 @@ if (values == null) continue; + String key = "autolaunch"; + if (values.containsKey(key)) { + String sv = values.getAsString(key); + if (Boolean.parseBoolean(sv)) launch = uri; + values.remove(key); + } + SQLiteDatabase db = hostdb.getWritableDatabase(); db.update(HostDatabase.TABLE_HOSTS, values, "_id = ?", new String[] { String.valueOf(host.getId()) }); db.close(); @@ -529,11 +550,12 @@ } reader.close(); - (new File(fn)).delete(); + if (del) (new File(fn)).delete(); } catch (Exception e) { Log.d(TAG, "Deployment scan failed."); } + return launch; } protected void updateList() {
--- a/xml/510connectbot.in Mon Aug 19 11:12:40 2019 -0700 +++ b/xml/510connectbot.in Thu Sep 05 09:24:55 2019 -0700 @@ -357,10 +357,16 @@ file is below. If this file exists at the top level of the external storage (as returned by Environment.getExternalStorageDirectory().getAbsolutePath()), - it is read, parsed, and deleted. Comments start with # + it is read, parsed, and optionally deleted. Comments start with # and extend to the end of the line. </para> + <para> + The deployment file is deleted unless it contains "delete_deployment=false" + in the global options section. In that case, the file remains, and + it is read and parsed every time the app is launched. + </para> + <literallayout class="monospaced"><![CDATA[ # # available host keys: @@ -392,9 +398,10 @@ # wantx11forward (boolean) # x11host (string) # x11port (integer) +# autolaunch (boolean) -tn5250://pub1.rzkh.de:23#battleship +tn5250://pub400.com:23#battleship encryption5250=NONE fontsize=20 fixed_size=true @@ -441,6 +448,7 @@ # upload_dest_prompt (boolean) # background_file_transfer (boolean) # debug_keycodes (boolean) +# delete_deployment (boolean) # global://