module Xssmaze::Server

Defined in:

server.cr

Constant Summary

FILTER_PARAMS = ["type", "q", "vuln", "reach", "exploitable"] of ::String
STATIC_ROUTES = [{path: "/", key: "index"}, {path: "/map/text", key: "map_text"}, {path: "/map/markdown", key: "map_md"}, {path: "/map/categories", key: "categories"}, {path: "/map/openapi", key: "openapi"}, {path: "/sitemap.xml", key: "sitemap"}, {path: "/version", key: "version"}, {path: "/stats", key: "stats"}, {path: "/payloads", key: "payloads"}, {path: "/robots.txt", key: "robots"}, {path: "/assets/index.css", key: "css"}, {path: "/assets/index.js", key: "js"}, {path: "/favicon.svg", key: "favicon"}]

Mapping of route path -> catalog key. Keep this table small and data-driven so adding a new catalog asset is a one-line change.

Class Method Summary

Class Method Detail

def self.filter_indices(mazes : Array(Maze), env) : Array(Int32) #

Narrow the catalog by the /map/json filter params. Returns the surviving indices so the caller can reuse the pre-materialized JSON objects instead of rebuilding them.


[View source]
def self.json_no_store(env) #

[View source]
def self.serve(env, entry : Catalog::Entry, last_modified : String) : String #

Render a cached Catalog::Entry with ETag/304 + gzip support.


[View source]
def self.start!(run_server : Bool = true) #

Wire up every "catalog" route plus the small handful of dynamic ones.


[View source]