mirror of
https://github.com/rwinkhart/MUTN.git
synced 2026-08-31 22:36:38 -04:00
Port to latest libmutton development version (account for massive refactor)
This commit is contained in:
+7
-6
@@ -10,7 +10,8 @@ import (
|
||||
"github.com/rwinkhart/go-boilerplate/back"
|
||||
"github.com/rwinkhart/go-boilerplate/front"
|
||||
"github.com/rwinkhart/libmutton/core"
|
||||
"github.com/rwinkhart/libmutton/sync"
|
||||
"github.com/rwinkhart/libmutton/global"
|
||||
"github.com/rwinkhart/libmutton/syncclient"
|
||||
)
|
||||
|
||||
// TempInitCli initializes the MUTN environment based on user input.
|
||||
@@ -22,7 +23,7 @@ func TempInitCli() {
|
||||
configSSH := front.InputBinary("Configure SSH settings (for synchronization)?")
|
||||
if configSSH {
|
||||
// necessary SSH info
|
||||
fmt.Println(AnsiBold + "\nNote:" + back.AnsiReset + " Only key-based authentication is supported (keys may optionally be passphrase-protected).\nThe remote server must already be in your ~" + core.PathSeparator + ".ssh" + core.PathSeparator + "known_hosts file.")
|
||||
fmt.Println(AnsiBold + "\nNote:" + back.AnsiReset + " Only key-based authentication is supported (keys may optionally be passphrase-protected).\nThe remote server must already be in your ~" + global.PathSeparator + ".ssh" + global.PathSeparator + "known_hosts file.")
|
||||
sshUser := front.Input("Remote SSH username:")
|
||||
sshPort := front.Input("Remote SSH port:")
|
||||
sshIP := front.Input("Remote SSH IP/domain:")
|
||||
@@ -31,7 +32,7 @@ func TempInitCli() {
|
||||
var sshKey string
|
||||
var sshKeyIsFile bool
|
||||
for !sshKeyIsFile {
|
||||
fallbackSSHKey := back.Home + core.PathSeparator + ".ssh" + core.PathSeparator + "id_ed25519"
|
||||
fallbackSSHKey := back.Home + global.PathSeparator + ".ssh" + global.PathSeparator + "id_ed25519"
|
||||
sshKey = cmp.Or(back.ExpandPathWithHome(front.Input("SSH private identity file path (falls back to \""+fallbackSSHKey+"\"):")), fallbackSSHKey)
|
||||
sshKeyIsFile, _ = back.TargetIsFile(sshKey, false, 0)
|
||||
if !sshKeyIsFile {
|
||||
@@ -42,19 +43,19 @@ func TempInitCli() {
|
||||
sshKeyProtected := front.InputBinary("Is the identity file password-protected?")
|
||||
|
||||
// initialize libmutton directories
|
||||
oldDeviceID := core.DirInit(false)
|
||||
oldDeviceID := global.DirInit(false)
|
||||
|
||||
// write config file (temporarily assigns sshEntryRoot and sshIsWindows to null to pass initial device ID registration)
|
||||
core.WriteConfig([][3]string{{"MUTN", "textEditor", textEditor}, {"LIBMUTTON", "sshUser", sshUser}, {"LIBMUTTON", "sshIP", sshIP}, {"LIBMUTTON", "sshPort", sshPort}, {"LIBMUTTON", "sshKey", sshKey}, {"LIBMUTTON", "sshKeyProtected", strconv.FormatBool(sshKeyProtected)}, {"LIBMUTTON", "sshEntryRoot", "null"}, {"LIBMUTTON", "sshIsWindows", "false"}}, nil, false)
|
||||
|
||||
// generate and register device ID
|
||||
sshEntryRoot, sshIsWindows := sync.DeviceIDGen(oldDeviceID)
|
||||
sshEntryRoot, sshIsWindows := syncclient.DeviceIDGen(oldDeviceID)
|
||||
|
||||
// update config file with sshEntryRoot and sshIsWindows
|
||||
core.WriteConfig([][3]string{{"LIBMUTTON", "sshEntryRoot", sshEntryRoot}, {"LIBMUTTON", "sshIsWindows", sshIsWindows}}, nil, true)
|
||||
} else {
|
||||
// initialize libmutton directories
|
||||
core.DirInit(false)
|
||||
global.DirInit(false)
|
||||
|
||||
// write config file
|
||||
core.WriteConfig([][3]string{{"MUTN", "textEditor", textEditor}}, nil, false)
|
||||
|
||||
Reference in New Issue
Block a user