#!/usr/bin/ruby
# SPDX-FileCopyrightText: 2025 Lady <https://www.ladys.computer/about/#lady>
# SPDX-License-Identifier: CC0-1.0

require "webrick"

server = WEBrick::HTTPServer.new(Port: ARGV[0] || 3000, DocumentRoot: "public", DirectoryIndex: ["index.xhtml"])
trap 'INT' do server.shutdown end

class XHTMLHandler < WEBrick::HTTPServlet::DefaultFileHandler
  def do_GET request, response
    super
    response['Content-Type'] = 'application/xhtml+xml'
  end
end
WEBrick::HTTPServlet::FileHandler.add_handler("xhtml", XHTMLHandler)

server.start
