mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-20 20:07:52 +02:00
before refactoring to drop the old 'remote' client
This commit is contained in:
parent
c5eea01a23
commit
a4daa28e26
@ -25,10 +25,8 @@ func main() {
|
|||||||
export()
|
export()
|
||||||
case "init":
|
case "init":
|
||||||
shared.CheckFatalError(shared.Setup( os.Args))
|
shared.CheckFatalError(shared.Setup( os.Args))
|
||||||
// TODO: Call ebootstrap here
|
|
||||||
case "install":
|
case "install":
|
||||||
shared.CheckFatalError(shared.Install())
|
shared.CheckFatalError(shared.Install())
|
||||||
// TODO: Call ebootstrap here
|
|
||||||
case "enable":
|
case "enable":
|
||||||
shared.CheckFatalError(shared.Enable())
|
shared.CheckFatalError(shared.Enable())
|
||||||
case "disable":
|
case "disable":
|
||||||
|
@ -17,6 +17,8 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
@ -131,7 +133,17 @@ func Setup(args []string) error {
|
|||||||
config.UserSecret = userSecret
|
config.UserSecret = userSecret
|
||||||
config.IsEnabled = true
|
config.IsEnabled = true
|
||||||
config.DeviceId = uuid.Must(uuid.NewRandom()).String()
|
config.DeviceId = uuid.Must(uuid.NewRandom()).String()
|
||||||
return SetConfig(config)
|
|
||||||
|
err := SetConfig(config)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to persist config to disk: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_, err = http.Get(getServerHostname()+"/api/v1/eregister?user_id=" + shared.UserId(userSecret) + "&device_id=" + config.DeviceId)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to register device with backend: %v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func DisplayResults(results []*HistoryEntry, displayHostname bool) {
|
func DisplayResults(results []*HistoryEntry, displayHostname bool) {
|
||||||
@ -252,7 +264,6 @@ func Install() error {
|
|||||||
_, err = GetConfig()
|
_, err = GetConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// No config, so set up a new installation
|
// No config, so set up a new installation
|
||||||
// TODO: GO THROUGH THE REGISTRATION FLOW
|
|
||||||
return Setup(os.Args)
|
return Setup(os.Args)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user