Add Session class to provide getUser() on call.session
Wraps SessionData and user into a Session class that handlers can use via call.session.getUser() instead of accessing services directly. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -51,19 +51,35 @@ const routes: Route[] = [
|
||||
return ret;
|
||||
};
|
||||
|
||||
const rrr = lr(routes)
|
||||
|
||||
const template=`
|
||||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
<ul>
|
||||
{% for route in rrr %}
|
||||
<li><a href="{{ route }}">{{ route }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
`
|
||||
const result = nunjucks.renderString(template,{rrr})
|
||||
|
||||
const listing = lr(routes).join(", ");
|
||||
return {
|
||||
code,
|
||||
result: listing + "\n",
|
||||
contentType: contentTypes.text.plain,
|
||||
result,
|
||||
contentType: contentTypes.text.html,
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/whoami",
|
||||
methods: ["GET"],
|
||||
handler: async (_call: Call): Promise<Result> => {
|
||||
const me = services.session.getUser();
|
||||
handler: async (call: Call): Promise<Result> => {
|
||||
const me = call.session.getUser();
|
||||
const template = `
|
||||
<html>
|
||||
<head></head>
|
||||
|
||||
Reference in New Issue
Block a user