Update webhook endpoint in application servers
This commit is contained in:
parent
c49475c25f
commit
b263c0a0b3
@ -53,7 +53,7 @@ app.MapPost("/token", async (HttpRequest request) =>
|
||||
}
|
||||
});
|
||||
|
||||
app.MapPost("/webhook", async (HttpRequest request) =>
|
||||
app.MapPost("/livekit/webhook", async (HttpRequest request) =>
|
||||
{
|
||||
var body = new StreamReader(request.Body);
|
||||
string postData = await body.ReadToEndAsync();
|
||||
|
||||
@ -72,6 +72,6 @@ func main() {
|
||||
router := gin.Default()
|
||||
router.Use(cors.Default())
|
||||
router.POST("/token", createToken)
|
||||
router.POST("/webhook", receiveWebhook)
|
||||
router.POST("/livekit/webhook", receiveWebhook)
|
||||
router.Run(":" + SERVER_PORT)
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ public class Controller {
|
||||
return ResponseEntity.ok(Map.of("token", token.toJwt()));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/webhook", consumes = "application/webhook+json")
|
||||
@PostMapping(value = "/livekit/webhook", consumes = "application/webhook+json")
|
||||
public ResponseEntity<String> receiveWebhook(@RequestHeader("Authorization") String authHeader, @RequestBody String body) {
|
||||
WebhookReceiver webhookReceiver = new WebhookReceiver(LIVEKIT_API_KEY, LIVEKIT_API_SECRET);
|
||||
try {
|
||||
|
||||
@ -35,7 +35,7 @@ const webhookReceiver = new WebhookReceiver(
|
||||
LIVEKIT_API_SECRET
|
||||
);
|
||||
|
||||
app.post("/webhook", async (req, res) => {
|
||||
app.post("/livekit/webhook", async (req, res) => {
|
||||
try {
|
||||
const event = await webhookReceiver.receive(
|
||||
req.body,
|
||||
|
||||
@ -44,7 +44,7 @@ if (isset($_SERVER["REQUEST_METHOD"]) && $_SERVER["REQUEST_METHOD"] === "POST" &
|
||||
|
||||
$webhookReceiver = (new WebhookReceiver($LIVEKIT_API_KEY, $LIVEKIT_API_SECRET));
|
||||
|
||||
if (isset($_SERVER["REQUEST_METHOD"]) && $_SERVER["REQUEST_METHOD"] === "POST" && $_SERVER["PATH_INFO"] === "/webhook") {
|
||||
if (isset($_SERVER["REQUEST_METHOD"]) && $_SERVER["REQUEST_METHOD"] === "POST" && $_SERVER["PATH_INFO"] === "/livekit/webhook") {
|
||||
$headers = getallheaders();
|
||||
$authHeader = $headers["Authorization"];
|
||||
$body = file_get_contents("php://input");
|
||||
|
||||
@ -35,7 +35,7 @@ token_verifier = TokenVerifier(LIVEKIT_API_KEY, LIVEKIT_API_SECRET)
|
||||
webhook_receiver = WebhookReceiver(token_verifier)
|
||||
|
||||
|
||||
@app.post("/webhook")
|
||||
@app.post("/livekit/webhook")
|
||||
def receive_webhook():
|
||||
auth_token = request.headers.get("Authorization")
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ post '/token' do
|
||||
return json({token: token.to_jwt})
|
||||
end
|
||||
|
||||
post '/webhook' do
|
||||
post '/livekit/webhook' do
|
||||
auth_header = request.env['HTTP_AUTHORIZATION']
|
||||
token_verifier = LiveKit::TokenVerifier.new(api_key: LIVEKIT_API_KEY, api_secret: LIVEKIT_API_SECRET)
|
||||
begin
|
||||
|
||||
@ -26,7 +26,7 @@ async fn main() {
|
||||
|
||||
let app = Router::new()
|
||||
.route("/token", post(create_token))
|
||||
.route("/webhook", post(receive_webhook))
|
||||
.route("/livekit/webhook", post(receive_webhook))
|
||||
.layer(cors);
|
||||
|
||||
let listener = TcpListener::bind("0.0.0.0:".to_string() + &server_port)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user