We now mount fs!
This commit is contained in:
parent
72b0ff1fe7
commit
37b9cac605
1 changed files with 31 additions and 39 deletions
|
@ -9,7 +9,7 @@ class LoginWindow private constructor(parent: TApplication, flags: Int) :
|
|||
TWindow(parent, "Login", 0, 0, 36, 19, flags) {
|
||||
constructor(parent: TApplication) : this(parent, CENTERED)
|
||||
|
||||
var loginField = addField(CENTERED + 5, CENTERED - 1, 16, false, "",
|
||||
var loginField = addPasswordField(CENTERED + 5, CENTERED - 1, 16, false, "",
|
||||
// enterAction - function to call when enter key is pressed
|
||||
object : TAction() {
|
||||
override fun DO() {
|
||||
|
@ -24,22 +24,7 @@ class LoginWindow private constructor(parent: TApplication, flags: Int) :
|
|||
}
|
||||
);
|
||||
|
||||
var passField = addPasswordField(CENTERED + 5, CENTERED + 3, 16, false, "",
|
||||
// enterAction - function to call when enter key is pressed
|
||||
object : TAction() {
|
||||
override fun DO() {
|
||||
loginActivity()
|
||||
}
|
||||
},
|
||||
// updateAction - function to call when the text is updated
|
||||
object : TAction() {
|
||||
override fun DO() {
|
||||
return
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
var serverField = addField(CENTERED + 5, CENTERED + 7, 16, false, "",
|
||||
var serverField = addPasswordField(CENTERED + 5, CENTERED + 3, 16, false, "",
|
||||
// enterAction - function to call when enter key is pressed
|
||||
object : TAction() {
|
||||
override fun DO() {
|
||||
|
@ -56,18 +41,28 @@ class LoginWindow private constructor(parent: TApplication, flags: Int) :
|
|||
|
||||
fun loginActivity() {
|
||||
var usernameDetail = loginField.text
|
||||
var passwordDetail = passField.text //TODO: Hash this ples
|
||||
var serverDetail = serverField.text
|
||||
var remoteCommand = "echo hello"
|
||||
//TODO: For windows, instead of ssh pass?? https://github.com/PowerShell/Win32-OpenSSH/issues/1943 and https://github.com/winfsp/sshfs-win for sshfs?
|
||||
val loginProcess = ProcessBuilder(
|
||||
"sshpass", "-p", "$passwordDetail", "ssh", "$usernameDetail@$serverDetail", remoteCommand)
|
||||
.redirectOutput(ProcessBuilder.Redirect.INHERIT)
|
||||
.redirectError(ProcessBuilder.Redirect.INHERIT)
|
||||
.start()
|
||||
.waitFor()
|
||||
//TODO: For windows, instead of ssh pass?? https://github.com/PowerShell/Win32-OpenSSH/issues/1943
|
||||
// and https://github.com/winfsp/sshfs-win for sshfs?
|
||||
// and https://microsoft.github.io/Git-Credential-Manager-for-Windows/Docs/Askpass.html for askpass????
|
||||
//openssh-askpass as well
|
||||
val createMntPnt =
|
||||
ProcessBuilder("mkdir", "/tmp/osda_mount")
|
||||
.redirectOutput(ProcessBuilder.Redirect.INHERIT)
|
||||
.redirectError(ProcessBuilder.Redirect.INHERIT)
|
||||
.start()
|
||||
.waitFor()
|
||||
val remoteMount =
|
||||
ProcessBuilder(
|
||||
"sshfs",
|
||||
"$usernameDetail@$serverDetail:/home/$usernameDetail",
|
||||
"/tmp/osda_mount",
|
||||
"-v"
|
||||
)
|
||||
.redirectOutput(ProcessBuilder.Redirect.INHERIT)
|
||||
.redirectError(ProcessBuilder.Redirect.INHERIT)
|
||||
.start().waitFor()
|
||||
}
|
||||
|
||||
init {
|
||||
setLayoutManager(
|
||||
StretchLayoutManager(
|
||||
|
@ -76,15 +71,7 @@ class LoginWindow private constructor(parent: TApplication, flags: Int) :
|
|||
)
|
||||
)
|
||||
|
||||
addButton("Back...", CENTERED + 8, CENTERED + 11,
|
||||
object : TAction() {
|
||||
override fun DO() {
|
||||
TODO("Instead of full program exit, make it close the login window")
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
addButton("Login", CENTERED + 9, CENTERED + 9,
|
||||
addButton("Login", CENTERED + 9, CENTERED + 6,
|
||||
object : TAction() {
|
||||
override fun DO() {
|
||||
loginActivity()
|
||||
|
@ -92,13 +79,18 @@ class LoginWindow private constructor(parent: TApplication, flags: Int) :
|
|||
}
|
||||
)
|
||||
|
||||
//Password
|
||||
addLabel("Password", CENTERED + 9, CENTERED + 1)
|
||||
addButton("Back...", CENTERED + 8, CENTERED + 8,
|
||||
object : TAction() {
|
||||
override fun DO() {
|
||||
TODO("Instead of full program exit, make it close the login window")
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
//Login
|
||||
addLabel("Username", CENTERED + 9, CENTERED - 3)
|
||||
|
||||
// Server
|
||||
addLabel("Server", CENTERED + 10, CENTERED + 5)
|
||||
addLabel("Server", CENTERED + 10, CENTERED + 1)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue