Size: 1649 bytes.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// cs/apps/trycopilot.ai/ui/ui.hh
// cs/apps/trycopilot.ai/ui/ui.hh
// cs/apps/trycopilot.ai/ui/ui.hh
#ifndef CS_APPS_TRYCOPILOT_AI_UI_UI_HH
#define CS_APPS_TRYCOPILOT_AI_UI_UI_HH

#include "cs/apps/trycopilot.ai/protos/user.proto.hh"
#include "cs/net/http/request.hh"
#include "cs/net/http/response.hh"
#include "cs/net/proto/db/client.gpt.hh"
#include "cs/net/proto/db/database_base_url.gpt.hh"
#include "cs/util/di/context.gpt.hh"

using UIContext = ::cs::util::di::Context<
    ::cs::net::proto::db::DatabaseBaseUrl,
    ::cs::net::proto::db::IDatabaseClient>;

#define DECLARE_HANDLER(_name)   \
  cs::net::http::Response _name( \
      cs::net::http::Request request, UIContext& ctx);

namespace cs::apps::trycopilotai::ui {

DECLARE_HANDLER(GetIndexPage);
DECLARE_HANDLER(GetGame);
DECLARE_HANDLER(GetHealthPage);
DECLARE_HANDLER(Render);
DECLARE_HANDLER(GetRegisterPage);
DECLARE_HANDLER(PostRegisterPage);
DECLARE_HANDLER(GetLoginPage);
DECLARE_HANDLER(PostLoginPage);
DECLARE_HANDLER(GetLogoutPage);
DECLARE_HANDLER(PostLogoutPage);
DECLARE_HANDLER(GetHomePage);
DECLARE_HANDLER(GetLogsPage);
DECLARE_HANDLER(GetAppLogsPage);
DECLARE_HANDLER(GetQuitPage);
DECLARE_HANDLER(ApiListLogs);
DECLARE_HANDLER(GetCodePage);
DECLARE_HANDLER(GetNewWebsite);
DECLARE_HANDLER(GetAboutPage);

std::string extractAuthToken(const std::string& cookie);

ResultOr<std::string> GetToken(
    const cs::net::http::Request& request);

ResultOr<cs::apps::trycopilotai::protos::User>
GetAuthenticatedUser(cs::net::http::Request request,
                     UIContext& ctx);
}  // namespace cs::apps::trycopilotai::ui

#endif  // CS_APPS_TRYCOPILOT_AI_UI_UI_HH
v0 (commit) © 2025 @p13i.io | Load balancer proxied to: cs-code-viewer-3:8080 in 2ms.