luci-app-yggdrasil: support public key in config generation
Signed-off-by: William Fleurant <meshnet@protonmail.com>
This commit is contained in:
parent
e6a1f119e6
commit
6fdafc4155
2 changed files with 8 additions and 2 deletions
|
@ -50,10 +50,12 @@ var cbiKeyPairGenerate = form.DummyValue.extend({
|
|||
'class':'btn',
|
||||
'click':ui.createHandlerFn(this, function(section_id,ev) {
|
||||
var prv = this.section.getUIElement(section_id,'private_key'),
|
||||
pub = this.section.getUIElement(section_id,'public_key'),
|
||||
map = this.map;
|
||||
|
||||
return generateKey().then(function(keypair){
|
||||
prv.setValue(keypair.priv);
|
||||
pub.setValue(keypair.pub);
|
||||
map.save(null,true);
|
||||
});
|
||||
},section_id)
|
||||
|
@ -189,6 +191,10 @@ return network.registerProtocol('yggdrasil',
|
|||
o.password=true;
|
||||
o.validate=validatePrivateKey;
|
||||
|
||||
o=s.taboption('general',form.Value,'public_key',_('Public key'),_('The public key for your Yggdrasil node'));
|
||||
o.optional=true;
|
||||
o.validate=validatePublicKey;
|
||||
|
||||
s.taboption('general',cbiKeyPairGenerate,'_gen_server_keypair',' ');
|
||||
|
||||
o=s.taboption('advanced',form.Value,'mtu',_('MTU'),_('A default MTU of 65535 is set by Yggdrasil. It is recomended to utilize the default.'));
|
||||
|
|
|
@ -16,12 +16,12 @@ case "$1" in
|
|||
case "$2" in
|
||||
generateKeyPair)
|
||||
json_load "$(yggdrasil -genconf -json)"
|
||||
json_get_vars PublicKey PrivateKey
|
||||
json_get_vars PrivateKey
|
||||
json_cleanup
|
||||
json_init
|
||||
json_add_object "keys"
|
||||
json_add_string "priv" "$PrivateKey"
|
||||
json_add_string "pub" "$PublicKey"
|
||||
json_add_string "pub" "${PrivateKey:64}"
|
||||
json_close_object
|
||||
json_dump
|
||||
;;
|
||||
|
|
Loading…
Reference in a new issue