This repository has been archived on 2025-11-25. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
combluotion-old/main.go

32 lines
514 B
Go
Raw Normal View History

2023-03-20 20:12:02 -05:00
package main
2023-03-20 20:40:58 -05:00
import (
"log"
"codeberg.org/danjones000/gopub/config"
2023-03-20 20:40:58 -05:00
"github.com/gofiber/fiber/v2"
)
2023-03-23 21:20:44 -05:00
type passReq struct {
Pass string `json:"pass"`
}
2023-03-20 20:12:02 -05:00
func main() {
2023-03-20 20:40:58 -05:00
app := fiber.New()
2023-03-23 21:20:44 -05:00
conf := config.GetConfig()
2023-03-20 20:40:58 -05:00
app.Get("/", func(c *fiber.Ctx) error {
2023-03-23 21:20:44 -05:00
return c.JSON(&conf)
})
app.Post("/check_pass", func(c *fiber.Ctx) error {
req := new(passReq)
if err := c.BodyParser(req); err != nil {
panic(err)
}
return c.JSON(config.CheckPassword(req.Pass))
2023-03-20 20:40:58 -05:00
})
2023-03-20 20:12:02 -05:00
2023-03-20 20:40:58 -05:00
log.Fatal(app.Listen(":3000"))
2023-03-20 20:12:02 -05:00
}