feat: setup deep link handler

closes #34
This commit is contained in:
2025-05-22 10:46:47 +01:00
parent 4e4061b808
commit 4db0317c0b
2 changed files with 41 additions and 1 deletions

View File

@ -76,7 +76,7 @@ void runZapStream() {
if (state.extra is StreamEvent) {
return StreamPage(stream: state.extra as StreamEvent);
} else {
throw UnimplementedError();
return StreamPage.loader(state.pathParameters["id"]!);
}
},
),
@ -119,6 +119,21 @@ void runZapStream() {
),
],
),
GoRoute(
path: "/:id",
redirect: (context, state) {
final id = state.pathParameters["id"]!;
if (id.startsWith("naddr1") ||
id.startsWith("nevent1") ||
id.startsWith("note1")) {
return "/e/$id";
} else if (id.startsWith("npub1") ||
id.startsWith("nprofile1")) {
return "/p/$id";
}
return null;
},
),
],
),
],