summaryrefslogtreecommitdiff
path: root/server/lib/net/app.dart
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/net/app.dart')
-rw-r--r--server/lib/net/app.dart11
1 files changed, 10 insertions, 1 deletions
diff --git a/server/lib/net/app.dart b/server/lib/net/app.dart
index a38d5c0..8936104 100644
--- a/server/lib/net/app.dart
+++ b/server/lib/net/app.dart
@@ -24,12 +24,16 @@ final _log = Logger('server');
/// non-null: the client's menus read the campaign/scenario/character/section
/// JSON from it (the same files the engine loads). [imageDir] (e.g.
/// `assets/images/`) is served at `/images/` when non-null — character and
-/// monster artwork for the main list.
+/// monster artwork for the main list. [i18nDir] (e.g. `assets/i18n/`) is
+/// served at `/i18n/` when non-null — the in-game ability-text translations
+/// the client's card renderer resolves (the reference app's
+/// `TranslationService`, PLAN.md Phase 4).
Handler createHandler({
required String staticDir,
required GameServer gameServer,
String? dataDir,
String? imageDir,
+ String? i18nDir,
}) {
final router = Router();
router.get('/ws', createWebSocketUpgradeHandler(gameServer));
@@ -43,6 +47,9 @@ Handler createHandler({
if (imageDir != null) {
router.mount('/images/', _createStaticHandler(imageDir, plain: true));
}
+ if (i18nDir != null) {
+ router.mount('/i18n/', _createStaticHandler(i18nDir, plain: true));
+ }
// Session endpoint (PLAN.md section 3.3): returns the caller's persistent
// session id, setting the `x-haven-session` cookie when the caller has
// none yet. Browsers then carry the cookie on every same-origin request,
@@ -72,6 +79,7 @@ Future<HttpServer> startServer({
required GameServer gameServer,
String? dataDir,
String? imageDir,
+ String? i18nDir,
}) {
return shelf_io.serve(
createHandler(
@@ -79,6 +87,7 @@ Future<HttpServer> startServer({
gameServer: gameServer,
dataDir: dataDir,
imageDir: imageDir,
+ i18nDir: i18nDir,
),
'0.0.0.0',
port,