Documentation ¶
Index ¶
- Constants
- func ArticleDelete(lang, username string, aid uint32) (err error)
- func ArticleNew(a *Article) (id uint32, err error)
- func ArticleUpd(a *Article, oldTag string) (err error)
- func ArticleViewGet(lang, ip string, aid uint32) (view int)
- func BintoUint32(b []byte) uint32
- func ComLimitGet(lang, username string) int
- func ComLimitSet(lang, username string)
- func ComUpSet(lang, username, cid string) error
- func CommentNew(a *Article, user string, mainaid uint32) (id uint32, err error)
- func DauGet(lang string) int
- func DauSet(lang, ip string)
- func FollowCount(lang, cat, u string) int
- func Following(lang, cat, u, v string) (err error)
- func GenerateMonster(username string) (image.Image, error)
- func GetMasterSlave(master string, slave string) ([]byte, []byte)
- func ImgProcess(s, lang, username, host string) (res string, err error)
- func IsFollowing(lang, cat, u, v string) bool
- func IsSmtpSet(SMTPHost, SMTPPort, SMTPUser, SMTPPassword string) bool
- func MentionDel(lang, username, path string)
- func PostLimitDel(lang, username string)
- func PostLimitGet(lang, username string) int
- func PostLimitSet(lang, username string)
- func RegisterIPGet(ip string) int
- func RegisterIPSet(ip string)
- func ReplyParse(s, lang string) string
- func SaveToFile(img image.Image, filePath string) error
- func Send2fcm(to string, a *Article) []byte
- func SendMail(...)
- func SendMentions(lang, SMTPHost, SMTPPort, SMTPUser, SMTPPassword, Domain string, ...)
- func Store(href, lang, username string, b []byte) (file, orig string, origSize int)
- func TgClickableImage(s string) string
- func TgGet(bot, req string) (res []byte)
- func TgIsAdmin(bot, req, admin string) (isAdmin bool, err error)
- func TgSendMsg(bot, channel, txt, title, link, img string, msgID int) (mid int)
- func Type2TeleGet(aid uint32) int
- func Type2TeleSet(aid uint32, mid int)
- func Uint32toBin(id uint32) []byte
- func Unfollowing(lang, cat, u, v string) (err error)
- func UserBanGet(username string) bool
- func UserBanSet(author string)
- func UserNew(user *User) (err error)
- func UserSave(user *User) (err error)
- func ViewGet(lang string, aid uint32) (v int)
- func ViewSet(lang string, aid uint32, v int)
- func VoteSet(lang, username string) error
- func WauGet(lang string) int
- func Zip(a1, a2 []string) []string
- type Article
- func AllArticles(lang, from_str, tag string) (models []Article, page string, prev, next, last uint32, err error)
- func ArticleGet(lang, username string, aid uint32) (a *Article, err error)
- func ArticlesAuthor(lang, username, author, from_str string) (models []Article, page string, prev, next, last uint32, err error)
- func ArticlesSelect(lang, fAids string, from []byte, limit, offset uint32, asc bool) (models []Article, first, last uint32, err error)
- func ArticlesSort(models []Article, by string, cnt uint32) (sorted []Article, err error)
- func Favorites(lang, u string) (articles []Article)
- func TopArticles(lang string, cnt uint32, by string) (models []Article, err error)
- type FcmMsg
- type Gender
- type Mention
- type TgMsg
- type TgUsers
- type User
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func ArticleDelete ¶
ArticleDelete delete article
func ArticleViewGet ¶
func ComLimitGet ¶
func ComLimitSet ¶
func ComLimitSet(lang, username string)
func CommentNew ¶
CommentNew create comment
func GenerateMonster ¶ added in v1.3.2
GenerateFromUsername generates avatar from string
func GetMasterSlave ¶
GetMasterSlave convert to bin
func ImgProcess ¶
ImgProcess extract img links from markdown, download, and replace with local copy
func MentionDel ¶
func MentionDel(lang, username, path string)
MentionDel remove mention for username by path
func PostLimitDel ¶
func PostLimitDel(lang, username string)
func PostLimitGet ¶
func PostLimitSet ¶
func PostLimitSet(lang, username string)
func RegisterIPGet ¶
func RegisterIPSet ¶
func RegisterIPSet(ip string)
func ReplyParse ¶
ReplyParse - replace first '@username ' on markdown link and return array of username
func SendMail ¶ added in v1.3.2
func SendMail(SMTPHost, SMTPPort, SMTPUser, SMTPPassword, Domain, address, title, body string)
SendMail send text/plain email via smtp
func SendMentions ¶ added in v1.3.2
func TgClickableImage ¶
func TgIsAdmin ¶
TgIsAdmin return true is username admin in channel and canpostmessages return false in case of errors (tgapi is banned, not respond)
func Type2TeleGet ¶
func Type2TeleSet ¶
func UserBanGet ¶
func UserBanSet ¶
func UserBanSet(author string)
Types ¶
type Article ¶
type Article struct { ID uint32 Title string `form:"title" json:"title" binding:"max=255"` Body string `form:"body" json:"body" binding:"exists,min=10,max=65536"` Author string Image string OgImage string `form:"ogimage" json:"ogimage" binding:"omitempty,url"` CreatedAt time.Time Lang string HTML template.HTML Plus uint32 Minus uint32 Comments []Article ReadingTime int WordCount int Tag string `form:"tag" json:"tag" binding:"omitempty,alphanum,max=20"` }
Article model
func AllArticles ¶
func AllArticles(lang, from_str, tag string) (models []Article, page string, prev, next, last uint32, err error)
AllArticles return page from list of articles
func ArticleGet ¶
ArticleGet get article
func ArticlesAuthor ¶
func ArticlesAuthor(lang, username, author, from_str string) (models []Article, page string, prev, next, last uint32, err error)
ArticlesAuthor return articles by author
func ArticlesSelect ¶
func ArticlesSort ¶
type Mention ¶
type Mention struct { Then time.Time Path string ByUsername string Aid uint32 Cid uint32 Text string ToUsername string }
func MentionNew ¶
MentionNew parce mentions
type TgUsers ¶
type TgUsers struct { Ok bool `json:"ok"` Result []struct { User struct { ID int `json:"id"` IsBot bool `json:"is_bot"` FirstName string `json:"first_name"` Username string `json:"username"` } `json:"user"` Status string `json:"status"` CanBeEdited bool `json:"can_be_edited,omitempty"` CanChangeInfo bool `json:"can_change_info,omitempty"` CanPostMessages bool `json:"can_post_messages,omitempty"` CanEditMessages bool `json:"can_edit_messages,omitempty"` CanDeleteMessages bool `json:"can_delete_messages,omitempty"` CanInviteUsers bool `json:"can_invite_users,omitempty"` CanRestrictMembers bool `json:"can_restrict_members,omitempty"` CanPromoteMembers bool `json:"can_promote_members,omitempty"` } `json:"result"` }
type User ¶
type User struct { Username string `form:"username" json:"username" binding:"exists,alphanum,min=1,max=20"` Email string `form:"email" json:"email" binding:"omitempty,email"` Password string `form:"password" json:"password" binding:"exists,min=6,max=255"` NewPassword string `form:"newpassword" json:"newpassword" binding:"omitempty,min=6,max=255"` Bio string `form:"bio" json:"bio" binding:"max=1024"` Image string `form:"image" json:"image" binding:"omitempty,url"` Lang string PasswordHash string `json:"-"` LastPost uint32 `json:"-"` Unseen uint32 `json:"-"` IP string `json:"-"` NoJs bool `json:"-"` Type2Telegram string `json:"-"` Type2TeleNoTxt bool `json:"-"` }
User model
func UserCheckGet ¶
UserCheckGet check