mirror of
http://galexander.org/git/simplesshd.git
synced 2025-04-07 16:45:42 +00:00
beginning framework for authorized keys editor
This commit is contained in:
parent
f74a71fdd4
commit
65d628499b
@ -15,6 +15,7 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="Settings" android:label="Settings" />
|
||||
<activity android:name="AuthKeys" android:label="Authorized Keys" />
|
||||
<service android:name="SimpleSSHDService"
|
||||
android:label="SimpleSSHDService" />
|
||||
<receiver android:name="BootReceiver">
|
||||
|
45
res/layout/authkeys.xml
Normal file
45
res/layout/authkeys.xml
Normal file
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<EditText android:id="@+id/authtext"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="start"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:typeface="monospace"
|
||||
android:gravity="top"
|
||||
android:singleLine="false"
|
||||
android:background="#00000000" />
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android_layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<Button android:id="@+id/fetch_auth"
|
||||
android:layout_width="1dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="Fetch"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:onClick="fetch_clicked" />
|
||||
<Button android:id="@+id/cancel_auth"
|
||||
android:layout_width="1dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="Cancel"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:onClick="cancel_clicked" />
|
||||
<Button android:id="@+id/save_auth"
|
||||
android:layout_width="1dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="Save"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:onClick="save_clicked" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
@ -3,6 +3,9 @@
|
||||
<item android:id="@+id/settings"
|
||||
android:icon="@android:drawable/ic_menu_manage"
|
||||
android:title="Settings" />
|
||||
<item android:id="@+id/authkeys"
|
||||
android:icon="@android:drawable/ic_secure"
|
||||
android:title="Authorized Keys" />
|
||||
<item android:id="@+id/doc"
|
||||
android:icon="@android:drawable/ic_menu_help"
|
||||
android:title="Documentation" />
|
||||
|
52
src/org/galexander/sshd/AuthKeys.java
Normal file
52
src/org/galexander/sshd/AuthKeys.java
Normal file
@ -0,0 +1,52 @@
|
||||
package org.galexander.sshd;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.widget.EditText;
|
||||
import android.view.View;
|
||||
|
||||
public class AuthKeys extends Activity {
|
||||
private static final Object lock = new Object();
|
||||
private EditText authtext;
|
||||
private String authtext_str;
|
||||
private long authtext_when; /* XXX - type for timestamp?? */
|
||||
private boolean authtext_needs_save;
|
||||
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.authkeys);
|
||||
authtext = (EditText)findViewById(R.id.authtext);
|
||||
authtext_str = null;
|
||||
authtext_needs_save = false;
|
||||
authtext_when = 0;
|
||||
/* XXX - disable R.id.save_auth */
|
||||
}
|
||||
|
||||
/* XXX - on changes to authtext, enable R.id.save_auth, and set authtext_needs_save */
|
||||
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
/* XXX - start a thread that reads /sdcard/ssh/authorized_keys, updates authtext, iff authorized_keys is newer than authtext_when. sets authtext_when to now if it read anything. otherwise sets authtext from authtext_str */
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
authtext_str = authtext.getText().toString();
|
||||
/* XXX - if unsaved changes, toast notify of them */
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
public void fetch_clicked(View v) {
|
||||
/* XXX - dialog to ask for http...when that dialog is done,
|
||||
* start thread that grabs the http and then appends its
|
||||
* contents to authtext */
|
||||
}
|
||||
|
||||
public void cancel_clicked(View v) {
|
||||
authtext_str = null;
|
||||
authtext_when = 0;
|
||||
}
|
||||
|
||||
public void save_clicked(View v) {
|
||||
/* XXX - start thread that writes to file */
|
||||
}
|
||||
}
|
@ -70,6 +70,9 @@ public class SimpleSSHD extends Activity
|
||||
case R.id.settings:
|
||||
startActivity(new Intent(this, Settings.class));
|
||||
return true;
|
||||
case R.id.authkeys:
|
||||
startActivity(new Intent(this, AuthKeys.class));
|
||||
return true;
|
||||
case R.id.doc: {
|
||||
Intent i = new Intent(Intent.ACTION_VIEW);
|
||||
i.setData(Uri.parse("http://www.galexander.org/software/simplesshd"));
|
||||
|
Loading…
Reference in New Issue
Block a user