@@ -5,25 +5,29 @@ package npcs
55import (
66 "github.com/labstack/echo/v4"
77
8+ "github.com/keyxmakerx/chronicle/internal/plugins/addons"
89 "github.com/keyxmakerx/chronicle/internal/plugins/auth"
910 "github.com/keyxmakerx/chronicle/internal/plugins/campaigns"
1011)
1112
1213// RegisterRoutes sets up NPC gallery routes on the Echo instance.
1314// Public-capable routes use AllowPublicCampaignAccess so public campaigns
14- // show NPCs to unauthenticated visitors.
15- func RegisterRoutes (e * echo.Echo , h * Handler , campaignSvc campaigns.CampaignService , authSvc auth.AuthService ) {
15+ // show NPCs to unauthenticated visitors. All routes are gated behind the
16+ // "npcs" addon — campaign owners can enable/disable via the Plugin Hub.
17+ func RegisterRoutes (e * echo.Echo , h * Handler , campaignSvc campaigns.CampaignService , authSvc auth.AuthService , addonSvc addons.AddonService ) {
1618 // Authenticated routes: reveal toggle (Scribe+).
1719 cg := e .Group ("/campaigns/:id" ,
1820 auth .RequireAuth (authSvc ),
1921 campaigns .RequireCampaignAccess (campaignSvc ),
22+ addons .RequireAddon (addonSvc , "npcs" ),
2023 )
2124 cg .POST ("/npcs/:eid/reveal" , h .ToggleReveal , campaigns .RequireRole (campaigns .RoleScribe ))
2225
2326 // Public-capable routes: gallery view (Player+).
2427 pub := e .Group ("/campaigns/:id" ,
2528 auth .OptionalAuth (authSvc ),
2629 campaigns .AllowPublicCampaignAccess (campaignSvc ),
30+ addons .RequireAddon (addonSvc , "npcs" ),
2731 )
2832 pub .GET ("/npcs" , h .Index , campaigns .RequireRole (campaigns .RolePlayer ))
2933 pub .GET ("/npcs/count" , h .CountAPI , campaigns .RequireRole (campaigns .RolePlayer ))
0 commit comments