routes

package
v0.0.0-...-553e66b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2021 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RenderTemplate = renderTemplate3

TODO: Rename renderTemplate to RenderTemplate instead of using this hack to avoid breaking things

Functions

func APIMe

func APIMe(w http.ResponseWriter, r *http.Request, u *c.User) c.RouteError

APIMe returns information about the current logged-in user TODO: Find some way to stop intermediaries from doing compression to avoid the BREACH attack TODO: Decouple site settings into a different API? I'd like to avoid having too many requests, if possible, maybe we can use a different name for this?

func AccountBlocked

func AccountBlocked(w http.ResponseWriter, r *http.Request, user *c.User, h *c.Header) c.RouteError

func AccountEdit

func AccountEdit(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header) c.RouteError

func AccountEditAvatarSubmit

func AccountEditAvatarSubmit(w http.ResponseWriter, r *http.Request, u *c.User) c.RouteError

func AccountEditEmail

func AccountEditEmail(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header) c.RouteError

func AccountEditEmailAddSubmit

func AccountEditEmailAddSubmit(w http.ResponseWriter, r *http.Request, u *c.User) c.RouteError

func AccountEditEmailRemoveSubmit

func AccountEditEmailRemoveSubmit(w http.ResponseWriter, r *http.Request, u *c.User) c.RouteError

func AccountEditEmailTokenSubmit

func AccountEditEmailTokenSubmit(w http.ResponseWriter, r *http.Request, user *c.User, token string) c.RouteError

TODO: Should we make this an AnonAction so someone can do this without being logged in?

func AccountEditMFA

func AccountEditMFA(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header) c.RouteError

func AccountEditMFADisableSubmit

func AccountEditMFADisableSubmit(w http.ResponseWriter, r *http.Request, u *c.User) c.RouteError

TODO: Implement this

func AccountEditMFASetup

func AccountEditMFASetup(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header) c.RouteError

If not setup, generate a string, otherwise give an option to disable mfa given the right code

func AccountEditMFASetupSubmit

func AccountEditMFASetupSubmit(w http.ResponseWriter, r *http.Request, u *c.User) c.RouteError

Form should bounce the random mfa secret back and the otp to be verified server-side to reduce the chances of a bug arising on the JS side which makes every code mismatch

func AccountEditPassword

func AccountEditPassword(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header) c.RouteError

edit_password

func AccountEditPasswordSubmit

func AccountEditPasswordSubmit(w http.ResponseWriter, r *http.Request, u *c.User) c.RouteError

TODO: Require re-authentication if the user hasn't logged in in a while

func AccountEditPrivacy

func AccountEditPrivacy(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header) c.RouteError

func AccountEditPrivacySubmit

func AccountEditPrivacySubmit(w http.ResponseWriter, r *http.Request, u *c.User) c.RouteError

func AccountEditRevokeAvatarSubmit

func AccountEditRevokeAvatarSubmit(w http.ResponseWriter, r *http.Request, u *c.User) c.RouteError

func AccountEditUsernameSubmit

func AccountEditUsernameSubmit(w http.ResponseWriter, r *http.Request, u *c.User) c.RouteError

func AccountLogin

func AccountLogin(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header) c.RouteError

func AccountLoginMFAVerify

func AccountLoginMFAVerify(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header) c.RouteError

func AccountLoginMFAVerifySubmit

func AccountLoginMFAVerifySubmit(w http.ResponseWriter, r *http.Request, u *c.User) c.RouteError

func AccountLoginSubmit

func AccountLoginSubmit(w http.ResponseWriter, r *http.Request, u *c.User) c.RouteError

TODO: Log failed attempted logins? TODO: Lock IPS out if they have too many failed attempts? TODO: Log unusual countries in comparison to the country a user usually logs in from? Alert the user about this?

func AccountLogins

func AccountLogins(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header) c.RouteError

func AccountLogout

func AccountLogout(w http.ResponseWriter, r *http.Request, u *c.User) c.RouteError

func AccountPasswordReset

func AccountPasswordReset(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header) c.RouteError

func AccountPasswordResetSubmit

func AccountPasswordResetSubmit(w http.ResponseWriter, r *http.Request, user *c.User) c.RouteError

