Files
BreakEscape/config/routes.rb
Z. Cliffe Schreuders 19db2f530d Refactor whitespace and comments for consistency in BreakEscape controllers and models
- Cleaned up unnecessary whitespace in `games_controller.rb`, `missions_controller.rb`, `game.rb`, `mission.rb`, `routes.rb`, `seeds.rb`, and migration files to enhance code readability.
- Standardized comment formatting across various files to maintain consistency and improve clarity.
2025-11-30 00:06:54 +00:00

41 lines
1.9 KiB
Ruby

BreakEscape::Engine.routes.draw do
# Static files - caught by routes and served by lightweight controller
# This ensures files are served from the engine's public directory
# Constraint { path: /.*/ } ensures we capture the full path including filename with extension
get '/css/*path', to: 'static_files#serve', constraints: { path: /.*/ }
get '/js/*path', to: 'static_files#serve', constraints: { path: /.*/ }
get '/assets/*path', to: 'static_files#serve', constraints: { path: /.*/ }
get '/stylesheets/*path', to: 'static_files#serve', constraints: { path: /.*/ }
get '/:filename.html', to: 'static_files#serve', constraints: { filename: /test-.*|index/ }
# Mission selection
resources :missions, only: [:index, :show]
# Game management
resources :games, only: [:new, :show, :create] do
member do
# Scenario and NPC data
get 'scenario' # Returns full scenario_data JSON (for compatibility)
get 'scenario_map' # Returns minimal layout metadata for navigation
get 'ink' # Returns NPC script (JIT compiled)
get 'room/:room_id', to: 'games#room', as: 'room' # Returns room data for lazy-loading
get 'container/:container_id', to: 'games#container' # Returns locked container contents
# Game state and actions
put 'sync_state' # Periodic state sync
post 'unlock' # Validate unlock attempt
post 'inventory' # Update inventory
# Objectives system
get 'objectives' # Get current objective state
post 'objectives/tasks/:task_id', to: 'games#complete_task', as: 'complete_task'
put 'objectives/tasks/:task_id', to: 'games#update_task_progress', as: 'update_task_progress'
# VM/Flag integration
post 'flags', to: 'games#submit_flag' # Submit CTF flag for validation
end
end
root to: 'missions#index'
end