Documentation ¶
Index ¶
- Constants
- Variables
- func AddFavoriteBoard(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func AddFavoriteBoardWrapper(c *gin.Context)
- func AddFavoriteFolder(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func AddFavoriteFolderWrapper(c *gin.Context)
- func AddFavoriteLine(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func AddFavoriteLineWrapper(c *gin.Context)
- func AllHTMLWrapper(c *gin.Context)
- func ArticleLockKey(boardID bbs.BBoardID, articleID bbs.ArticleID) (key string)
- func AttemptChangeEmail(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func AttemptChangeEmailWrapper(c *gin.Context)
- func AttemptRegisterUser(remoteAddr string, params interface{}, c *gin.Context) (result interface{}, statusCode int, err error)
- func AttemptRegisterUserWrapper(c *gin.Context)
- func AttemptSetIDEmail(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func AttemptSetIDEmailWrapper(c *gin.Context)
- func ChangeEmail(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func ChangeEmailWrapper(c *gin.Context)
- func ChangePasswd(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func ChangePasswdWrapper(c *gin.Context)
- func CheckExistsUser(remoteAddr string, params interface{}, c *gin.Context) (result interface{}, statusCode int, err error)
- func CheckExistsUserWrapper(c *gin.Context)
- func CheckUserArticlePermDeletable(userID bbs.UUserID, boardID bbs.BBoardID, articleID bbs.ArticleID, ...) (err error)
- func CheckUserArticlePermEditable(userID bbs.UUserID, boardID bbs.BBoardID, articleID bbs.ArticleID, ...) (err error)
- func CheckUserArticlePermReadable(userID bbs.UUserID, boardID bbs.BBoardID, articleID bbs.ArticleID, ...) (err error)
- func CheckUserArticlesPermDeletable(userID bbs.UUserID, boardID bbs.BBoardID, articleIDs []bbs.ArticleID, ...) (articlePermMap map[bbs.ArticleID]error, err error)
- func CheckUserArticlesPermEditable(userID bbs.UUserID, boardID bbs.BBoardID, articleIDs []bbs.ArticleID, ...) (articlePermMap map[bbs.ArticleID]error, err error)
- func CheckUserArticlesPermEditableDeletable(userID bbs.UUserID, boardID bbs.BBoardID, articleIDs []bbs.ArticleID, ...) (articlePermEditableMap map[bbs.ArticleID]error, ...)
- func CheckUserBoardPermCreatable(userID bbs.UUserID, c *gin.Context) (err error)
- func CheckUserBoardPermEditable(userID bbs.UUserID, boardID bbs.BBoardID, c *gin.Context) (err error)
- func CheckUserBoardPermPostable(userID bbs.UUserID, boardID bbs.BBoardID, c *gin.Context) (err error)
- func CreateArticle(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func CreateArticleWrapper(c *gin.Context)
- func CreateBoard(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func CreateBoardWrapper(c *gin.Context)
- func CreateComment(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func CreateCommentWrapper(c *gin.Context)
- func CreateRank(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func CreateRankWrapper(c *gin.Context)
- func CrossPost(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func CrossPostWrapper(c *gin.Context)
- func DeleteArticles(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func DeleteArticlesWrapper(c *gin.Context)
- func DeleteComments(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func DeleteCommentsWrapper(c *gin.Context)
- func DeleteFavorite(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func DeleteFavoriteWrapper(c *gin.Context)
- func DeserializeArticlesAndUpdateDB(articleSummaries_b []*bbs.ArticleSummary, updateNanoTS types.NanoTS) (articleSummaries []*schema.ArticleSummaryWithRegex, err error)
- func DeserializeBoardDetailsAndUpdateDB(boardDetails_b []*bbs.BoardDetail, updateNanoTS types.NanoTS) (boardDetails []*schema.BoardDetail, err error)
- func DeserializeBoardsAndUpdateDB(boardSummaries_b []*bbs.BoardSummary, updateNanoTS types.NanoTS) (boardSummaries []*schema.BoardSummary, err error)
- func DeserializePBArticlesAndUpdateDB(boardID bbs.BBoardID, articleSummaries_b []*boardd.Post, ...) (articleSummaries []*schema.ArticleSummaryWithRegex, err error)
- func DeserializePBBoardsAndUpdateDB(boardSummaries_b []*boardd.Board, updateNanoTS types.NanoTS) (boardSummaries []*schema.BoardSummary, err error)
- func DeserializePBManArticlesAndUpdateDB(boardID bbs.BBoardID, levelIdx types.ManArticleID, entries []*mand.Entry, ...) (articleSummaries []*schema.ManArticleSummary, err error)
- func EditArticleDetail(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func EditArticleDetailWrapper(c *gin.Context)
- func ErrBoardCooldown(diffNanoTS types.NanoTS) error
- func ErrBoardPosttime(diffNanoTS types.NanoTS) error
- func ErrFloodReject(diffNanoTS types.NanoTS) error
- func Form(theFunc APIFunc, params interface{}, c *gin.Context)
- func FormJSON(theFunc APIFunc, params interface{}, c *gin.Context)
- func FormLogout(theFunc APIFunc, params interface{}, c *gin.Context)
- func GetArticleBlocks(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func GetArticleBlocksWrapper(c *gin.Context)
- func GetArticleDetail(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func GetArticleDetailWrapper(c *gin.Context)
- func GetBoardDetail(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func GetBoardDetailWrapper(c *gin.Context)
- func GetBoardSummary(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func GetBoardSummaryWrapper(c *gin.Context)
- func GetManArticleBlocks(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func GetManArticleBlocksWrapper(c *gin.Context)
- func GetManArticleDetail(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func GetManArticleDetailWrapper(c *gin.Context)
- func GetUserID(remoteAddr string, userID bbs.UUserID, params interface{}, c *gin.Context) (result interface{}, statusCode int, err error)
- func GetUserIDWrapper(c *gin.Context)
- func GetUserInfo(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func GetUserInfoWrapper(c *gin.Context)
- func GetUserVisitCount(remoteAddr string, params interface{}, c *gin.Context) (result interface{}, statusCode int, err error)
- func GetUserVisitCountWrapper(c *gin.Context)
- func GetVersion(remoteAddr string, params interface{}, c *gin.Context) (result interface{}, statusCode int, err error)
- func GetVersionWrapper(c *gin.Context)
- func Index(remoteAddr string, params interface{}, c *gin.Context) (result interface{}, statusCode int, err error)
- func IndexHTMLWrapper(c *gin.Context)
- func IndexWrapper(c *gin.Context)
- func JSON(theFunc APIFunc, params interface{}, c *gin.Context)
- func LoadArticleComments(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func LoadArticleCommentsWrapper(c *gin.Context)
- func LoadAutoCompleteBoards(remoteAddr string, userID bbs.UUserID, params interface{}, c *gin.Context) (result interface{}, statusCode int, err error)
- func LoadAutoCompleteBoardsWrapper(c *gin.Context)
- func LoadBottomArticles(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func LoadBottomArticlesWrapper(c *gin.Context)
- func LoadClassBoards(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func LoadClassBoardsWrapper(c *gin.Context)
- func LoadFavoriteBoards(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func LoadFavoriteBoardsWrapper(c *gin.Context)
- func LoadGeneralArticles(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func LoadGeneralArticlesByKeyword(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func LoadGeneralArticlesWrapper(c *gin.Context)
- func LoadGeneralBoards(remoteAddr string, userID bbs.UUserID, params interface{}, c *gin.Context) (result interface{}, statusCode int, err error)
- func LoadGeneralBoardsByClass(remoteAddr string, userID bbs.UUserID, params interface{}, c *gin.Context) (result interface{}, statusCode int, err error)
- func LoadGeneralBoardsByClassWrapper(c *gin.Context)
- func LoadGeneralBoardsWrapper(c *gin.Context)
- func LoadManArticles(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func LoadManArticlesWrapper(c *gin.Context)
- func LoadPopularArticles(remoteAddr string, userID bbs.UUserID, params interface{}, c *gin.Context) (result interface{}, statusCode int, err error)
- func LoadPopularArticlesWrapper(c *gin.Context)
- func LoadPopularBoards(remoteAddr string, userID bbs.UUserID, params interface{}, c *gin.Context) (result interface{}, statusCode int, err error)
- func LoadPopularBoardsWrapper(c *gin.Context)
- func LoadUserArticles(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func LoadUserArticlesWrapper(c *gin.Context)
- func LoadUserComments(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func LoadUserCommentsWrapper(c *gin.Context)
- func Login(remoteAddr string, params interface{}, c *gin.Context) (result interface{}, statusCode int, err error)
- func LoginHTMLWrapper(c *gin.Context)
- func LoginRequiredJSON(theFunc LoginRequiredAPIFunc, params interface{}, c *gin.Context)
- func LoginRequiredPathJSON(theFunc LoginRequiredPathAPIFunc, params interface{}, path interface{}, ...)
- func LoginRequiredPathQuery(theFunc LoginRequiredPathAPIFunc, params interface{}, path interface{}, ...)
- func LoginRequiredQuery(theFunc LoginRequiredAPIFunc, params interface{}, c *gin.Context)
- func LoginWrapper(c *gin.Context)
- func Logout(remoteAddr string, params interface{}, c *gin.Context) (result interface{}, statusCode int, err error)
- func LogoutWrapper(c *gin.Context)
- func ManArticleLockKey(boardID bbs.BBoardID, articleID types.ManArticleID) (key string)
- func OptionsWrapper(c *gin.Context)
- func Query(theFunc APIFunc, params interface{}, c *gin.Context)
- func RedirectPathQuery(theFunc RedirectPathAPIFunc, params interface{}, path interface{}, ...)
- func Refresh(remoteAddr string, params interface{}, c *gin.Context) (result interface{}, statusCode int, err error)
- func RefreshWrapper(c *gin.Context)
- func RegisterClient(remoteAddr string, userID bbs.UUserID, params interface{}, c *gin.Context) (result interface{}, statusCode int, err error)
- func RegisterClientWrapper(c *gin.Context)
- func RegisterHTMLWrapper(c *gin.Context)
- func RegisterUser(remoteAddr string, params interface{}, c *gin.Context) (result interface{}, statusCode int, err error)
- func RegisterUserWrapper(c *gin.Context)
- func ReplyComments(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func ReplyCommentsWrapper(c *gin.Context)
- func SetIDEmail(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, ...) (result interface{}, statusCode int, err error)
- func SetIDEmailWrapper(c *gin.Context)
- func SetIsTest()
- func TryGetArticleContentInfo(userID bbs.UUserID, bboardID bbs.BBoardID, articleID bbs.ArticleID, ...) (content [][]*types.Rune, contentPrefix [][]*types.Rune, contentMD5 string, ...)
- func TryGetManArticleContentInfo(userID bbs.UUserID, bboardID bbs.BBoardID, articleID types.ManArticleID, ...) (content [][]*types.Rune, contentMD5 string, ...)
- func UnsetIsTest()
- func UpdateArticleContentInfo(boardID bbs.BBoardID, articleID bbs.ArticleID, content [][]*types.Rune, ...) (err error)
- func UpdateManArticleContentInfo(boardID bbs.BBoardID, articleID types.ManArticleID, content [][]*types.Rune, ...) (err error)
- func UserAttemptChangeEmailHTMLWrapper(c *gin.Context)
- func UserAttemptSetIDEmailHTMLWrapper(c *gin.Context)
- func UserChangeEmailHTMLWrapper(c *gin.Context)
- func UserChangePasswdHTMLWrapper(c *gin.Context)
- func UserHTMLWrapper(c *gin.Context)
- func UserSetIDEmailHTMLWrapper(c *gin.Context)
- type APIFunc
- type AddFavoriteBoardParams
- type AddFavoriteBoardPath
- type AddFavoriteFolderParams
- type AddFavoriteFolderPath
- type AddFavoriteLineParams
- type AddFavoriteLinePath
- type AddFavoriteResult
- type AttemptChangeEmailParams
- type AttemptChangeEmailPath
- type AttemptChangeEmailResult
- type AttemptRegisterUserParams
- type AttemptRegisterUserResult
- type AttemptSetIDEmailParams
- type AttemptSetIDEmailPath
- type AttemptSetIDEmailResult
- type ChangeEmailParams
- type ChangeEmailPath
- type ChangeEmailResult
- type ChangePasswdParams
- type ChangePasswdPath
- type ChangePasswdResult
- type CheckExistsUserParams
- type CheckExistsUserResult
- type ClientInfo
- type CooldownLimit
- type CreateArticleParams
- type CreateArticlePath
- type CreateArticleResult
- type CreateBoardParams
- type CreateBoardPath
- type CreateBoardResult
- type CreateCommentParams
- type CreateCommentPath
- type CreateCommentResult
- type CreateRankParams
- type CreateRankPath
- type CreateRankResult
- type CrossPostParams
- type CrossPostPath
- type CrossPostResult
- type DeleteArticlesParams
- type DeleteArticlesPath
- type DeleteArticlesResult
- type DeleteCommentsParams
- type DeleteCommentsPath
- type DeleteCommentsResult
- type DeleteFavoriteParams
- type DeleteFavoritePath
- type DeleteFavoriteResult
- type EditArticleParams
- type EditArticlePath
- type EditArticleResult
- type GetArticleBlocksParams
- type GetArticleBlocksPath
- type GetArticleBlocksResult
- type GetArticleDetailParams
- type GetArticleDetailPath
- type GetArticleDetailResult
- type GetBoardDetailParams
- type GetBoardDetailPath
- type GetBoardDetailResult
- type GetBoardSummaryParams
- type GetBoardSummaryPath
- type GetBoardSummaryResult
- type GetManArticleBlocksParams
- type GetManArticleBlocksPath
- type GetManArticleBlocksResult
- type GetManArticleDetailPath
- type GetManArticleDetailResult
- type GetUserIDResult
- type GetUserInfoParams
- type GetUserInfoPath
- type GetUserInfoResult
- type GetUserVisitCountResult
- type GetVersionResult
- type HTMLPath
- type IndexParams
- type IndexResult
- type LoadArticleCommentsParams
- type LoadArticleCommentsPath
- type LoadArticleCommentsResult
- type LoadAutoCompleteBoardsParams
- type LoadBottomArticlesPath
- type LoadBottomArticlesResult
- type LoadClassBoardsParams
- type LoadClassBoardsPath
- type LoadClassBoardsResult
- type LoadFavoriteBoardsParams
- type LoadFavoriteBoardsPath
- type LoadFavoriteBoardsResult
- type LoadGeneralArticlesParams
- type LoadGeneralArticlesPath
- type LoadGeneralArticlesResult
- type LoadGeneralBoardsParams
- type LoadGeneralBoardsResult
- type LoadManArticlesParams
- type LoadManArticlesPath
- type LoadManArticlesResult
- type LoadPopularArticlesParams
- type LoadPopularArticlesResult
- type LoadPopularBoardsResult
- type LoadUserArticlesParams
- type LoadUserArticlesPath
- type LoadUserArticlesResult
- type LoadUserCommentsParams
- type LoadUserCommentsPath
- type LoadUserCommentsResult
- type LoginLog
- type LoginParams
- type LoginRequiredAPIFunc
- type LoginRequiredPathAPIFunc
- type LoginResult
- type RedirectPathAPIFunc
- type RefreshParams
- type RefreshResult
- type RegisterClientParams
- type RegisterClientResult
- type RegisterUserParams
- type RegisterUserResult
- type ReplyCommentsParams
- type ReplyCommentsPath
- type ReplyCommentsResult
- type SetIDEmailParams
- type SetIDEmailPath
- type SetIDEmailResult
- type UserBoardPermReadable
Constants ¶
const ( DEFAULT_MAX_ARTICLE_BLOCK_LIST = 1 DEFAULT_MAX_LIST = 200 DEFAULT_DESCENDING = true DEFAULT_ASCENDING = true ARTICLE_LOCK_TS = 10 ARTICLE_LOCK_TS_DURATION = time.Duration(ARTICLE_LOCK_TS) * time.Second ARTICLE_LOCK_NANO_TS = types.NanoTS(ARTICLE_LOCK_TS) * types.TS_TO_NANO_TS HTML_CACHE_CONTROL_TS = 3600 JS_CACHE_CONTROL_TS = 86400 * 365 OFFSET_MTIME_NANO_TS = 1000000000 // 1 second )
const ( ROOT_HTML_R = "/" INDEX_HTML_R = "/index.html" )
const ADD_FAVORITE_BOARD_R = "/user/:user_id/favorites/addboard"
const ADD_FAVORITE_FOLDER_R = "/user/:user_id/favorites/addfolder"
const ADD_FAVORITE_LINE_R = "/user/:user_id/favorites/addline"
const ARTICLES_HTML_R = "/board/:bid/articles"
const ARTICLE_HTML_R = "/board/:bid/article/:aid"
const ATTEMPT_CHANGE_EMAIL_R = "/user/:user_id/attemptchangeemail"
const ATTEMPT_REGISTER_USER_R = "/account/attemptregister"
const ATTEMPT_SET_ID_EMAIL_R = "/user/:user_id/attemptsetidemail"
const BOARDS_FAVORITES_HTML_R = "/user/:user_id/favorites"
const BOARDS_HTML_R = "/boards"
const BOARDS_POPULAR_HTML_R = "/boards/popular"
const CHANGE_EMAIL_R = "/user/:user_id/changeemail"
const CHANGE_PASSWD_R = "/user/:user_id/updatepasswd" //nolint // passwd as route
const CHECK_EXISTS_USER_R = "/account/existsuser"
const CLS_BOARDS_HTML_R = "/cls/:cls_id"
const CREATE_ARTICLE_HTML_R = "/board/:bid/post"
const CREATE_ARTICLE_R = "/board/:bid/article"
const CREATE_BOARD_R = "/class/:cls/board"
const CREATE_COMMENT_R = "/board/:bid/article/:aid/comment"
const CREATE_RANK_R = "/board/:bid/article/:aid/rank"
const CROSS_POST_R = "/board/:bid/article/:aid/crosspost"
const (
DEFAULT_FAV_TITLE = "新的目錄"
)
const DELETE_ARTICLES_R = "/board/:bid/deletearticles"
const DELETE_COMMENTS_R = "/board/:bid/article/:aid/deletecomments"
const DELETE_FAVORITE_R = "/user/:user_id/favorites/delete"
const EDIT_ARTICLE_R = "/board/:bid/article/:aid/edit"
const GET_ARTICLE_BLOCKS_R = "/board/:bid/articleblocks/:aid"
const GET_ARTICLE_R = "/board/:bid/article/:aid"
const GET_BOARD_DETAIL_R = "/board/:bid"
const GET_BOARD_SUMMARY_R = "/board/:bid/summary"
const GET_MAN_ARTICLE_BLOCKS_R = "/board/:bid/manualblocks/*aid"
const GET_MAN_ARTICLE_R = "/board/:bid/manual/*aid"
const GET_USER_ID_R = "/userid"
const GET_USER_INFO_R = "/user/:user_id"
const GET_USER_VISIT_COUNT_R = "/uservisitcount"
const GET_VERSION_R = "/version"
const INDEX_R = "/"
const LOAD_ARTICLE_COMMENTS_R = "/board/:bid/article/:aid/comments"
const LOAD_AUTO_COMPLETE_BOARDS_R = "/boards/autocomplete"
const LOAD_BOTTOM_ARTICLES_R = "/board/:bid/articles/bottom"
const LOAD_CLASS_BOARDS_R = "/cls/:clsid"
const LOAD_FAVORITE_BOARDS_R = "/user/:user_id/favorites"
const LOAD_GENERAL_ARTICLES_R = "/board/:bid/articles"
const LOAD_GENERAL_BOARDS_BY_CLASS_R = "/boards/byclass"
const LOAD_GENERAL_BOARDS_R = "/boards"
const LOAD_MAN_ARTICLES_R = "/board/:bid/manuals"
const LOAD_POPULAR_ARTICLES_R = "/articles/popular"
const LOAD_POPULAR_BOARDS_R = "/boards/popular"
const LOAD_USER_ARTICLES_R = "/user/:user_id/articles"
const LOAD_USER_COMMENTS_R = "/user/:user_id/comments"
const LOGIN_HTML_R = "/login"
const LOGIN_R = "/account/login"
const LOGOUT_R = "/account/logout"
const (
MAX_USER_FAVORITES_BUF_SIZE = 65535
)
const REFRESH_R = "/account/refresh"
const REGISTER_CLIENT_R = "/client/register"
const REGISTER_HTML_R = "/register"
const REGISTER_USER_R = "/account/register"
const REPLY_COMMENTS_R = "/board/:bid/article/:aid/replycomments"
const SET_ID_EMAIL_R = "/user/:user_id/setidemail"
const USER_ATTEMPT_CHANGE_EMAIL_HTML_R = "/user/:user_id/attemptchangeemail"
const USER_ATTEMPT_SET_ID_EMAIL_HTML_R = "/user/:user_id/attemptsetidemail"
const USER_CHANGE_EMAIL_HTML_R = "/user/:user_id/changeemail"
const USER_CHANGE_PASSWD_HTML_R = "/user/:user_id/resetpassword" //nolint // passwd as route
const USER_HTML_R = "/user/:user_id"
const USER_SET_ID_EMAIL_HTML_R = "/user/:user_id/setidemail"
Variables ¶
var ( GET_ARTICLE_CONTENT_INFO_TOO_SOON_NANO_TS = ARTICLE_LOCK_NANO_TS + types.NanoTS(1)*types.TS_TO_NANO_TS // 10 + 1 seconds. MIME_TYPE_MAP = map[string]string{ ".js": "text/javascript", ".html": "text/html", ".map": "application/json", } )
var ( ErrInvalidRemoteAddr = errors.New("invalid remote addr") ErrInvalidParams = errors.New("invalid params") ErrLoginFailed = errors.New("login failed") ErrNotImplemented = errors.New("not implemented") ErrInvalidPath = errors.New("invalid path") ErrInvalidToken = errors.New("invalid token") ErrInvalidOrigin = errors.New("invalid origin") ErrInvalidBackendStatusCode = errors.New("invalid backend status code") ErrNoUser = errors.New("no user") ErrNoBoard = errors.New("no board") ErrNoArticle = errors.New("no article") ErrNoUserBoard = errors.New("no user board") ErrAlreadyDeleted = errors.New("already deleted") ErrFileNotFound = errors.New("file not found") ErrInvalidUser = errors.New("invalid user") ErrInvalidClient = errors.New("invalid client") ErrAlreadyExists = errors.New("already exists") ErrInvalidFav = errors.New("invalid fav") ErrNotFriend = errors.New("not friend") ErrBoardBlocked = errors.New("board blocked") ErrBoardReported = errors.New("board reported") ErrBoardBucket = errors.New("board bucket") ErrPermBoardCreatePermission = errors.New("no board create permission") ErrPermBoardReadHidden = errors.New("hidden board") ErrPermBoardReadBlocked = errors.New("blocked board") ErrPermBoardReadReported = errors.New("reported board") ErrPermBoardReadNotOver18 = errors.New("not over18") ErrPermBoardReadPermission = errors.New("no board read permission") ErrPermPostReadOnly = errors.New("read only") ErrPermPostBannedByBoard = errors.New("banned by board") ErrPermBoardPostPost = errors.New("no user post permission") ErrPermBoardPostRestricted = errors.New("only board friends") ErrPermBoardPostViolateLaw = errors.New("violate law") ErrPermBoardPostPermission = errors.New("no board post permission") ErrPermBoardPostLoginDays = errors.New("invalid login days") ErrPermBoardPostPostLimit = errors.New("reached post limit") ErrPermBoardEditPermission = errors.New("no board edit permission") )
var COOLDOWN_LIMIT = []*CooldownLimit{
{NUser: 4000, Posttime: 1},
{NUser: 2000, Posttime: 2},
{NUser: 1000, Posttime: 3},
{NUser: 0, Posttime: 10},
}
var (
IsTest = false
)
Functions ¶
func AddFavoriteBoard ¶
func AddFavoriteBoardWrapper ¶
func AddFavoriteFolder ¶
func AddFavoriteLine ¶
func AddFavoriteLineWrapper ¶
func AllHTMLWrapper ¶
func ArticleLockKey ¶
func AttemptChangeEmail ¶
func AttemptRegisterUser ¶
func AttemptSetIDEmail ¶
func ChangeEmail ¶
func ChangeEmailWrapper ¶
func ChangePasswd ¶
func ChangePasswdWrapper ¶
func CheckExistsUser ¶
func CheckExistsUserWrapper ¶
func CheckUserArticlePermDeletable ¶ added in v0.36.0
func CheckUserArticlePermDeletable(userID bbs.UUserID, boardID bbs.BBoardID, articleID bbs.ArticleID, c *gin.Context) (err error)
CheckUserArticlePermDeletable
Deletable
func CheckUserArticlePermEditable ¶ added in v0.36.0
func CheckUserArticlePermEditable(userID bbs.UUserID, boardID bbs.BBoardID, articleID bbs.ArticleID, isCheckBoard bool, c *gin.Context) (err error)
CheckUserArticlePermEditable
Editable
func CheckUserArticlePermReadable ¶ added in v0.36.0
func CheckUserArticlePermReadable(userID bbs.UUserID, boardID bbs.BBoardID, articleID bbs.ArticleID, isCheckBoard bool, c *gin.Context) (err error)
CheckUserArticlePermReadable
Readable
func CheckUserArticlesPermDeletable ¶ added in v0.36.0
func CheckUserArticlesPermDeletable(userID bbs.UUserID, boardID bbs.BBoardID, articleIDs []bbs.ArticleID, userBoardPermReadable *UserBoardPermReadable, c *gin.Context) (articlePermMap map[bbs.ArticleID]error, err error)
CheckUserArticlePermDeletable
Deletable
func CheckUserArticlesPermEditable ¶ added in v0.36.0
func CheckUserArticlesPermEditable(userID bbs.UUserID, boardID bbs.BBoardID, articleIDs []bbs.ArticleID, userBoardPerm *UserBoardPermReadable, c *gin.Context) (articlePermMap map[bbs.ArticleID]error, err error)
CheckUserArticlesPermEditable
articles Editable
func CheckUserArticlesPermEditableDeletable ¶ added in v0.36.0
func CheckUserArticlesPermEditableDeletable(userID bbs.UUserID, boardID bbs.BBoardID, articleIDs []bbs.ArticleID, userBoardPerm *UserBoardPermReadable, c *gin.Context) (articlePermEditableMap map[bbs.ArticleID]error, articlePermDeletableMap map[bbs.ArticleID]error, err error)
CheckUserArticlesPermEditable
articles Editable
func CheckUserBoardPermCreatable ¶ added in v0.36.0
CheckUserBoardPermCreatable
func CheckUserBoardPermEditable ¶ added in v0.36.0
func CheckUserBoardPermEditable(userID bbs.UUserID, boardID bbs.BBoardID, c *gin.Context) (err error)
CheckUserBoardPermEditable
func CheckUserBoardPermPostable ¶ added in v0.36.0
func CheckUserBoardPermPostable(userID bbs.UUserID, boardID bbs.BBoardID, c *gin.Context) (err error)
CheckUserBoardPermPostable
https://github.com/ptt/pttbbs/blob/master/mbbsd/cache.c#L209
func CreateArticle ¶
func CreateArticleWrapper ¶
func CreateBoard ¶
func CreateBoardWrapper ¶
func CreateComment ¶
func CreateCommentWrapper ¶
func CreateRank ¶
func CreateRankWrapper ¶
func CrossPostWrapper ¶
func DeleteArticles ¶
func DeleteArticles(remoteAddr string, userID bbs.UUserID, params interface{}, path interface{}, c *gin.Context) (result interface{}, statusCode int, err error)
DeleteArticles provides function from api /board/:bid/deletearticles it will call backend api (go-pttbbs) and deleting all components like: comments, ranks, user_read_records about this articles
func DeleteArticlesWrapper ¶
func DeleteComments ¶
func DeleteCommentsWrapper ¶
func DeleteFavorite ¶
func DeleteFavoriteWrapper ¶
func DeserializeArticlesAndUpdateDB ¶
func DeserializeArticlesAndUpdateDB(articleSummaries_b []*bbs.ArticleSummary, updateNanoTS types.NanoTS) (articleSummaries []*schema.ArticleSummaryWithRegex, err error)
func DeserializeBoardDetailsAndUpdateDB ¶
func DeserializeBoardDetailsAndUpdateDB(boardDetails_b []*bbs.BoardDetail, updateNanoTS types.NanoTS) (boardDetails []*schema.BoardDetail, err error)
DeserializeBoards
each_b.Reason happens only with invalid permission.
func DeserializeBoardsAndUpdateDB ¶
func DeserializeBoardsAndUpdateDB(boardSummaries_b []*bbs.BoardSummary, updateNanoTS types.NanoTS) (boardSummaries []*schema.BoardSummary, err error)
DeserializeBoards
each_b.Reason happens only with invalid permission.
func DeserializePBBoardsAndUpdateDB ¶
func DeserializePBBoardsAndUpdateDB(boardSummaries_b []*boardd.Board, updateNanoTS types.NanoTS) (boardSummaries []*schema.BoardSummary, err error)
DeserializePBBoardsAndUpdateDB
func EditArticleDetail ¶
func ErrBoardCooldown ¶ added in v0.36.0
func ErrBoardPosttime ¶ added in v0.36.0
func ErrFloodReject ¶ added in v0.36.0
func FormLogout ¶
func GetArticleBlocks ¶
func GetArticleBlocksWrapper ¶
func GetArticleDetail ¶
func GetArticleDetailWrapper ¶
func GetBoardDetail ¶
func GetBoardDetailWrapper ¶
func GetBoardSummary ¶
func GetBoardSummaryWrapper ¶
func GetManArticleBlocks ¶
func GetManArticleDetail ¶
func GetUserIDWrapper ¶
func GetUserInfo ¶
func GetUserInfoWrapper ¶
func GetUserVisitCount ¶
func GetVersion ¶
func GetVersionWrapper ¶
func IndexHTMLWrapper ¶
func IndexWrapper ¶
func LoadArticleComments ¶
func LoadAutoCompleteBoards ¶
func LoadBottomArticles ¶
func LoadClassBoards ¶
func LoadClassBoardsWrapper ¶
func LoadFavoriteBoards ¶
func LoadGeneralArticles ¶
func LoadGeneralBoards ¶
func LoadManArticles ¶
func LoadManArticlesWrapper ¶
func LoadPopularArticles ¶
func LoadPopularBoards ¶
func LoadUserArticles ¶
func LoadUserArticlesWrapper ¶
func LoadUserComments ¶
func LoadUserCommentsWrapper ¶
func LoginHTMLWrapper ¶
func LoginRequiredJSON ¶
func LoginRequiredJSON(theFunc LoginRequiredAPIFunc, params interface{}, c *gin.Context)
func LoginRequiredPathJSON ¶
func LoginRequiredPathJSON(theFunc LoginRequiredPathAPIFunc, params interface{}, path interface{}, c *gin.Context)
func LoginRequiredPathQuery ¶
func LoginRequiredPathQuery(theFunc LoginRequiredPathAPIFunc, params interface{}, path interface{}, c *gin.Context)
func LoginRequiredQuery ¶
func LoginRequiredQuery(theFunc LoginRequiredAPIFunc, params interface{}, c *gin.Context)
func LoginWrapper ¶
func LogoutWrapper ¶
func ManArticleLockKey ¶
func ManArticleLockKey(boardID bbs.BBoardID, articleID types.ManArticleID) (key string)
func OptionsWrapper ¶
func RedirectPathQuery ¶
func RedirectPathQuery(theFunc RedirectPathAPIFunc, params interface{}, path interface{}, c *gin.Context)
func RefreshWrapper ¶
func RegisterClient ¶
func RegisterClientWrapper ¶
func RegisterHTMLWrapper ¶
func RegisterUser ¶
func RegisterUserWrapper ¶
func ReplyComments ¶
func ReplyCommentsWrapper ¶
func SetIDEmail ¶
func SetIDEmailWrapper ¶
func TryGetArticleContentInfo ¶
func TryGetArticleContentInfo(userID bbs.UUserID, bboardID bbs.BBoardID, articleID bbs.ArticleID, c *gin.Context, isSystem bool, isHash bool, isContent bool) (content [][]*types.Rune, contentPrefix [][]*types.Rune, contentMD5 string, ip string, host string, bbs string, signatureMD5 string, signatureDBCS []byte, articleDetailSummary *schema.ArticleDetailSummary, fileSize int, hash cmsys.Fnv64_t, statusCode int, err error)
TryGetArticleContentInfo
嘗試拿到 article-content
- 根據 article-id 得到相對應的 filename, ownerid, create-time.
- 嘗試從 schema 拿到 db summary 資訊. (create-time)
- 如果可以從 schema 拿到 db 資訊: 3.1. 如果已經 deleted: return deleted. 3.2. 如果距離上次跟 pttbbs 拿的時間太近: 從 schema 拿到 content, return schema-content.
- 嘗試做 lock. 4.1. 如果 lock 失敗: 從 schema 拿到 content, return schema-content.
- 從 pttbbs 拿到 article
- 如果從 pttbbs 拿到的時間比 schema 裡拿到的時間舊的話: return schema-content.
- parse article 為 content / comments.
- 將 comments parse 為 firstComments / theRestComments.
- 將 theRestComments 丟進 queue 裡.
func UnsetIsTest ¶
func UnsetIsTest()
func UserHTMLWrapper ¶
Types ¶
type AddFavoriteBoardParams ¶
type AddFavoriteBoardPath ¶
type AddFavoriteFolderParams ¶
type AddFavoriteFolderPath ¶
type AddFavoriteLineParams ¶
type AddFavoriteLinePath ¶
type AddFavoriteResult ¶
type AddFavoriteResult *apitypes.BoardSummary
type AttemptChangeEmailPath ¶
type AttemptRegisterUserResult ¶
type AttemptRegisterUserResult struct {
Username string `json:"user_id"`
}
type AttemptSetIDEmailParams ¶
type AttemptSetIDEmailPath ¶
type AttemptSetIDEmailResult ¶
type ChangeEmailParams ¶
type ChangeEmailPath ¶
type ChangeEmailResult ¶
type ChangePasswdParams ¶
type ChangePasswdParams struct { ClientID string `json:"client_id" form:"client_id"` ClientSecret string `json:"client_secret" form:"client_secret"` OrigPassword string `json:"orig_password" form:"orig_password"` Password string `json:"password" form:"password"` PasswordConfirm string `json:"password_confirm" form:"password_confirm"` }
type ChangePasswdPath ¶
type ChangePasswdResult ¶
type ChangePasswdResult LoginResult
func NewChangePasswdResult ¶
func NewChangePasswdResult(result_b *pttbbsapi.ChangePasswdResult) *ChangePasswdResult
type CheckExistsUserParams ¶
type CheckExistsUserResult ¶
type CheckExistsUserResult struct {
IsExists bool `json:"is_exists"`
}
type ClientInfo ¶
type ClientInfo struct { ClientID string `json:"c"` ClientType types.ClientType `json:"t"` }
type CooldownLimit ¶ added in v0.36.0
type CreateArticleParams ¶
type CreateArticlePath ¶
type CreateArticleResult ¶
type CreateArticleResult *apitypes.ArticleSummary
type CreateBoardParams ¶
type CreateBoardParams struct { Brdname string `json:"brdname" form:"brdname" url:"brdname"` BrdClass string `json:"class" form:"class" url:"class"` BrdTitle string `json:"title" form:"title" url:"title"` BMs []bbs.UUserID `json:"bms,omitempty" form:"bms,omitempty" url:"bms,omitempty"` BrdAttr ptttype.BrdAttr `json:"brdattr,omitempty" form:"brdattr,omitempty" url:"brdattr,omitempty"` Level ptttype.PERM `json:"level,omitempty" form:"level,omitempty" url:"level,omitempty"` ChessCountry ptttype.ChessCode `json:"chess_country,omitempty" form:"chess_country,omitempty" url:"chess_country,omitempty"` IsGroup bool `json:"is_group,omitempty" form:"is_group,omitempty" url:"is_group,omitempty"` }
type CreateBoardPath ¶
type CreateBoardResult ¶
type CreateBoardResult *apitypes.BoardSummary
type CreateCommentParams ¶
type CreateCommentParams struct { CommentType ptttype.CommentType `json:"type" form:"type" url:"type"` Content string `json:"content" form:"content" url:"content"` }
type CreateCommentPath ¶
type CreateCommentPath struct { FBoardID apitypes.FBoardID `uri:"bid" binding:"required"` FArticleID apitypes.FArticleID `uri:"aid" binding:"required"` }
type CreateCommentResult ¶
type CreateRankParams ¶
type CreateRankParams struct {
Rank int `json:"rank" form:"rank" url:"rank"`
}
type CreateRankPath ¶
type CreateRankPath struct { FBoardID apitypes.FBoardID `uri:"bid" binding:"required"` FArticleID apitypes.FArticleID `uri:"aid" binding:"required"` }
type CreateRankResult ¶
type CrossPostParams ¶
type CrossPostPath ¶
type CrossPostPath struct { FBoardID apitypes.FBoardID `uri:"bid" binding:"required"` FArticleID apitypes.FArticleID `uri:"aid" binding:"required"` }
type CrossPostResult ¶
type DeleteArticlesParams ¶
type DeleteArticlesParams struct {
ArticleIDs []apitypes.FArticleID `json:"aids" form:"aids" url:"aids" binding:"required"`
}
type DeleteArticlesPath ¶
type DeleteArticlesResult ¶
type DeleteCommentsParams ¶
type DeleteCommentsParams struct {
TheList []*apitypes.DeleteCommentParams `json:"list" form:"list" url:"list"`
}
type DeleteCommentsPath ¶
type DeleteCommentsPath struct { FBoardID apitypes.FBoardID `uri:"bid"` FArticleID apitypes.FArticleID `uri:"aid"` }
type DeleteCommentsResult ¶
type DeleteFavoriteParams ¶
type DeleteFavoritePath ¶
type DeleteFavoriteResult ¶
type EditArticleParams ¶
type EditArticlePath ¶
type EditArticlePath struct { FBoardID apitypes.FBoardID `uri:"bid"` FArticleID apitypes.FArticleID `uri:"aid"` }
type EditArticleResult ¶
type GetArticleBlocksParams ¶
type GetArticleBlocksParams struct { StartIdx string `json:"start_idx,omitempty" form:"start_idx,omitempty" url:"start_idx,omitempty"` Max int `json:"limit,omitempty" form:"limit,omitempty" url:"limit,omitempty"` }
func NewGetArticleBlocksParams ¶
func NewGetArticleBlocksParams() *GetArticleBlocksParams
type GetArticleBlocksPath ¶
type GetArticleBlocksPath struct { FBoardID apitypes.FBoardID `uri:"bid"` FArticleID apitypes.FArticleID `uri:"aid"` }
type GetArticleBlocksResult ¶
type GetArticleBlocksResult struct { Content [][]*types.Rune `json:"content,omitempty"` IsDeleted bool `json:"deleted,omitempty"` // CreateTime types.Time8 `json:"create_time,omitempty"` // MTime types.Time8 `json:"modified,omitempty"` // Recommend int `json:"recommend,omitempty"` // NComments int `json:"n_comments,omitempty"` // Owner bbs.UUserID `json:"owner,omitempty"` // Nickname string `json:"nickname,omitempty"` Title string `json:"title,omitempty"` // Money int `json:"money,omitempty"` // Class string `json:"class,omitempty"` // can be: R: 轉, [class] Filemode ptttype.FileMode `json:"mode,omitempty"` // IP string `json:"ip,omitempty"` Host string `json:"host,omitempty"` // ip 的中文呈現, 外國則為國家. BBS string `json:"bbs,omitempty"` Rank int `json:"rank,omitempty"` // 評價 NextIdx string `json:"next_idx"` TokenUser bbs.UUserID `json:"tokenuser"` }
type GetArticleDetailParams ¶
type GetArticleDetailParams struct{}
type GetArticleDetailPath ¶
type GetArticleDetailPath struct { FBoardID apitypes.FBoardID `uri:"bid"` FArticleID apitypes.FArticleID `uri:"aid"` }
type GetArticleDetailResult ¶
type GetArticleDetailResult struct { BBoardID apitypes.FBoardID `json:"bid"` // ArticleID apitypes.FArticleID `json:"aid"` // IsDeleted bool `json:"deleted"` // CreateTime types.Time8 `json:"create_time"` // MTime types.Time8 `json:"modified"` // Recommend int `json:"recommend"` // NComments int `json:"n_comments"` // Owner bbs.UUserID `json:"owner"` // Nickname string `json:"nickname"` Title string `json:"title"` // Money int `json:"money"` // Class string `json:"class"` // can be: R: 轉, [class] Filemode ptttype.FileMode `json:"mode"` // URL string `json:"url"` // Read bool `json:"read"` // Brdname string `json:"brdname"` Content [][]*types.Rune `json:"content"` ContentPrefix [][]*types.Rune `json:"prefix"` IP string `json:"ip"` Host string `json:"host"` // ip 的中文呈現, 外國則為國家. BBS string `json:"bbs"` Rank int `json:"rank"` // 評價 TokenUser bbs.UUserID `json:"tokenuser"` }
type GetBoardDetailParams ¶
type GetBoardDetailParams struct {
Fields string `json:"fields,omitempty" form:"fields,omitempty" uri:"fields,omitempty"`
}
type GetBoardDetailPath ¶
type GetBoardDetailResult ¶
type GetBoardDetailResult *apitypes.BoardDetail
type GetBoardSummaryParams ¶
type GetBoardSummaryParams struct{}
type GetBoardSummaryPath ¶
type GetBoardSummaryResult ¶
type GetBoardSummaryResult *apitypes.BoardSummary
type GetManArticleBlocksParams ¶
type GetManArticleBlocksParams struct { StartIdx string `json:"start_idx,omitempty" form:"start_idx,omitempty" url:"start_idx,omitempty"` Max int `json:"limit,omitempty" form:"limit,omitempty" url:"limit,omitempty"` }
func NewGetManArticleBlocksParams ¶
func NewGetManArticleBlocksParams() *GetManArticleBlocksParams
type GetManArticleBlocksPath ¶
type GetManArticleBlocksPath struct { FBoardID apitypes.FBoardID `uri:"bid"` FArticleID apitypes.FArticleID `uri:"aid"` }
type GetManArticleBlocksResult ¶
type GetManArticleBlocksResult struct { Content [][]*types.Rune `json:"content,omitempty"` IsDeleted bool `json:"deleted,omitempty"` // CreateTime types.Time8 `json:"create_time,omitempty"` // MTime types.Time8 `json:"modified,omitempty"` // Title string `json:"title,omitempty"` // NextIdx string `json:"next_idx"` TokenUser bbs.UUserID `json:"tokenuser"` }
type GetManArticleDetailPath ¶
type GetManArticleDetailPath struct { FBoardID apitypes.FBoardID `uri:"bid"` FArticleID apitypes.FArticleID `uri:"aid"` }
type GetManArticleDetailResult ¶
type GetManArticleDetailResult struct { BBoardID apitypes.FBoardID `json:"bid"` // ArticleID apitypes.FArticleID `json:"aid"` // LevelIdx apitypes.FArticleID `json:"level_idx"` IsDeleted bool `json:"deleted"` // CreateTime types.Time8 `json:"create_time"` // MTime types.Time8 `json:"modified"` // Title string `json:"title"` // IsDir bool `json:"is_dir"` Content [][]*types.Rune `json:"content"` TokenUser bbs.UUserID `json:"tokenuser"` }
type GetUserIDResult ¶
type GetUserInfoParams ¶
type GetUserInfoParams struct {
Fields string `json:"fields,omitempty" form:"fields,omitempty" url:"fields,omitempty"`
}
type GetUserInfoPath ¶
type GetUserInfoResult ¶
type GetUserInfoResult struct { UserID bbs.UUserID `json:"user_id"` Username string `json:"username"` Realname string `json:"realtime"` Nickname string `json:"nickname"` Uflag ptttype.UFlag `json:"flag"` Userlevel ptttype.PERM `json:"perm"` Numlogindays int `json:"login_days"` Numposts int `json:"posts"` Firstlogin types.Time8 `json:"first_login"` Lastlogin types.Time8 `json:"last_login"` LastIP string `json:"last_ip"` LastHost string `json:"last_host"` // ip 的中文呈現, 外國則為國家. Money int `json:"money"` PttEmail string `json:"pttemail"` Justify string `json:"justify"` Over18 bool `json:"over18"` PagerUIType uint8 `json:"pager_ui"` /* 呼叫器界面類別 (was: WATER_*) */ Pager ptttype.PagerMode `json:"pager"` /* 呼叫器狀態 */ Invisible bool `json:"invisible"` Exmailbox uint32 `json:"exmail"` Career string `json:"career"` Role uint32 `json:"role"` LastSeen types.Time8 `json:"last_seen"` TimeSetAngel types.Time8 `json:"time_set_angel"` TimePlayAngel types.Time8 `json:"time_play_angel"` LastSong types.Time8 `json:"last_song"` LoginView uint32 `json:"login_view"` Vlcount int `json:"violation"` FiveWin int `json:"five_win"` FiveLose int `json:"five_lose"` FiveTie int `json:"five_tie"` ChcWin int `json:"chc_win"` ChcLose int `json:"chc_lose"` ChcTie int `json:"chc_tie"` Conn6Win int `json:"conn6_win"` Conn6Lose int `json:"conn6_lose"` Conn6Tie int `json:"conn6_tie"` GoWin int `json:"go_win"` GoLose int `json:"go_lose"` GoTie int `json:"go_tie"` DarkWin int `json:"dark_win"` DarkLose int `json:"dark_lose"` DarkTie int `json:"dark_tie"` /* 暗棋戰績 和 */ ChessEloRating int `json:"chess_rank"` /* 象棋等級 */ UaVersion uint8 `json:"ua_version"` Signature uint8 `json:"signaure"` /* 慣用簽名檔 */ BadPost int `json:"bad_post"` /* 評價為壞文章數 */ MyAngel bbs.UUserID `json:"angel"` /* 我的小天使 */ TimeRemoveBadPost types.Time8 `json:"time_remove_bad_post"` TimeViolateLaw types.Time8 `json:"time_violate_law"` IsDeleted bool `json:"deleted"` UpdateTS types.Time8 `json:"update_ts"` UserLevel2 ptttype.PERM2 `bson:"perm2"` UpdateTS2 types.Time8 `bson:"update_ts2"` Avatar []byte `json:"avatar"` AvatarTS types.Time8 `json:"avatar_ts"` Email string `json:"email"` EmailSet bool `json:"email_set"` EmailTS types.Time8 `json:"email_ts"` TwoFactorEnabled bool `json:"twofactor_enabled"` TwoFactorEnabledTS types.Time8 `json:"twofactor_enabled_ts"` IDEmail string `json:"idemail"` IDEmailSet bool `json:"idemail_set"` IDEmailTS types.Time8 `json:"idemail_ts"` TokenUser bbs.UUserID `json:"tokenuser"` }
func NewUserInfoResult ¶
func NewUserInfoResult(userDetail_db *schema.UserDetail, userNewInfo_db *schema.UserNewInfo, userIDEmail_db *schema.UserIDEmail, userEmail_db *schema.UserEmail, userPermInfo *schema.UserPermInfo) (result *GetUserInfoResult)
type GetUserVisitCountResult ¶
type GetVersionResult ¶
type IndexParams ¶
type IndexParams struct {
In int `form:"in,omitempty"`
}
func NewIndexParams ¶
func NewIndexParams() *IndexParams
type IndexResult ¶
type IndexResult struct {
Data interface{}
}
type LoadArticleCommentsParams ¶
type LoadArticleCommentsParams struct { StartIdx string `json:"start_idx,omitempty" form:"start_idx,omitempty" url:"start_idx,omitempty"` Descending bool `json:"desc,omitempty" form:"desc,omitempty" url:"desc,omitempty"` Max int `json:"limit,omitempty" form:"limit,omitempty" url:"limit,omitempty"` }
func NewLoadArticleCommentsParams ¶
func NewLoadArticleCommentsParams() *LoadArticleCommentsParams
type LoadArticleCommentsPath ¶
type LoadArticleCommentsPath struct { FBoardID apitypes.FBoardID `uri:"bid"` FArticleID apitypes.FArticleID `uri:"aid"` }
type LoadArticleCommentsResult ¶
type LoadArticleCommentsResult struct { List []*apitypes.Comment `json:"list"` NextIdx string `json:"next_idx"` TokenUser bbs.UUserID `json:"tokenuser,omitempty"` }
type LoadAutoCompleteBoardsParams ¶
type LoadAutoCompleteBoardsParams struct { Keyword string `json:"brdname,omitempty" form:"brdname,omitempty" url:"brdname,omitempty"` StartIdx string `json:"start_idx,omitempty" form:"start_idx,omitempty" url:"start_idx,omitempty"` Ascending bool `json:"asc,omitempty" form:"asc,omitempty" url:"asc,omitempty"` Max int `json:"limit,omitempty" form:"limit,omitempty" url:"limit,omitempty"` }
func NewLoadAutoCompleteBoardsParams ¶
func NewLoadAutoCompleteBoardsParams() *LoadAutoCompleteBoardsParams
type LoadBottomArticlesPath ¶
type LoadBottomArticlesResult ¶
type LoadBottomArticlesResult struct { List []*apitypes.ArticleSummary `json:"list"` TokenUser bbs.UUserID `json:"tokenuser,omitempty"` }
type LoadClassBoardsParams ¶
type LoadClassBoardsParams struct { StartIdx string `json:"start_idx,omitempty" form:"start_idx,omitempty" url:"start_idx,omitempty"` SortBy ptttype.BSortBy `json:"sortby,omitempty" form:"sortby,omitempty" url:"sortby,omitempty"` Ascending bool `json:"asc,omitempty" form:"asc,omitempty" url:"asc,omitempty"` Max int `json:"limit,omitempty" form:"limit,omitempty" url:"limit,omitempty"` }
func NewLoadClassBoardsParams ¶
func NewLoadClassBoardsParams() *LoadClassBoardsParams
type LoadClassBoardsPath ¶
type LoadClassBoardsResult ¶
type LoadClassBoardsResult struct { List []*apitypes.BoardSummary `json:"list"` NextIdx string `json:"next_idx"` TokenUser bbs.UUserID `json:"tokenuser,omitempty"` }
func NewLoadClassBoardsResult ¶
func NewLoadClassBoardsResult(boardSummaries_db []*schema.BoardSummary, userBoardInfoMap map[bbs.BBoardID]*apitypes.UserBoardInfo, nextIdx string, sortBy ptttype.BSortBy, userID bbs.UUserID) (ret *LoadClassBoardsResult)
type LoadFavoriteBoardsParams ¶
type LoadFavoriteBoardsParams struct { LevelIdx schema.LevelIdx `json:"level_idx,omitempty" form:"level_idx,omitempty" url:"level_idx,omitempty"` StartIdx string `json:"start_idx,omitempty" form:"start_idx,omitempty" url:"start_idx,omitempty"` Ascending bool `json:"asc,omitempty" form:"asc,omitempty" url:"asc,omitempty"` Max int `json:"limit,omitempty" form:"limit,omitempty" url:"limit,omitempty"` }
func NewLoadFavoriteBoardsParams ¶
func NewLoadFavoriteBoardsParams() *LoadFavoriteBoardsParams
type LoadFavoriteBoardsPath ¶
type LoadFavoriteBoardsResult ¶
type LoadFavoriteBoardsResult struct { List []*apitypes.BoardSummary `json:"list"` NextIdx string `json:"next_idx"` TokenUser bbs.UUserID `json:"tokenuser,omitempty"` }
func NewLoadFavoriteBoardsResult ¶
func NewLoadFavoriteBoardsResult(userID bbs.UUserID, userFavorites_db []*schema.UserFavorites, boardSummaryMap_db map[ptttype.Bid]*schema.BoardSummary, userBoardInfoMap map[bbs.BBoardID]*apitypes.UserBoardInfo, nextIdx string) (result *LoadFavoriteBoardsResult)
type LoadGeneralArticlesParams ¶
type LoadGeneralArticlesParams struct { Keyword string `json:"title,omitempty" form:"title,omitempty" url:"title,omitempty"` StartIdx string `json:"start_idx,omitempty" form:"start_idx,omitempty" url:"start_idx,omitempty"` Max int `json:"limit,omitempty" form:"limit,omitempty" url:"limit,omitempty"` Descending bool `json:"desc,omitempty" form:"desc,omitempty" url:"desc,omitempty"` }
func NewLoadGeneralArticlesParams ¶
func NewLoadGeneralArticlesParams() *LoadGeneralArticlesParams
type LoadGeneralArticlesPath ¶
type LoadGeneralArticlesResult ¶
type LoadGeneralArticlesResult struct { List []*apitypes.ArticleSummary `json:"list"` NextIdx string `json:"next_idx"` TokenUser bbs.UUserID `json:"tokenuser,omitempty"` }
type LoadGeneralBoardsParams ¶
type LoadGeneralBoardsParams struct { Title string `json:"title,omitempty" form:"title,omitempty" url:"title,omitempty"` Keyword string `json:"keyword,omitempty" form:"keyword,omitempty" url:"keyword,omitempty"` StartIdx string `json:"start_idx,omitempty" form:"start_idx,omitempty" url:"start_idx,omitempty"` Ascending bool `json:"asc,omitempty" form:"asc,omitempty" url:"asc,omitempty"` Max int `json:"limit,omitempty" form:"limit,omitempty" url:"limit,omitempty"` }
func NewLoadGeneralBoardsParams ¶
func NewLoadGeneralBoardsParams() *LoadGeneralBoardsParams
type LoadGeneralBoardsResult ¶
type LoadGeneralBoardsResult struct { List []*apitypes.BoardSummary `json:"list"` NextIdx string `json:"next_idx"` TokenUser bbs.UUserID `json:"tokenuser,omitempty"` }
func NewLoadGeneralBoardsResult ¶
func NewLoadGeneralBoardsResult(boardSummaries_db []*schema.BoardSummary, userBoardInfoMap map[bbs.BBoardID]*apitypes.UserBoardInfo, nextIdx string, url string, userID bbs.UUserID) *LoadGeneralBoardsResult
type LoadManArticlesParams ¶
type LoadManArticlesParams struct {
LevelIdx apitypes.FArticleID `json:"level_idx,omitempty" form:"level_idx,omitempty" url:"level_idx,omitempty"`
}
type LoadManArticlesPath ¶
type LoadManArticlesResult ¶
type LoadManArticlesResult struct { List []*apitypes.ManArticleSummary `json:"list"` TokenUser bbs.UUserID `json:"tokenuser,omitempty"` }
func NewLoadManArticlesResult ¶
func NewLoadManArticlesResult(articleSummaries_db []*schema.ManArticleSummary, userID bbs.UUserID) (r *LoadManArticlesResult)
type LoadPopularArticlesParams ¶
type LoadPopularArticlesParams struct { StartIdx string `json:"start_idx,omitempty" form:"start_idx,omitempty" url:"start_idx,omitempty"` Max int `json:"limit,omitempty" form:"limit,omitempty" url:"limit,omitempty"` Descending bool `json:"desc,omitempty" form:"desc,omitempty" url:"desc,omitempty"` }
func NewLoadPopularArticlesParams ¶
func NewLoadPopularArticlesParams() *LoadPopularArticlesParams
type LoadPopularArticlesResult ¶
type LoadPopularArticlesResult struct { List []*apitypes.ArticleSummary `json:"list"` NextIdx string `json:"next_idx"` TokenUser bbs.UUserID `json:"tokenuser,omitempty"` }
type LoadPopularBoardsResult ¶
type LoadPopularBoardsResult struct { List []*apitypes.BoardSummary `json:"list"` TokenUser bbs.UUserID `json:"tokenuser,omitempty"` }
func NewLoadPopularBoardsResult ¶
func NewLoadPopularBoardsResult(boardSummaries_db []*schema.BoardSummary, userBoardInfoMap map[bbs.BBoardID]*apitypes.UserBoardInfo, userID bbs.UUserID) *LoadPopularBoardsResult
type LoadUserArticlesParams ¶
type LoadUserArticlesParams struct { StartIdx string `json:"start_idx,omitempty" form:"start_idx,omitempty" url:"start_idx,omitempty"` Descending bool `json:"desc,omitempty" form:"desc,omitempty" url:"desc,omitempty"` Max int `json:"limit,omitempty" form:"limit,omitempty" url:"limit,omitempty"` }
func NewUserArticlesParams ¶
func NewUserArticlesParams() *LoadUserArticlesParams
type LoadUserArticlesPath ¶
type LoadUserArticlesResult ¶
type LoadUserArticlesResult struct { List []*apitypes.ArticleSummary `json:"list"` NextIdx string `json:"next_idx"` TokenUser bbs.UUserID `json:"tokenuser,omitempty"` }
func NewLoadUserArticlesResult ¶
func NewLoadUserArticlesResult(a_db []*schema.ArticleSummary, userReadBoardArticleMap map[types.BoardArticleID]bool, nextIdx string, userID bbs.UUserID) *LoadUserArticlesResult
type LoadUserCommentsParams ¶
type LoadUserCommentsParams struct { StartIdx string `json:"start_idx,omitempty" form:"start_idx,omitempty" url:"start_idx,omitempty"` Descending bool `json:"desc,omitempty" form:"desc,omitempty" url:"desc,omitempty"` Max int `json:"limit,omitempty" form:"limit,omitempty" url:"limit,omitempty"` }
func NewLoadUserCommentsParams ¶
func NewLoadUserCommentsParams() *LoadUserCommentsParams
type LoadUserCommentsPath ¶
type LoadUserCommentsResult ¶
type LoadUserCommentsResult struct { List []*apitypes.ArticleComment `json:"list"` NextIdx string `json:"next_idx"` TokenUser bbs.UUserID `json:"tokenuser,omitempty"` }
func NewLoadUserCommentsResult ¶
func NewLoadUserCommentsResult( commentSummaries_db []*schema.CommentSummary, articleSummaryMap map[types.BoardArticleID]*schema.ArticleSummary, userReadBoardArticleMap map[types.BoardArticleID]types.NanoTS, nextIdx string, userID bbs.UUserID, ) (result *LoadUserCommentsResult)
type LoginLog ¶
type LoginLog struct { ClientInfo LoginID string LoginTime types.NanoTS LoginIP string IsSuccess bool }
LoginLog record user login info, no matter success or not
type LoginParams ¶
type LoginParams struct { ClientID string `json:"client_id" form:"client_id"` ClientSecret string `json:"client_secret" form:"client_secret"` Username string `json:"username" form:"username"` Password string `json:"password" form:"password"` }
func NewLoginParams ¶
func NewLoginParams() *LoginParams
type LoginRequiredAPIFunc ¶
type LoginResult ¶
type LoginResult struct { UserID bbs.UUserID `json:"user_id"` AccessToken string `json:"access_token"` TokenType string `json:"token_type"` RefreshToken string `json:"refresh_token"` AccessExpire types.Time8 `json:"access_expire"` RefreshExpire types.Time8 `json:"refresh_expire"` TokenUser bbs.UUserID `json:"tokenuser"` }
func NewLoginResult ¶
func NewLoginResult(result_b *pttbbsapi.LoginResult) *LoginResult
type RedirectPathAPIFunc ¶
type RefreshParams ¶
type RefreshResult ¶
type RefreshResult LoginResult
type RegisterClientParams ¶
type RegisterClientParams struct { ClientID string `json:"client_id"` ClientType types.ClientType `json:"client_type"` }
func NewRegisterClientParams ¶
func NewRegisterClientParams() *RegisterClientParams
type RegisterClientResult ¶
type RegisterClientResult struct { ClientSecret string `json:"client_secret"` TokenUser bbs.UUserID `json:"tokenuser,omitempty"` }
func NewRegisterClientResult ¶
func NewRegisterClientResult(client *schema.Client, userID bbs.UUserID) *RegisterClientResult
type RegisterUserParams ¶
type RegisterUserParams struct { ClientID string `json:"client_id" form:"client_id"` ClientSecret string `json:"client_secret" form:"client_secret"` Username string `json:"username" form:"username"` Password string `json:"password" form:"password"` PasswordConfirm string `json:"password_confirm" form:"password_confirm"` TwoFactorToken string `json:"token" form:"token"` Over18 bool `json:"over18,omitempty" form:"over18,omitempty"` Email string `json:"email" form:"email"` Nickname string `json:"nickname,omitempty" form:"nickname,omitempty"` Realname string `json:"realname,omitempty" form:"realname,omitempty"` Career string `json:"career,omitempty" form:"career,omitempty"` }
func NewRegisterUserParams ¶
func NewRegisterUserParams() *RegisterUserParams
type RegisterUserResult ¶
type RegisterUserResult LoginResult
func NewRegisterUserResult ¶
func NewRegisterUserResult(result_b *pttbbsapi.RegisterResult) *RegisterUserResult
type ReplyCommentsParams ¶
type ReplyCommentsParams struct {
TheList []*apitypes.ReplyCommentParams `json:"list" form:"list" url:"list"`
}
type ReplyCommentsPath ¶
type ReplyCommentsPath struct { FBoardID apitypes.FBoardID `uri:"bid"` FArticleID apitypes.FArticleID `uri:"aid"` }
type ReplyCommentsResult ¶
type SetIDEmailParams ¶
type SetIDEmailPath ¶
type SetIDEmailResult ¶
type UserBoardPermReadable ¶ added in v0.36.0
func CheckUserBoardPermReadable ¶ added in v0.36.0
func CheckUserBoardPermReadable(userID bbs.UUserID, boardID bbs.BBoardID, c *gin.Context) (userBoardPerm *UserBoardPermReadable, err error)
CheckUserBoardPermReadable
https://github.com/ptt/pttbbs/blob/master/mbbsd/board.c#L185
Source Files ¶
- add_favorite_board.go
- add_favorite_folder.go
- add_favorite_line.go
- api.go
- api_login_required.go
- api_login_required_path.go
- api_login_required_redirect_path.go
- api_result.go
- api_utils.go
- article_utils.go
- attempt_change_email.go
- attempt_register_user.go
- attempt_set_id_email.go
- board_utils.go
- change_email.go
- change_passwd.go
- check_exists_user.go
- client_utils.go
- comment_utils.go
- const.go
- create_article.go
- create_board.go
- create_comment.go
- create_rank.go
- cross_post.go
- delete_articles.go
- delete_comments.go
- delete_favorite.go
- edit_article.go
- errors.go
- get_article_blocks.go
- get_article_detail.go
- get_board_detail.go
- get_board_summary.go
- get_man_article_blocks.go
- get_man_article_detail.go
- get_user_id.go
- get_user_info.go
- get_user_visit_count.go
- get_version.go
- html.go
- index.go
- load_article_comments.go
- load_auto_complete_boards.go
- load_bottom_articles.go
- load_class_boards.go
- load_favorite_boards.go
- load_general_articles.go
- load_general_articles_by_keyword.go
- load_general_boards.go
- load_general_boards_by_class.go
- load_man_articles.go
- load_popular_articles.go
- load_popular_boards.go
- load_user_articles.go
- load_user_comments.go
- login.go
- login_register_utils.go
- logout.go
- man_article_utils.go
- options.go
- refresh.go
- register_client.go
- register_user.go
- reply_comments.go
- set_id_email.go
- testinit.go
- types.go
- user_article_perm.go
- user_board_perm.go
- user_favorites_utils.go
- user_perm_info.go
- user_utils.go
- validate_origin.go
- validate_remote_addr.go