Files
warp_engine/app/controllers/warp_engine/api/software_highlighted_controller.rb
T
mr.zeroandClaude Fable 5 2b2a9df136 Phase 4: move catalog controllers and routes into WarpEngine
- update, files and the 6 /api catalog controllers now live in the engine on
  a new WarpEngine::ApiController base (same rescue/mime behavior as host)
- engine routes serve /update, /file/*path, /api/software*, /api/builds*,
  /api/image/:id, /api/download at unchanged public paths via the root mount;
  host routes keep only TTG endpoints (events, members, wiki, rss, swagger)
- /update secret comes from WarpEngine.config.update_secret and an
  unconfigured secret now rejects every request (previously an empty
  UPDATE_SECRET env accepted empty secrets)
- apipie-rails is an engine dependency (DSL in engine controllers); dummy app
  configures apipie with validation off, mirroring the host
- engine request specs: catalog controller specs moved from host plus new
  /update auth contract spec

Verified: engine suite 53 green, host suite 6 green, /api/software and
/api/builds byte-identical to baselines, /update 401/400 behavior intact,
admin and TTG endpoints OK.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-04 19:09:11 +02:00

46 lines
2.1 KiB
Ruby

module WarpEngine
class Api::SoftwareHighlightedController < ApiController
resource_description do
short "Highlighted software"
end
api :GET, "/api/software/highlighted", "Get currently highlighted software entry"
returns code: 200, desc: "Highlighted software with releases and stats" do
property :software, Hash, desc: "Software entry" do
property :ID, Integer, desc: "Software ID"
property :name, String, desc: "Internal name"
property :title, String, desc: "Display title"
property :author, String, desc: "Author name"
property :desc, String, desc: "Short description"
property :story, String, desc: "Long description / story"
property :license, String, desc: "License type"
property :platform, String, desc: "Platform (tic80, love, ebitengine, c64, godot, bevy, phaser)"
property :status, String, desc: "Status"
property :highlighted, :boolean, desc: "Highlighted flag"
property :imageUrl, String, desc: "Default image URL"
end
property :releases, Array, desc: "All releases" do
property :ID, Integer, desc: "Release ID"
property :version, String, desc: "Version string"
property :cartridgePath, String, desc: "Cartridge path"
property :sourcePath, String, desc: "Source path"
property :htmlFolderPath, String, desc: "HTML folder path"
property :docsFolderPath, String, desc: "Docs folder path"
property :downloadCount, Integer, desc: "Download count"
end
property :latestRelease, Hash, desc: "Latest release object"
property :webPlayableRelease, Hash, desc: "Web-playable release (if any)"
property :totalDownloads, Integer, desc: "Total download count across all releases"
end
error code: 404, desc: "No highlighted software found"
def index
result = WarpEngine::SoftwareHighlightedService.new.index
if result
render json: result
else
render json: { error: "no highlighted software found" }, status: :not_found
end
end
end
end