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
|
2024-05-03 05:41:38 +00:00
|
|
|
constraints(DomainConstraint.new(DOMAIN)) do
|
|
|
|
root(to: redirect("https://#{STATUS_DOMAIN}"))
|
|
|
|
end
|
|
|
|
|
2024-05-03 03:04:43 +00:00
|
|
|
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" })
|
2024-05-03 05:41:38 +00:00
|
|
|
root(action: :index)
|
2024-05-03 03:04:43 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|