diff --git a/handler/routes.go b/handler/routes.go index 2d3509a..a2424d1 100644 --- a/handler/routes.go +++ b/handler/routes.go @@ -3,11 +3,12 @@ package handler import ( "encoding/json" "fmt" - rice "github.com/GeertJohan/go.rice" "net/http" "strings" "time" + rice "github.com/GeertJohan/go.rice" + "github.com/gorilla/sessions" "github.com/labstack/echo-contrib/session" "github.com/labstack/echo/v4" @@ -192,7 +193,6 @@ func NewClient() echo.HandlerFunc { client.HasPrivateSubnet = true } } - // write client to the database db.Write("clients", client.ID, client) @@ -256,6 +256,8 @@ func UpdateClient() echo.HandlerFunc { client.AllocatedIPs = _client.AllocatedIPs client.AllowedIPs = _client.AllowedIPs client.PrivateSubnets = _client.PrivateSubnets + client.PostUp = _client.PostUp + client.PostDown = _client.PostDown client.UpdatedAt = time.Now().UTC() client.HasPrivateSubnet = false diff --git a/model/client.go b/model/client.go index 923914a..afbeaaa 100644 --- a/model/client.go +++ b/model/client.go @@ -19,6 +19,8 @@ type Client struct { Enabled bool `json:"enabled"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` + PostUp string `json:"post_up"` + PostDown string `json:"post_down"` } // ClientData includes the Client and extra data diff --git a/templates/base.html b/templates/base.html index de8e298..07f9b15 100644 --- a/templates/base.html +++ b/templates/base.html @@ -157,6 +157,16 @@ +