Remote Setup: Only generate the key if not already generated

This way one can go back and change the clone url if one wants to and
the ssh key would not have changed. There is an additional SSH Key
changing button if one needs to regenerate it for some reason.

This should fix #47. Well, it's not the best solution, but it is a
workaround.

For the Clone Url you must enter SSH-KEY-ID@clone-url-provided-by-aws.
In order to get the SSH KEY ID you must upload the public key provdied
to your AWS Credentials.
This commit is contained in:
Vishesh Handa
2020-01-04 14:44:20 +01:00
parent c21287e97f
commit daa0940066

View File

@ -53,7 +53,6 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
int _currentPageIndex = 0;
Widget _buildPage(BuildContext context, int pos) {
Fimber.d("_buildPage " + pos.toString());
assert(_pageCount >= 1);
if (pos == 0) {
@ -279,6 +278,10 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
}
void _generateSshKey(BuildContext context) {
if (publicKey.isNotEmpty) {
return;
}
var comment = "GitJournal " +
Platform.operatingSystem +
" " +
@ -287,6 +290,7 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
generateSSHKeys(comment: comment).then((String publicKey) {
setState(() {
this.publicKey = publicKey;
Fimber.d("PublicKey: " + publicKey);
_copyKeyToClipboard(context);
});
});
@ -355,6 +359,7 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
String repoPath = p.join(basePath, "journal");
String error;
try {
Fimber.d("Cloning " + _gitCloneUrl);
await GitRepo.clone(repoPath, _gitCloneUrl);
} on GitException catch (e) {
error = e.cause;