#pragma once #include #include #include #include "AsyncHTTPServer.hh" #include "ServerState.hh" class HTTPServer : public AsyncHTTPServer<> { public: explicit HTTPServer(std::shared_ptr state); HTTPServer(const HTTPServer&) = delete; HTTPServer(HTTPServer&&) = delete; HTTPServer& operator=(const HTTPServer&) = delete; HTTPServer& operator=(HTTPServer&&) = delete; virtual ~HTTPServer() = default; asio::awaitable send_rare_drop_notification(std::shared_ptr message); protected: std::shared_ptr state; std::unordered_set> rare_drop_subscribers; std::shared_ptr generate_server_version() const; std::shared_ptr generate_account_json(std::shared_ptr a) const; std::shared_ptr generate_client_json( std::shared_ptr c, std::shared_ptr item_name_index) const; std::shared_ptr generate_lobby_json( std::shared_ptr l, std::shared_ptr item_name_index) const; std::shared_ptr generate_accounts_json() const; std::shared_ptr generate_clients_json() const; std::shared_ptr generate_server_info_json() const; std::shared_ptr generate_lobbies_json() const; std::shared_ptr generate_summary_json() const; std::shared_ptr generate_all_json() const; asio::awaitable> generate_ep3_cards_json(bool trial) const; std::shared_ptr generate_common_table_list_json() const; std::shared_ptr generate_rare_table_list_json() const; asio::awaitable> generate_common_table_json(const std::string& table_name) const; asio::awaitable> generate_rare_table_json(const std::string& table_name) const; asio::awaitable> generate_quest_list_json(std::shared_ptr q); void require_GET(const HTTPRequest& req); phosg::JSON require_POST(const HTTPRequest& req); virtual asio::awaitable> handle_request(std::shared_ptr c, HTTPRequest&& req); virtual asio::awaitable destroy_client(std::shared_ptr c); };