diff --git a/src/app/mosh_client.html b/src/app/mosh_client.html index 3f27916..ac1a84a 100644 --- a/src/app/mosh_client.html +++ b/src/app/mosh_client.html @@ -62,6 +62,7 @@ Help
+ Add ssh key
Known Issues
Changelog
diff --git a/src/app/mosh_client.js b/src/app/mosh_client.js index 74dbfcd..bec5057 100644 --- a/src/app/mosh_client.js +++ b/src/app/mosh_client.js @@ -47,6 +47,8 @@ window.onload = function() { sshModeButton.onchange = updateMode; var manualModeButton = document.querySelector('#manual-mode'); manualModeButton.onchange = updateMode; + var sshKeyLink = document.querySelector('#ssh-key'); + sshKeyLink.onclick = onSshKeyClick; loadFields(); var form = document.querySelector('#args'); form.onsubmit = function() { return false; }; @@ -141,3 +143,17 @@ function updateMode(e) { commandRow.hidden = true; } } + +function onSshKeyClick(e) { + chrome.app.window.create( + 'ssh_key.html', + { + 'bounds': { + 'width': 400, + 'height': 300, + }, + 'id': 'ssh_key', + }); + // Prevent default handling. + return true; +} diff --git a/src/app/ssh_key.html b/src/app/ssh_key.html new file mode 100644 index 0000000..541fe1e --- /dev/null +++ b/src/app/ssh_key.html @@ -0,0 +1,35 @@ + + + + Mosh ssh key + + + + + +
+ Add or update your ssh key by pasting it here. To remove your key, + leave the field blank. +
+ +
+ + +
+ + diff --git a/src/app/ssh_key.js b/src/app/ssh_key.js new file mode 100644 index 0000000..a9fc44c --- /dev/null +++ b/src/app/ssh_key.js @@ -0,0 +1,33 @@ +// mosh_client.js - Session setup window. + +// Copyright 2014 Richard Woodbury +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +'use strict'; + +window.onload = function() { + var saveButton = document.querySelector('#save'); + saveButton.onclick = onSaveClick; + var form = document.querySelector('#key-form'); + form.onsubmit = function() { return false; }; +}; + +function onSaveClick(e) { + var field = document.querySelector('#key'); + var o = {}; + o['ssh_key'] = field.value; + chrome.storage.local.set(o); + window.close(); +}