Documentation
¶
Index ¶
- func Category(c *gin.Context)
- func CreateReport(req component.BetterRequest[CreateReportReq]) component.Response
- func Drafts(c *gin.Context)
- func Home(c *gin.Context)
- func Links(c *gin.Context)
- func Login(c *gin.Context)
- func Manage(c *gin.Context)
- func Messages(c *gin.Context)
- func Moderation(c *gin.Context)
- func ModerationLogList(req component.BetterRequest[ModerationLogListReq]) component.Response
- func ModerationReportList(req component.BetterRequest[ModerationReportListReq]) component.Response
- func Notifications(c *gin.Context)
- func PostWindow(req component.BetterRequest[PostWindowReq]) component.Response
- func Publish(c *gin.Context)
- func ReloadTemplates()
- func RenderErrorPage(c *gin.Context, status int, title string, messageCode component.MessageCode, ...)
- func RenderInternalOAuthErrorPage(c *gin.Context, messageCode component.MessageCode)
- func RenderNotFoundPage(c *gin.Context, messageCode component.MessageCode)
- func RenderOAuthErrorPage(c *gin.Context, status int, messageCode component.MessageCode)
- func ResetPassword(c *gin.Context)
- func Search(c *gin.Context)
- func Settings(c *gin.Context)
- func SiteThemeCSS(c *gin.Context)
- func Sponsors(c *gin.Context)
- func ThemePreview(c *gin.Context)
- func TopicDetail(c *gin.Context)
- func UpdateModerationPostStatus(req component.BetterRequest[ModerationPostStatusReq]) component.Response
- func UpdateModerationReportStatus(req component.BetterRequest[ModerationReportStatusReq]) component.Response
- func UpdateModerationTopicStatus(req component.BetterRequest[ModerationTopicStatusReq]) component.Response
- func UserProfile(c *gin.Context)
- type AnnouncementPayload
- type CategoryHeaderPayload
- type CategoryNavPayload
- type CategoryPageProps
- type CreateReportReq
- type DraftPayload
- type DraftsPageProps
- type ErrorPageProps
- type FooterPayload
- type FriendLinkPayload
- type HomeProps
- type LayoutPayload
- type LinkGroupPayload
- type LinksPageProps
- type LoginPageProps
- type ManageHomeProps
- type MessagesPageProps
- type ModerationLogItem
- type ModerationLogListReq
- type ModerationLogListResponse
- type ModerationLogSubject
- type ModerationPageProps
- type ModerationPostStatusReq
- type ModerationReportItem
- type ModerationReportListReq
- type ModerationReportListResponse
- type ModerationReportStatusReq
- type ModerationTopicStatusReq
- type NavItemPayload
- type NotificationPayload
- type NotificationTopicPayload
- type NotificationsPageProps
- type OpenGraphMeta
- type PageComponent
- type PageMeta
- type PagePayload
- type PaginationPayload
- type PostPayload
- type PostWindowPayload
- type PostWindowReq
- type PublishCategoryPayload
- type PublishPageProps
- type PublishTopicPayload
- type ReplyTargetPayload
- type ResetPasswordPageProps
- type SearchPageProps
- type SettingsPageProps
- type SettingsStatsPayload
- type SidebarGroupPayload
- type SidebarPayload
- type SitePayload
- type SponsorPayload
- type SponsorSectionPayload
- type SponsorsContactPayload
- type SponsorsPageIntroPayload
- type SponsorsPageProps
- type SponsorsRulePayload
- type TabPayload
- type ThemePayload
- type ThemePreviewProps
- type TopicAuthorPayload
- type TopicCategoryPayload
- type TopicDetailPayload
- type TopicDetailProps
- type TopicPayload
- type TopicPermissions
- type TwitterMeta
- type UnreadStatusPayload
- type UserActivityPayload
- type UserConnectionPayload
- type UserLikePayload
- type UserProfileProps
- type ViewerPayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateReport ¶ added in v0.2.38
func CreateReport(req component.BetterRequest[CreateReportReq]) component.Response
func Moderation ¶ added in v0.2.36
func ModerationLogList ¶ added in v0.2.36
func ModerationLogList(req component.BetterRequest[ModerationLogListReq]) component.Response
func ModerationReportList ¶ added in v0.2.38
func ModerationReportList(req component.BetterRequest[ModerationReportListReq]) component.Response
func Notifications ¶
func PostWindow ¶ added in v0.2.49
func PostWindow(req component.BetterRequest[PostWindowReq]) component.Response
func ReloadTemplates ¶
func ReloadTemplates()
func RenderErrorPage ¶ added in v0.2.14
func RenderErrorPage(c *gin.Context, status int, title string, messageCode component.MessageCode, params component.MessageParams)
RenderErrorPage renders the shared site error page for browser-facing flows that live outside the forum package, such as OAuth callbacks.
func RenderInternalOAuthErrorPage ¶ added in v0.2.14
func RenderInternalOAuthErrorPage(c *gin.Context, messageCode component.MessageCode)
func RenderNotFoundPage ¶ added in v0.2.14
func RenderNotFoundPage(c *gin.Context, messageCode component.MessageCode)
func RenderOAuthErrorPage ¶ added in v0.2.14
func RenderOAuthErrorPage(c *gin.Context, status int, messageCode component.MessageCode)
func ResetPassword ¶
func SiteThemeCSS ¶ added in v0.2.23
func ThemePreview ¶ added in v0.2.23
func TopicDetail ¶ added in v0.2.49
func UpdateModerationPostStatus ¶ added in v0.2.49
func UpdateModerationPostStatus(req component.BetterRequest[ModerationPostStatusReq]) component.Response
func UpdateModerationReportStatus ¶ added in v0.2.38
func UpdateModerationReportStatus(req component.BetterRequest[ModerationReportStatusReq]) component.Response
func UpdateModerationTopicStatus ¶ added in v0.2.49
func UpdateModerationTopicStatus(req component.BetterRequest[ModerationTopicStatusReq]) component.Response
func UserProfile ¶
Types ¶
type AnnouncementPayload ¶
type CategoryHeaderPayload ¶
type CategoryNavPayload ¶
type CategoryNavPayload struct {
}
type CategoryPageProps ¶
type CategoryPageProps struct {
Category CategoryHeaderPayload `json:"category"`
Sort string `json:"sort"`
Tabs []TabPayload `json:"tabs"`
Topics []TopicPayload `json:"topics"`
Pagination PaginationPayload `json:"pagination"`
}
type CreateReportReq ¶ added in v0.2.38
type DraftPayload ¶ added in v0.2.8
type DraftPayload struct {
ID uint64 `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
EditURL string `json:"editUrl"`
ReplyCount uint64 `json:"replyCount"`
ViewCount uint64 `json:"viewCount"`
ProcessStatus int8 `json:"processStatus"`
UpdatedAt string `json:"updatedAt"`
CreatedAt string `json:"createdAt"`
Categories []TopicCategoryPayload `json:"categories"`
}
type DraftsPageProps ¶ added in v0.2.8
type DraftsPageProps struct {
Total int64 `json:"total"`
Drafts []DraftPayload `json:"drafts"`
Pagination PaginationPayload `json:"pagination"`
}
type ErrorPageProps ¶
type ErrorPageProps struct {
Code string `json:"code"`
Title string `json:"title"`
MessageCode component.MessageCode `json:"messageCode,omitempty"`
Params component.MessageParams `json:"params,omitempty"`
}
type FooterPayload ¶
type FooterPayload struct {
}
type FriendLinkPayload ¶
type HomeProps ¶
type HomeProps struct {
Sort string `json:"sort"`
Tabs []TabPayload `json:"tabs"`
Topics []TopicPayload `json:"topics"`
Pagination PaginationPayload `json:"pagination"`
Announcement AnnouncementPayload `json:"announcement"`
}
type LayoutPayload ¶
type LayoutPayload struct {
Site SitePayload `json:"site"`
Viewer ViewerPayload `json:"viewer"`
Header []NavItemPayload `json:"header,omitempty"`
Sidebar SidebarPayload `json:"sidebar"`
Unread UnreadStatusPayload `json:"unread"`
Theme ThemePayload `json:"theme"`
}
type LinkGroupPayload ¶
type LinkGroupPayload struct {
Name string `json:"name"`
Emoji string `json:"emoji"`
Color string `json:"color"`
Links []FriendLinkPayload `json:"links"`
}
type LinksPageProps ¶
type LinksPageProps struct {
Groups []LinkGroupPayload `json:"groups"`
TotalCount int `json:"totalCount"`
}
type LoginPageProps ¶
type ManageHomeProps ¶ added in v0.2.8
type ManageHomeProps struct{}
type MessagesPageProps ¶
type MessagesPageProps struct {
Conversations []*vo.ChatItemVo `json:"conversations"`
SuggestedUsers []UserConnectionPayload `json:"suggestedUsers"`
}
type ModerationLogItem ¶ added in v0.2.36
type ModerationLogItem struct {
ID uint64 `json:"id"`
Action string `json:"action"`
Actor TopicAuthorPayload `json:"actor"`
Subject ModerationLogSubject `json:"subject"`
Categories []TopicCategoryPayload `json:"categories"`
MessageCode string `json:"messageCode"`
Params map[string]any `json:"params"`
CreatedAt string `json:"createdAt"`
}
type ModerationLogListReq ¶ added in v0.2.36
type ModerationLogListResponse ¶ added in v0.2.36
type ModerationLogListResponse struct {
Items []ModerationLogItem `json:"items"`
NextCursor uint64 `json:"nextCursor"`
HasNext bool `json:"hasNext"`
}
type ModerationLogSubject ¶ added in v0.2.36
type ModerationPageProps ¶ added in v0.2.36
type ModerationPageProps struct {
CategoryTabs []TabPayload `json:"categoryTabs"`
Topics []TopicPayload `json:"topics"`
Pagination PaginationPayload `json:"pagination"`
}
type ModerationPostStatusReq ¶ added in v0.2.49
type ModerationReportItem ¶ added in v0.2.38
type ModerationReportItem struct {
ID uint64 `json:"id"`
TargetType string `json:"targetType"`
TargetID uint64 `json:"targetId"`
TargetURL string `json:"targetUrl"`
Title string `json:"title"`
Excerpt string `json:"excerpt"`
Reason string `json:"reason"`
Note string `json:"note"`
Status string `json:"status"`
Resolution string `json:"resolution"`
Reporter TopicAuthorPayload `json:"reporter"`
Handler TopicAuthorPayload `json:"handler"`
Categories []TopicCategoryPayload `json:"categories"`
CreatedAt string `json:"createdAt"`
HandledAt string `json:"handledAt,omitempty"`
}
type ModerationReportListReq ¶ added in v0.2.38
type ModerationReportListResponse ¶ added in v0.2.38
type ModerationReportListResponse struct {
Items []ModerationReportItem `json:"items"`
NextCursor uint64 `json:"nextCursor"`
HasNext bool `json:"hasNext"`
}
type ModerationReportStatusReq ¶ added in v0.2.38
type ModerationTopicStatusReq ¶ added in v0.2.49
type NavItemPayload ¶
type NavItemPayload struct {
}
type NotificationPayload ¶
type NotificationPayload struct {
ID uint64 `json:"id"`
EventType string `json:"eventType"`
IsRead bool `json:"isRead"`
CreatedAt string `json:"createdAt"`
Title string `json:"title"`
Content string `json:"content"`
Actor TopicAuthorPayload `json:"actor"`
Topic *NotificationTopicPayload `json:"topic,omitempty"`
Payload eventNotification.NotificationPayload `json:"payload"`
}
func BuildNotificationPayload ¶ added in v0.2.12
func BuildNotificationPayload(notification *eventNotification.Entity) NotificationPayload
func BuildNotificationPayloads ¶ added in v0.2.49
func BuildNotificationPayloads(notifications []*eventNotification.Entity) []NotificationPayload
type NotificationTopicPayload ¶ added in v0.2.49
type NotificationsPageProps ¶
type NotificationsPageProps struct {
Total int64 `json:"total"`
UnreadCount int64 `json:"unreadCount"`
Notifications []NotificationPayload `json:"notifications"`
Pagination PaginationPayload `json:"pagination"`
}
type OpenGraphMeta ¶ added in v0.2.2
type OpenGraphMeta struct {
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Type string `json:"type,omitempty"`
URL string `json:"url,omitempty"`
SiteName string `json:"siteName,omitempty"`
Image string `json:"image,omitempty"`
PublishedTime string `json:"publishedTime,omitempty"`
ModifiedTime string `json:"modifiedTime,omitempty"`
Author string `json:"author,omitempty"`
Section string `json:"section,omitempty"`
Tags []string `json:"tags,omitempty"`
}
type PageComponent ¶ added in v0.2.59
type PageComponent string
const ( PageComponentHome PageComponent = "home.index" PageComponentTopic PageComponent = "topic.detail" PageComponentUser PageComponent = "user.profile" PageComponentCategory PageComponent = "category.index" PageComponentLinks PageComponent = "links.index" PageComponentSponsors PageComponent = "sponsors.index" PageComponentNotifications PageComponent = "notifications.index" PageComponentMessages PageComponent = "messages.index" PageComponentDrafts PageComponent = "drafts.index" PageComponentModeration PageComponent = "moderation.index" PageComponentSettings PageComponent = "settings.index" PageComponentThemePreview PageComponent = "theme.preview" PageComponentPublish PageComponent = "publish.index" PageComponentSearch PageComponent = "search.index" PageComponentLogin PageComponent = "auth.login" PageComponentResetPassword PageComponent = "auth.resetPassword" PageComponentError PageComponent = "error.index" PageComponentAdmin PageComponent = "admin.shell" )
type PageMeta ¶
type PageMeta struct {
Title string `json:"title"`
Description string `json:"description,omitempty"`
Canonical string `json:"canonical,omitempty"`
PrevURL string `json:"prevUrl,omitempty"`
NextURL string `json:"nextUrl,omitempty"`
Robots string `json:"robots,omitempty"`
OpenGraph *OpenGraphMeta `json:"openGraph,omitempty"`
Twitter *TwitterMeta `json:"twitter,omitempty"`
JSONLD any `json:"jsonLd,omitempty"`
}
type PagePayload ¶
type PagePayload struct {
Component PageComponent `json:"component"`
Props any `json:"props"`
Meta PageMeta `json:"meta"`
Layout LayoutPayload `json:"layout"`
URL string `json:"url"`
Version string `json:"version"`
}
type PaginationPayload ¶
type PostPayload ¶ added in v0.2.49
type PostPayload struct {
ID uint64 `json:"id"`
TopicID uint64 `json:"topicId"`
PostNo uint64 `json:"postNo"`
Content string `json:"content"`
RenderedContent string `json:"renderedContent"`
ProcessStatus int8 `json:"processStatus"`
IsHidden bool `json:"isHidden"`
CanModerate bool `json:"canModerate"`
Author TopicAuthorPayload `json:"author"`
CreatedAt string `json:"createdAt"`
ReplyToPostID uint64 `json:"replyToPostId,omitempty"`
ReplyToUserID uint64 `json:"replyToUserId,omitempty"`
ReplyToUsername string `json:"replyToUsername,omitempty"`
IsOwnPost bool `json:"isOwnPost"`
UpdatedAt string `json:"updatedAt"`
}
type PostWindowPayload ¶ added in v0.2.49
type PostWindowPayload struct {
Posts []PostPayload `json:"posts"`
ReplyTargets []ReplyTargetPayload `json:"replyTargets"`
AnchorPostID uint64 `json:"anchorPostId,omitempty"`
BeforePostNo uint64 `json:"beforePostNo,omitempty"`
AfterPostNo uint64 `json:"afterPostNo,omitempty"`
HasBefore bool `json:"hasBefore"`
HasAfter bool `json:"hasAfter"`
Total int64 `json:"total"`
MaxPostNo uint64 `json:"maxPostNo"`
}
type PostWindowReq ¶ added in v0.2.49
type PublishCategoryPayload ¶
type PublishPageProps ¶
type PublishPageProps struct {
TopicID uint64 `json:"topicId"`
IsEditing bool `json:"isEditing"`
Categories []PublishCategoryPayload `json:"categories"`
Topic PublishTopicPayload `json:"topic"`
}
type PublishTopicPayload ¶ added in v0.2.49
type ReplyTargetPayload ¶ added in v0.2.53
type ReplyTargetPayload struct {
ID uint64 `json:"id"`
PostNo uint64 `json:"postNo,omitempty"`
Author TopicAuthorPayload `json:"author"`
RenderedContent string `json:"renderedContent,omitempty"`
}
type ResetPasswordPageProps ¶
type ResetPasswordPageProps struct {
Token string `json:"token"`
}
type SearchPageProps ¶
type SearchPageProps struct {
Query string `json:"query"`
Topics []TopicPayload `json:"topics"`
Total int64 `json:"total"`
TotalPages int `json:"totalPages"`
Pagination PaginationPayload `json:"pagination"`
}
type SettingsPageProps ¶
type SettingsPageProps struct {
User *vo.UserDetailedVo `json:"user"`
Stats SettingsStatsPayload `json:"stats"`
Tabs []TabPayload `json:"tabs"`
}
type SettingsStatsPayload ¶
type SettingsStatsPayload struct {
TopicCount uint `json:"topicCount"`
ReplyCount uint `json:"replyCount"`
FollowerCount uint `json:"followerCount"`
FollowingCount uint `json:"followingCount"`
LikeReceivedCount uint `json:"likeReceivedCount"`
LikeGivenCount uint `json:"likeGivenCount"`
CollectionCount uint `json:"collectionCount"`
CreatedAt string `json:"createdAt"`
}
type SidebarGroupPayload ¶ added in v0.2.45
type SidebarGroupPayload struct {
Key string `json:"key"`
Title string `json:"title"`
I18nLabel string `json:"i18nLabel,omitempty"`
Items []NavItemPayload `json:"items"`
}
type SidebarPayload ¶
type SidebarPayload struct {
Main []NavItemPayload `json:"main,omitempty"`
Resources []NavItemPayload `json:"resources,omitempty"`
Groups []SidebarGroupPayload `json:"groups,omitempty"`
Categories []CategoryNavPayload `json:"categories"`
ActiveKey string `json:"activeKey"`
}
type SitePayload ¶
type SitePayload struct {
Name string `json:"name"`
Description string `json:"description"`
Logo string `json:"logo"`
Favicon string `json:"favicon"`
ExternalLinks string `json:"externalLinks,omitempty"`
BrandType string `json:"brandType"`
BrandText string `json:"brandText"`
BrandImage string `json:"brandImage"`
}
type SponsorPayload ¶
type SponsorSectionPayload ¶
type SponsorSectionPayload struct {
Key string `json:"key"`
Label string `json:"label"`
Tone string `json:"tone"`
Sponsors []SponsorPayload `json:"sponsors"`
}
type SponsorsContactPayload ¶ added in v0.2.2
type SponsorsContactPayload = pageConfig.SponsorsContact
type SponsorsPageIntroPayload ¶ added in v0.2.2
type SponsorsPageIntroPayload = pageConfig.SponsorsPageIntro
type SponsorsPageProps ¶
type SponsorsPageProps struct {
Sections []SponsorSectionPayload `json:"sections"`
TotalCount int `json:"totalCount"`
Content SponsorsPageIntroPayload `json:"content"`
Contact SponsorsContactPayload `json:"contact"`
Rules []SponsorsRulePayload `json:"rules"`
}
type SponsorsRulePayload ¶ added in v0.2.2
type SponsorsRulePayload = pageConfig.SponsorsRule
type TabPayload ¶
type ThemePayload ¶ added in v0.2.23
type ThemePreviewProps ¶ added in v0.2.23
type ThemePreviewProps struct {
Theme pageConfig.SiteThemeConfig `json:"theme"`
Defaults pageConfig.SiteThemeConfig `json:"defaults"`
}
type TopicAuthorPayload ¶
type TopicAuthorPayload struct {
ID uint64 `json:"id"`
Username string `json:"username"`
AvatarURL string `json:"avatarUrl"`
WornBadge *badgeservice.UserBadge `json:"wornBadge,omitempty"`
}
type TopicCategoryPayload ¶
type TopicDetailPayload ¶ added in v0.2.49
type TopicDetailPayload struct {
ID uint64 `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
FirstImageURL string `json:"firstImageUrl,omitempty"`
URL string `json:"url"`
TopicStatus int8 `json:"topicStatus"`
ProcessStatus int8 `json:"processStatus"`
Author TopicAuthorPayload `json:"author"`
Participants []TopicAuthorPayload `json:"participants"`
Categories []TopicCategoryPayload `json:"categories"`
ReplyCount uint64 `json:"replyCount"`
MaxPostNo uint64 `json:"maxPostNo"`
ViewCount uint64 `json:"viewCount"`
LikeCount uint64 `json:"likeCount"`
IsLiked bool `json:"isLiked"`
IsBookmarked bool `json:"isBookmarked"`
IsWatched bool `json:"isWatched"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
type TopicDetailProps ¶ added in v0.2.49
type TopicDetailProps struct {
Topic TopicDetailPayload `json:"topic"`
PostStream PostWindowPayload `json:"postStream"`
HotTopics []TopicPayload `json:"hotTopics"`
Permissions TopicPermissions `json:"permissions"`
}
type TopicPayload ¶
type TopicPayload struct {
ID uint64 `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
FirstImageURL string `json:"firstImageUrl,omitempty"`
URL string `json:"url"`
PinWeight int `json:"pinWeight"`
ProcessStatus int8 `json:"processStatus"`
Author TopicAuthorPayload `json:"author"`
Participants []TopicAuthorPayload `json:"participants"`
Categories []TopicCategoryPayload `json:"categories"`
ReplyCount uint64 `json:"replyCount"`
ViewCount uint64 `json:"viewCount"`
ActivityText string `json:"activityText"`
LastUpdateTime string `json:"lastUpdateTime"`
Unseen bool `json:"unseen,omitempty"`
}
type TopicPermissions ¶ added in v0.2.49
type TwitterMeta ¶ added in v0.2.2
type UnreadStatusPayload ¶ added in v0.2.2
type UserActivityPayload ¶
type UserConnectionPayload ¶
type UserLikePayload ¶ added in v0.2.44
type UserProfileProps ¶
type UserProfileProps struct {
User *vo.UserCard `json:"user"`
Section string `json:"section"`
ActivityTab string `json:"activityTab"`
Tabs []TabPayload `json:"tabs"`
ActivityTabs []TabPayload `json:"activityTabs"`
Pagination PaginationPayload `json:"pagination"`
Badges []badgeservice.UserBadge `json:"badges"`
Topics []TopicPayload `json:"topics"`
Activities []UserActivityPayload `json:"activities"`
Likes []UserLikePayload `json:"likes"`
Following []UserConnectionPayload `json:"following"`
Followers []UserConnectionPayload `json:"followers"`
IsOwnProfile bool `json:"isOwnProfile"`
CanMessage bool `json:"canMessage"`
CanFollow bool `json:"canFollow"`
MessageURL string `json:"messageUrl"`
SettingsURL string `json:"settingsUrl"`
}
type ViewerPayload ¶
type ViewerPayload struct {
ID uint64 `json:"id"`
Username string `json:"username"`
Email string `json:"email"`
AvatarURL string `json:"avatarUrl"`
IsAuthenticated bool `json:"isAuthenticated"`
CanAccessAdmin bool `json:"canAccessAdmin"`
IsModerator bool `json:"isModerator"`
RequiresEmailVerification bool `json:"requiresEmailVerification"`
AdminPermissions []uint64 `json:"adminPermissions"`
}
Click to show internal directories.
Click to hide internal directories.