优化了 还是卡
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
#include "Gallery_WebSocket.hpp"
|
||||
#include "Graph_WebSocket.hpp"
|
||||
#include "Gallery_Plots.hpp"
|
||||
#include "Page_Session.hpp"
|
||||
#include <drogon/drogon.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <algorithm>
|
||||
@@ -176,26 +175,15 @@ int run_web_server(std::uint16_t port, const std::filesystem::path& asset_root)
|
||||
};
|
||||
add_media_groups("2d", std::move(gallery_2d));
|
||||
add_media_groups("3d", std::move(gallery_3d));
|
||||
auto page_session = std::make_shared<Page_Session>();
|
||||
auto resolve_plot = [plots](std::string_view id) { return find_plot(*plots, id); };
|
||||
auto websocket = std::make_shared<Graph_WebSocket_Controller>(
|
||||
resolve_plot, page_session);
|
||||
auto websocket = std::make_shared<Graph_WebSocket_Controller>(resolve_plot);
|
||||
auto gallery_websocket = std::make_shared<Gallery_WebSocket_Controller>(
|
||||
[gallery_streams](std::string_view id) {
|
||||
const auto found = gallery_streams->find(std::string{id});
|
||||
return found == gallery_streams->end() ? nullptr : found->second;
|
||||
}, page_session);
|
||||
});
|
||||
auto& app = drogon::app();
|
||||
|
||||
app.registerHandler("/page/session", [page_session](
|
||||
const drogon::HttpRequestPtr&,
|
||||
std::function<void(const drogon::HttpResponsePtr&)>&& callback) {
|
||||
callback(json_response({
|
||||
{"protocol", "aethera.page.session"},
|
||||
{"version", 1},
|
||||
{"token", page_session->begin_page()}}));
|
||||
}, {drogon::Post});
|
||||
|
||||
app.registerHandler("/plot", [plots, plot_media](const drogon::HttpRequestPtr&,
|
||||
std::function<void(const drogon::HttpResponsePtr&)>&& callback) {
|
||||
nlohmann::json result = nlohmann::json::array();
|
||||
|
||||
Reference in New Issue
Block a user