gowhatsapp-multi-devicewhatsapp-apiwhatsapprestgolangwhatsapp-web-multi-devicewhatsapp-api-gorest-apigolang-whatsapp-apigolang-whatsappbot
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
460 B
21 lines
460 B
package middleware
|
|
|
|
import (
|
|
"context"
|
|
"github.com/aldinokemal/go-whatsapp-web-multidevice/config"
|
|
"github.com/gofiber/fiber/v2"
|
|
)
|
|
|
|
func SelectJid() fiber.Handler {
|
|
return func(c *fiber.Ctx) error {
|
|
selectedJid := string(c.Request().Header.Peek("jid"))
|
|
if selectedJid == "" {
|
|
selectedJid = config.AppDefaultDevice
|
|
}
|
|
|
|
ctx := context.WithValue(c.Context(), config.AppSelectedDeviceKey, selectedJid)
|
|
c.SetUserContext(ctx)
|
|
|
|
return c.Next()
|
|
}
|
|
}
|