Test can now attempt a login and the browser is shown rather than headless.

This commit is contained in:
Zed A. Shaw 2025-06-18 06:54:59 -04:00
parent e29c36fb5c
commit 831b5ea762
6 changed files with 156 additions and 19 deletions

19
main.go
View file

@ -14,6 +14,11 @@ import (
"github.com/gofiber/fiber/v2/middleware/session"
)
type Login struct {
Username string `db:"username" validate:"required"`
Password string `db:"password" validate:"required"`
}
type Link struct {
Id int `db:"id" json:"id"`
StreamId int `db:"stream_id" json:"stream_id" form:"stream_id" validate:"required,numeric"`
@ -65,6 +70,20 @@ func main() {
return tools.SelectJson[Link](db, c, err, sql, args...)
})
app.Post("/api/login", func (c *fiber.Ctx) error {
login, err := tools.ReceivePost[Login](c)
if(err != nil) {
log.Println(err)
c.Redirect("/error/")
}
log.Printf("username: %s; password: %s", login.Username, login.Password);
return c.Redirect("/")
})
app.Post("/api/link", func (c *fiber.Ctx) error {
link, err := tools.ReceivePost[Link](c)
if(err != nil) {