-
-
Notifications
You must be signed in to change notification settings - Fork 5
feat: add remote follow #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
12a81f5
feat: add follow button
dodok8 1f798b9
feat: add /follow post route to redirect follow page
dodok8 63e89db
fix: error message on /follow
dodok8 45eb14e
remove: debug code
dodok8 ee767f9
remove: heuristic fallback
dodok8 ac9b6bc
fix: typo in error message
dodok8 82d8246
refactor: change no handle error logic
dodok8 71ef6fb
dep: add url-template
dodok8 313a07e
feat: use url template in followUrl
dodok8 e8a47f7
remove: unused bot handle constant
dodok8 ced9a13
docs: add changelog
dodok8 e5be109
feat: change json to html error page
dodok8 fd5ffca
type: remove type assertion
dodok8 defa2d7
dep: set @fedify/fedify version 1.9.0-dev.1516+8f42bff1
dodok8 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/** @jsxImportSource hono/jsx */ | ||
import type { BotImpl } from "../bot-impl.ts"; | ||
|
||
export interface FollowButtonProps { | ||
readonly bot: BotImpl<unknown>; | ||
} | ||
|
||
export function FollowButton({ bot }: FollowButtonProps) { | ||
return ( | ||
<> | ||
<button | ||
id="follow-btn" | ||
type="button" | ||
style="padding: 0.5rem 1rem; background: var(--pico-primary); color: var(--pico-primary-inverse); border: none; border-radius: 0.25rem; cursor: pointer;" | ||
onclick="showFollowModal()" | ||
> | ||
Follow | ||
</button> | ||
<dialog id="follow-modal"> | ||
<article style="width: 400px;"> | ||
<header style="display: flex; align-items: center; justify-content:space-between"> | ||
<h3>Follow {bot.name ?? bot.username}</h3> | ||
<button | ||
aria-label="Close" | ||
rel="prev" | ||
type="button" | ||
onclick="closeFollowModal()" | ||
/> | ||
</header> | ||
<main> | ||
<p>Enter your fediverse handle to follow this account:</p> | ||
<form action="/follow" method="post"> | ||
<input | ||
type="text" | ||
id="fediverse-handle" | ||
name="handle" | ||
placeholder="@username@instance.com" | ||
required | ||
style="width: 100%; margin-bottom: 1rem;" | ||
/> | ||
<button type="submit" style="width: 100%;"> | ||
Follow | ||
</button> | ||
</form> | ||
</main> | ||
</article> | ||
</dialog> | ||
<script | ||
dangerouslySetInnerHTML={{ | ||
__html: ` | ||
function showFollowModal() { | ||
document.getElementById('follow-modal').showModal(); | ||
} | ||
function closeFollowModal() { | ||
document.getElementById('follow-modal').close(); | ||
} | ||
`, | ||
}} | ||
/> | ||
dodok8 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</> | ||
); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.