File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import {
2828} from "@fedify/fedify/vocab" ;
2929import { Hono } from "hono" ;
3030import { decode } from "html-entities" ;
31+ import { parseTemplate } from "url-template" ;
3132import type { BotImpl } from "./bot-impl.ts" ;
3233import { FollowButton } from "./components/FollowButton.tsx" ;
3334import { Follower } from "./components/Follower.tsx" ;
@@ -463,10 +464,10 @@ app.post("/follow", async (c) => {
463464
464465 if ( subscribeLink ?. template ) {
465466 const botActorUri = ctx . getActorUri ( bot . identifier ) ;
466- const followUrl = subscribeLink . template . replace (
467- "{uri}" ,
468- encodeURIComponent ( botActorUri . href ) ,
469- ) ;
467+ const followUrlTemplate = parseTemplate ( subscribeLink . template ) ;
468+ const followUrl = followUrlTemplate . expand ( {
469+ uri : botActorUri . href ,
470+ } ) ;
470471 return c . redirect ( followUrl ) ;
471472 }
472473
You can’t perform that action at this time.
0 commit comments