diangogav / EDOpro-server-ts

Welcome to Evolution Server, a versatile platform for creating Yu-Gi-Oh! matches, fully compatible with EDOPro, Koishi, and YGO Mobile! But this time, we focus on the scalability of the code, allowing for easy implementation of new features related to the data generated during the duels.
https://evolutionygo.com
13 stars 8 forks source link

Add Admin Authentication Middleware and New Admin Message Endpoint #92

Closed diegofcornejo closed 4 months ago

diegofcornejo commented 4 months ago

Add Admin Authentication Middleware and New Admin Message Endpoint

Summary: This pull request introduces the following enhancements:

  1. AuthAdminMiddleware: A new middleware to secure all /api/admin/* endpoints.
  2. Admin Message Endpoint: A new endpoint at /api/admin/message to send messages to all rooms.

Details:

  1. AuthAdminMiddleware:

    • Purpose: Enhance security for all administrative endpoints.
    • Function: Ensures that only authenticated admin users can access any endpoint prefixed with /api/admin/*.
  2. Admin Message Endpoint:

    • URL: /api/admin/message
    • Method: POST
    • Description: Allows admins to broadcast a message to all rooms.
    • Payload Structure:
      {
      "message": "Evolution Server - Season 4 is ready",
      "reason": "NEWS"
      }

Feel free to make any modifications as needed.