Websites/config/routes/e621_ws_routes.rb

42 lines
1.4 KiB
Ruby
Raw Normal View History

2024-05-03 03:04:43 +00:00
# frozen_string_literal: true
module E621WsRoutes
DOMAIN = "e621.ws"
STATUS = "status"
STATUS_DOMAIN = "#{STATUS}.#{DOMAIN}".freeze
def self.extended(router)
router.instance_exec do
namespace(:e621_ws, path: "") do
constraints(DomainConstraint.new(DOMAIN, STATUS)) do
resource(:json, only: %i[index current history]) do
get(:index, controller: :status, defaults: { format: :json })
get(:current, controller: :status, defaults: { format: :json })
get(:history, controller: :status, defaults: { format: :json })
end
namespace(:status, path: "") do
resource(:schema, only: %i[combined current history index]) do
get(:index, controller: :schema, defaults: { format: :json })
get(:combined, controller: :schema, defaults: { format: :json })
get(:current, controller: :schema, defaults: { format: :json })
get(:history, controller: :schema, defaults: { format: :json })
end
resource(:webhook) do
get(:index)
get(:discord)
get("/discord/cb", action: :discord_callback)
end
get(:manifest, constraints: { format: "json" })
get(:browserconfig, constraints: { format: "xml" })
end
root(to: "status#index")
end
end
end
end
end