|
|
@@ -36,6 +36,16 @@ void registerMetaRoutes(ApiServer& s) {
|
|
|
res.set_content(ss.str(), "text/plain");
|
|
|
res.status = 200;
|
|
|
});
|
|
|
+
|
|
|
+ // Serve /docs (no trailing slash) -> docs/index.html so the page loads without a redirect.
|
|
|
+ svr.Get("/docs", [share](const httplib::Request&, httplib::Response& res) {
|
|
|
+ if (share.empty()) { sendJson(res, 404, {{"error", "not configured"}}); return; }
|
|
|
+ std::ifstream f(share + "/docs/index.html");
|
|
|
+ if (!f) { sendJson(res, 404, {{"error", "not found"}}); return; }
|
|
|
+ std::ostringstream ss; ss << f.rdbuf();
|
|
|
+ res.set_content(ss.str(), "text/html");
|
|
|
+ res.status = 200;
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
} // namespace svapi
|