adapted node routes further to new id

This commit is contained in:
0xdcarns 2022-01-11 13:05:22 -05:00 committed by Matthew R Kasun
parent 73c982b9fa
commit 0f657b4378
2 changed files with 2 additions and 2 deletions

View file

@ -29,7 +29,7 @@ func nodeHandlers(r *mux.Router) {
r.HandleFunc("/api/nodes/{network}/{nodeid}/createingress", securityCheck(false, http.HandlerFunc(createIngressGateway))).Methods("POST")
r.HandleFunc("/api/nodes/{network}/{nodeid}/deleteingress", securityCheck(false, http.HandlerFunc(deleteIngressGateway))).Methods("DELETE")
r.HandleFunc("/api/nodes/{network}/{nodeid}/approve", authorize(true, "user", http.HandlerFunc(uncordonNode))).Methods("POST")
// r.HandleFunc("/api/nodes/{network}", createNode).Methods("POST")
r.HandleFunc("/api/nodes/{network}", createNode).Methods("POST")
r.HandleFunc("/api/nodes/adm/{network}/lastmodified", authorize(true, "network", http.HandlerFunc(getLastModified))).Methods("GET")
r.HandleFunc("/api/nodes/adm/{network}/authenticate", authenticate).Methods("POST")

View file

@ -105,10 +105,10 @@ func CreateNode(node *models.Node) error {
return err
}
// TODO: This covers legacy nodes, eventually want to remove legacy check
if (node.IsServer != "yes" && (node.ID == "" || strings.Contains(node.ID, "###"))) || (node.IsServer == "yes" && servercfg.GetNodeID() == "") {
node.ID = uuid.NewString()
}
logger.Log(0, "server ID: ", node.ID)
//Create a JWT for the node
tokenString, _ := CreateJWT(node.ID, node.MacAddress, node.Network)