39 lines
598 B
Go
39 lines
598 B
Go
package validation
|
|
|
|
import (
|
|
"bdgrp_go/pbutil"
|
|
"bdgrp_go/routes"
|
|
"bdgrp_go/utils"
|
|
"fmt"
|
|
|
|
"github.com/gofiber/fiber/v2"
|
|
)
|
|
|
|
func init() {
|
|
path := routes.PathOf()
|
|
routes.Register(func(app *fiber.App) {
|
|
app.Post(path, ngword)
|
|
fmt.Println("Loaded:", path)
|
|
})
|
|
}
|
|
|
|
func ngword(c *fiber.Ctx) error {
|
|
data := map[string]any{
|
|
"isBadWord": false,
|
|
}
|
|
|
|
encoded, err := pbutil.Encode("NgWordResponse", data)
|
|
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
return c.Status(500).SendString("")
|
|
}
|
|
|
|
encrypted, err := utils.Encrypt(encoded)
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
}
|
|
|
|
return c.Send(encrypted)
|
|
}
|