mirror of
https://github.com/nicksherron/bashhub-server.git
synced 2025-09-06 04:14:12 +08:00
working poc
This commit is contained in:
parent
88d920cd35
commit
e01de338d8
3 changed files with 7 additions and 2 deletions
|
@ -102,10 +102,14 @@ func init() {
|
|||
|
||||
func sysRegister(mac string, site string, user string, pass string) {
|
||||
|
||||
host, err := os.Hostname()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
sys := map[string]interface{}{
|
||||
"clientVersion": "1.2.0",
|
||||
"name": "migration",
|
||||
"hostname": os.Hostname(),
|
||||
"hostname": host,
|
||||
"mac": mac,
|
||||
}
|
||||
payloadBytes, err := json.Marshal(sys)
|
||||
|
|
|
@ -95,7 +95,7 @@ func dbInit() {
|
|||
gormdb.AutoMigrate(&Command{})
|
||||
gormdb.AutoMigrate(&System{})
|
||||
//TODO: ensure these are the most efficient indexes
|
||||
gormdb.Model(&User{}).AddIndex("idx_user", "username")
|
||||
gormdb.Model(&User{}).AddUniqueIndex("idx_user", "username")
|
||||
gormdb.Model(&System{}).AddIndex("idx_mac", "mac")
|
||||
gormdb.Model(&Command{}).AddIndex("idx_exit_command_created", "exit_status, created, command")
|
||||
gormdb.Model(&Command{}).AddIndex("idx_user_exit_command_created", "user_id, exit_status, created, command")
|
||||
|
|
|
@ -111,6 +111,7 @@ func loggerWithFormatterWriter(f gin.LogFormatter) gin.HandlerFunc {
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
// Run starts server
|
||||
func Run() {
|
||||
// Initialize backend
|
||||
|
|
Loading…
Add table
Reference in a new issue