TODO: Ratelimit this

func AccountPasswordResetToken

func AccountPasswordResetToken(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header) c.RouteError

func AccountPasswordResetTokenSubmit

func AccountPasswordResetTokenSubmit(w http.ResponseWriter, r *http.Request, u *c.User) c.RouteError

func AccountRegister

func AccountRegister(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header) c.RouteError

func AccountRegisterSubmit

func AccountRegisterSubmit(w http.ResponseWriter, r *http.Request, user *c.User) c.RouteError

func ActivateUser

func ActivateUser(w http.ResponseWriter, r *http.Request, u *c.User, suid string) c.RouteError

func AddAttachToReplySubmit

func AddAttachToReplySubmit(w http.ResponseWriter, r *http.Request, u *c.User, srid string) c.RouteError

TODO: Avoid uploading this again if the attachment already exists? They'll resolve to the same hash either way, but we could save on some IO / bandwidth here TODO: Enforce the max request limit on all of this topic's attachments TODO: Test this route

func AddAttachToTopicSubmit

func AddAttachToTopicSubmit(w http.ResponseWriter, r *http.Request, u *c.User, stid string) c.RouteError

TODO: Avoid uploading this again if the attachment already exists? They'll resolve to the same hash either way, but we could save on some IO / bandwidth here TODO: Enforce the max request limit on all of this topic's attachments TODO: Test this route

func Alerts

func Alerts(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header) c.RouteError

func AttachTopicActCommon

func AttachTopicActCommon(w http.ResponseWriter, r *http.Request, u *c.User, stid string) (t *c.Topic, ferr c.RouteError)

func BadRoute

func BadRoute()

func BanUserSubmit

func BanUserSubmit(w http.ResponseWriter, r *http.Request, u *c.User, suid string) c.RouteError

func ChangeTheme

func ChangeTheme(w http.ResponseWriter, r *http.Request, u *c.User) c.RouteError

TODO: Set the cookie domain

func Convo

func Convo(w http.ResponseWriter, r *http.Request, user *c.User, h *c.Header, scid string) c.RouteError

func Convos

func Convos(w http.ResponseWriter, r *http.Request, user *c.User, h *c.Header) c.RouteError

func ConvosCreate

func ConvosCreate(w http.ResponseWriter, r *http.Request, user *c.User, h *c.Header) c.RouteError

func ConvosCreateReplySubmit

func ConvosCreateReplySubmit(w http.ResponseWriter, r *http.Request, user *c.User, scid string) c.RouteError

func ConvosCreateSubmit

func ConvosCreateSubmit(w http.ResponseWriter, r *http.Request, user *c.User) c.RouteError

func ConvosDeleteReplySubmit

func ConvosDeleteReplySubmit(w http.ResponseWriter, r *http.Request, u *c.User, scpid string) c.RouteError

func ConvosEditReplySubmit

func ConvosEditReplySubmit(w http.ResponseWriter, r *http.Request, user *c.User, scpid string) c.RouteError

func CreateReplySubmit

func CreateReplySubmit(w http.ResponseWriter, r *http.Request, user *c.User) c.RouteError

func CreateTopic

func CreateTopic(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header, sfid string) c.RouteError

? - Should we add a new permission or permission zone (like per-forum permissions) specifically for profile comment creation ? - Should we allow banned users to make reports? How should we handle report abuse? TODO: Add a permission to stop certain users from using custom avatars ? - Log username changes and put restrictions on this? TODO: Test this TODO: Revamp this route

func CreateTopicSubmit

func CreateTopicSubmit(w http.ResponseWriter, r *http.Request, u *c.User) c.RouteError

func CustomPage

func CustomPage(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header, name string) c.RouteError

func DeletePostsSubmit

func DeletePostsSubmit(w http.ResponseWriter, r *http.Request, u *c.User, suid string) c.RouteError

func DeleteTopicSubmit

func DeleteTopicSubmit(w http.ResponseWriter, r *http.Request, user *c.User) c.RouteError

TODO: Add support for soft-deletion and add a permission for hard delete in addition to the usual TODO: Disable stat updates in posts handled by plugin_guilds

