45 lines
1.5 KiB
Ruby
45 lines
1.5 KiB
Ruby
# 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)) do
|
|
root(to: redirect("https://#{STATUS_DOMAIN}"))
|
|
end
|
|
|
|
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" })
|
|
root(action: :index)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|