Skip to content

Commit 999d83c

Browse files
committed
Merge pull request #14 from dodok8/dodok8-remote-follow
2 parents 8efcb58 + defa2d7 commit 999d83c

File tree

9 files changed

+255
-68
lines changed

9 files changed

+255
-68
lines changed

CHANGES.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,23 @@ Version 0.4.0
66

77
To be released.
88

9+
### @fedify/botkit
10+
11+
- Added a remote follow button to the web interface.
12+
[[#10], [#14] by Hyeonseo Kim]
13+
14+
- Added a Follow button on the bot's profile page that allows users to
15+
follow the bot from their own fediverse instance without manual
16+
searching.
17+
- When clicked, the button opens a modal dialog where users can enter
18+
their fediverse handle (e.g., `@username@instance.com`).
19+
- The feature uses WebFinger to discover the user's instance and
20+
automatically redirects to the appropriate follow page using the OStatus
21+
subscribe protocol.
22+
23+
[#10]: https://github.com/fedify-dev/botkit/issues/10
24+
[#14]: https://github.com/fedify-dev/botkit/pull/14
25+
926

1027
Version 0.3.0
1128
-------------

deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"temporal"
99
],
1010
"imports": {
11-
"@fedify/fedify": "jsr:@fedify/fedify@^1.8.8",
11+
"@fedify/fedify": "jsr:@fedify/fedify@1.9.0-dev.1516+8f42bff1",
1212
"@logtape/logtape": "jsr:@logtape/logtape@^1.0.4",
1313
"@std/fs": "jsr:@std/fs@^1.0.19",
1414
"@std/path": "jsr:@std/path@^1.1.1",

deno.lock

Lines changed: 51 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/botkit/deno.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"markdown-it": "npm:markdown-it@^14.1.0",
2424
"mime-db": "npm:mime-db@^1.54.0",
2525
"tsdown": "npm:tsdown@^0.12.8",
26+
"url-template": "npm:url-template@^3.1.1",
2627
"uuid": "npm:uuid@^11.1.0",
2728
"xss": "npm:xss@^1.0.15"
2829
},

packages/botkit/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
"html-entities": "^2.6.0",
9595
"markdown-it": "^14.1.0",
9696
"mime-db": "^1.54.0",
97+
"url-template": "^3.1.1",
9798
"uuid": "^11.1.0",
9899
"x-forwarded-fetch": "catalog:",
99100
"xss": "^1.0.15"
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/** @jsxImportSource hono/jsx */
2+
import type { BotImpl } from "../bot-impl.ts";
3+
4+
export interface FollowButtonProps {
5+
readonly bot: BotImpl<unknown>;
6+
}
7+
8+
export function FollowButton({ bot }: FollowButtonProps) {
9+
return (
10+
<>
11+
<button
12+
id="follow-btn"
13+
type="button"
14+
style="padding: 0.5rem 1rem; background: var(--pico-primary); color: var(--pico-primary-inverse); border: none; border-radius: 0.25rem; cursor: pointer;"
15+
onclick="showFollowModal()"
16+
>
17+
Follow
18+
</button>
19+
<dialog id="follow-modal">
20+
<article style="width: 400px;">
21+
<header style="display: flex; align-items: center; justify-content:space-between">
22+
<h3>Follow {bot.name ?? bot.username}</h3>
23+
<button
24+
aria-label="Close"
25+
rel="prev"
26+
type="button"
27+
onclick="closeFollowModal()"
28+
/>
29+
</header>
30+
<main>
31+
<p>Enter your fediverse handle to follow this account:</p>
32+
<form action="/follow" method="post">
33+
<input
34+
type="text"
35+
id="fediverse-handle"
36+
name="handle"
37+
placeholder="@username@instance.com"
38+
required
39+
style="width: 100%; margin-bottom: 1rem;"
40+
/>
41+
<button type="submit" style="width: 100%;">
42+
Follow
43+
</button>
44+
</form>
45+
</main>
46+
</article>
47+
</dialog>
48+
<script
49+
dangerouslySetInnerHTML={{
50+
__html: `
51+
function showFollowModal() {
52+
document.getElementById('follow-modal').showModal();
53+
}
54+
55+
function closeFollowModal() {
56+
document.getElementById('follow-modal').close();
57+
}
58+
`,
59+
}}
60+
/>
61+
</>
62+
);
63+
}

0 commit comments

Comments
 (0)