40 lines
1.2 KiB
Ruby
40 lines
1.2 KiB
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
module OceanicWsRoutes
|
||
|
DOMAIN = "oceanic.ws"
|
||
|
DOCS = "docs"
|
||
|
DOCS_DOMAIN = "#{DOCS}.#{DOMAIN}".freeze
|
||
|
GITHUB = "github"
|
||
|
GITHUB_DOMAIN = "#{GITHUB}.#{DOMAIN}".freeze
|
||
|
|
||
|
def self.extended(router)
|
||
|
router.instance_exec do
|
||
|
namespace(:oceanic_ws, path: "") do
|
||
|
constraints(DomainConstraint.new(DOMAIN)) do
|
||
|
namespace(:home, path: "") do
|
||
|
get(:manifest, constraints: { format: "json" })
|
||
|
get(:browserconfig, constraints: { format: "xml" })
|
||
|
end
|
||
|
|
||
|
root(to: "home#index")
|
||
|
end
|
||
|
|
||
|
constraints(DomainConstraint.new(DOMAIN, DOCS)) do
|
||
|
namespace(:docs, path: "") do
|
||
|
get("/latest(*other)", action: :latest, as: :latest)
|
||
|
get(:json, constraints: { format: "json" })
|
||
|
get(:manifest, constraints: { format: "json" })
|
||
|
get(:browserconfig, constraints: { format: "xml" })
|
||
|
end
|
||
|
|
||
|
root(to: "docs#index", as: :docs_root)
|
||
|
end
|
||
|
|
||
|
constraints(DomainConstraint.new(DOMAIN, GITHUB)) do
|
||
|
resource(:github_webhooks, path: "", only: :create, defaults: { format: "json" })
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|