func DynamicRoute

func DynamicRoute()

Temporary stubs for view tracking

func EditTopicSubmit

func EditTopicSubmit(w http.ResponseWriter, r *http.Request, u *c.User, stid string) c.RouteError

TODO: Update the stats after edits so that we don't under or over decrement stats during deletes TODO: Disable stat updates in posts handled by plugin_guilds

func Error

func Error()

TODO: Temporary stub for handling route group errors

func Favicon

func Favicon()

func FootHeaders

func FootHeaders(w http.ResponseWriter, h *c.Header)

func ForumList

func ForumList(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header) c.RouteError

func HTTPSRedirect

func HTTPSRedirect()

Real implementation is in router_gen/main.go, this is just a stub to map the analytics onto

func IPSearch

func IPSearch(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header) c.RouteError

func LevelList

func LevelList(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header) c.RouteError

func LikeTopicSubmit

func LikeTopicSubmit(w http.ResponseWriter, r *http.Request, u *c.User, stid string) c.RouteError

TODO: Refactor this

func LockTopicSubmit

func LockTopicSubmit(w http.ResponseWriter, r *http.Request, u *c.User) c.RouteError

func MoveTopicSubmit

func MoveTopicSubmit(w http.ResponseWriter, r *http.Request, u *c.User, sfid string) c.RouteError

! JS only route TODO: Figure a way to get this route to work without JS

func OpenSearchXml

func OpenSearchXml(w http.ResponseWriter, r *http.Request) c.RouteError

func Overview

func Overview(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header) c.RouteError

func ParseSEOURL

func ParseSEOURL(urlBit string) (slug string, id int, err error)

func PollResults

func PollResults(w http.ResponseWriter, r *http.Request, u *c.User, sPollID string) c.RouteError

func PollVote

func PollVote(w http.ResponseWriter, r *http.Request, u *c.User, sPollID string) c.RouteError

func ProfileReplyCreateSubmit

func ProfileReplyCreateSubmit(w http.ResponseWriter, r *http.Request, u *c.User) c.RouteError

func ProfileReplyDeleteSubmit

func ProfileReplyDeleteSubmit(w http.ResponseWriter, r *http.Request, u *c.User, srid string) c.RouteError

func ProfileReplyEditSubmit

func ProfileReplyEditSubmit(w http.ResponseWriter, r *http.Request, u *c.User, srid string) c.RouteError

func RelationsBlockCreate

func RelationsBlockCreate(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header, spid string) c.RouteError

func RelationsBlockCreateSubmit

func RelationsBlockCreateSubmit(w http.ResponseWriter, r *http.Request, u *c.User, spid string) c.RouteError

func RelationsBlockRemove

func RelationsBlockRemove(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header, spid string) c.RouteError

func RelationsBlockRemoveSubmit

func RelationsBlockRemoveSubmit(w http.ResponseWriter, r *http.Request, u *c.User, spid string) c.RouteError

func RemoveAttachFromReplySubmit

func RemoveAttachFromReplySubmit(w http.ResponseWriter, r *http.Request, u *c.User, srid string) c.RouteError

TODO: Reduce the amount of duplication between this and RemoveAttachFromTopicSubmit

func RemoveAttachFromTopicSubmit

func RemoveAttachFromTopicSubmit(w http.ResponseWriter, r *http.Request, u *c.User, stid string) c.RouteError

func ReplyActPre

func ReplyActPre(w http.ResponseWriter, r *http.Request, u *c.User, srid string, js bool) (rep *c.Reply, t *c.Topic, l *c.HeaderLite, ferr c.RouteError)

func ReplyDeleteSubmit

func ReplyDeleteSubmit(w http.ResponseWriter, r *http.Request, u *c.User, srid string) c.RouteError

TODO: Refactor this TODO: Disable stat updates in posts handled by plugin_guilds

func ReplyEditSubmit

func ReplyEditSubmit(w http.ResponseWriter, r *http.Request, u *c.User, srid string) c.RouteError

TODO: Disable stat updates in posts handled by plugin_guilds TODO: Update the stats after edits so that we don't under or over decrement stats during deletes

func ReplyLikeSubmit

