openSsh method
- Device device,
- DashboardSocket socket
Opens an SSH session (on Windows) for the given device.
Implementation
void openSsh(Device device, DashboardSocket socket) {
if (models.sockets.rover == RoverType.localhost) {
models.home.setMessage(severity: Severity.error, text: "You can't SSH into your own computer silly!");
} else if (socket.destination?.address == null) {
models.home.setMessage(
severity: Severity.error,
text: "Unable to find IP Address for ${device.humanName}, try resetting the network.",
);
} else {
Process.run("cmd", [
// Keep a Powershell window open
"/k", "start", "powershell", "-NoExit", "-command",
// SSH to the IP address, and do not care if the device fingerprint has changed
"ssh pi@${socket.destination!.address.address} -o StrictHostkeyChecking=no",
]);
}
}