func ReplyLikeSubmit(w http.ResponseWriter, r *http.Request, u *c.User, srid string) c.RouteError

func ReplyUnlikeSubmit

func ReplyUnlikeSubmit(w http.ResponseWriter, r *http.Request, u *c.User, srid string) c.RouteError

func ReportSubmit

func ReportSubmit(w http.ResponseWriter, r *http.Request, user *c.User, sItemID string) c.RouteError

func RobotsTxt

func RobotsTxt(w http.ResponseWriter, r *http.Request) c.RouteError

TODO: Make this a static file somehow? Is it possible for us to put this file somewhere else? TODO: Add an API so that plugins can register disallowed areas. E.g. /guilds/join for plugin_guilds

func ShowAttachment

func ShowAttachment(w http.ResponseWriter, r *http.Request, u *c.User, filename string) c.RouteError

func SitemapForums

func SitemapForums(w http.ResponseWriter, r *http.Request) c.RouteError

func SitemapTopic

func SitemapTopic(w http.ResponseWriter, r *http.Request, page int) c.RouteError

func SitemapTopics

func SitemapTopics(w http.ResponseWriter, r *http.Request) c.RouteError

TODO: Add a global ratelimit. 10 50MB files (smaller if compressed better) per minute? ? We might have problems with banned users, if they have fewer ViewTopic permissions than guests as they'll be able to see this list. Then again, a banned user could just logout to see it

func SitemapUsers

func SitemapUsers(w http.ResponseWriter, r *http.Request) c.RouteError

func SitemapXml

func SitemapXml(w http.ResponseWriter, r *http.Request) c.RouteError

TODO: Keep track of when a sitemap was last modifed and add a lastmod element for it

func StaticFile

func StaticFile(w http.ResponseWriter, r *http.Request)

GET functions

func StickTopicSubmit

func StickTopicSubmit(w http.ResponseWriter, r *http.Request, u *c.User, stid string) c.RouteError

func TopicList

func TopicList(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header) c.RouteError

func TopicListCommon

func TopicListCommon(w http.ResponseWriter, r *http.Request, user *c.User, h *c.Header, torder string, tsorder int) c.RouteError

TODO: Implement search

func TopicListMostViewed

func TopicListMostViewed(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header) c.RouteError

func TopicListWeekViews

func TopicListWeekViews(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header) c.RouteError

func UnbanUser

func UnbanUser(w http.ResponseWriter, r *http.Request, u *c.User, suid string) c.RouteError

func UnlikeTopicSubmit

func UnlikeTopicSubmit(w http.ResponseWriter, r *http.Request, u *c.User, stid string) c.RouteError

func UnlockTopicSubmit

func UnlockTopicSubmit(w http.ResponseWriter, r *http.Request, u *c.User, stid string) c.RouteError

func UnstickTopicSubmit

func UnstickTopicSubmit(w http.ResponseWriter, r *http.Request, u *c.User, stid string) c.RouteError

func UploadedFile

func UploadedFile()

func ViewForum

func ViewForum(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header, sfid string) c.RouteError

TODO: Retire this in favour of an alias for /topics/?

func ViewProfile

func ViewProfile(w http.ResponseWriter, r *http.Request, user *c.User, h *c.Header) c.RouteError

TODO: Remove the View part of the name?

func ViewTopic

func ViewTopic(w http.ResponseWriter, r *http.Request, user *c.User, h *c.Header, urlBit string) c.RouteError

Types

type FuzzyRoute

type FuzzyRoute struct {
	Path   string
	Handle func(http.ResponseWriter, *http.Request, int) c.RouteError
}

type JsonMe

type JsonMe struct {
	User *c.MeUser
	Site MeSite
}

type JsonReply

type JsonReply struct {
	Content string
}

type MeSite

type MeSite struct {
	MaxReqSize   int
	StaticPrefix string
}

We don't want to expose too much information about the site, so we'll make this a small subset of c.site

type ProfileStmts

type ProfileStmts struct {
	// contains filtered or unexported fields
}

type ReplyStmts

type ReplyStmts struct {
	// contains filtered or unexported fields
}

type TopicStmts

type TopicStmts struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL