mirror of https://github.com/casbin/casnode.git
chore(style): fmt code (#534)
This commit is contained in:
parent
69d6098eb2
commit
a6c327cfdf
|
@ -22,8 +22,10 @@ import (
|
|||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
var adapter *Adapter = nil
|
||||
var CasdoorOrganization string
|
||||
var (
|
||||
adapter *Adapter = nil
|
||||
CasdoorOrganization string
|
||||
)
|
||||
|
||||
type Session struct {
|
||||
SessionKey string `xorm:"char(64) notnull pk"`
|
||||
|
|
|
@ -59,7 +59,6 @@ func (c *ApiController) UpdateFrontConfById() {
|
|||
err := json.Unmarshal(c.Ctx.Input.RequestBody, &value)
|
||||
tags := service.Finalword(value)
|
||||
affect, err := object.UpdateFrontConfById(id, value, tags)
|
||||
|
||||
if err != nil {
|
||||
c.ResponseError(err.Error())
|
||||
}
|
||||
|
|
|
@ -58,7 +58,6 @@ func (c *ApiController) GetNode() {
|
|||
c.ServeJSON()
|
||||
}
|
||||
|
||||
|
||||
// @Title UpdateNode
|
||||
// @router /update-node [post]
|
||||
// @Tag Node API
|
||||
|
|
|
@ -545,7 +545,6 @@ func (c *ApiController) GetHotTopic() {
|
|||
|
||||
res := object.GetHotTopic(limit)
|
||||
c.ResponseOk(res)
|
||||
|
||||
}
|
||||
|
||||
// @Title GetSortedTopics
|
||||
|
|
|
@ -21,8 +21,10 @@ import (
|
|||
|
||||
var randomAvatarCount = 244
|
||||
|
||||
var randomAvatarMap map[string][]byte
|
||||
var randomAvatarMapMutex sync.RWMutex
|
||||
var (
|
||||
randomAvatarMap map[string][]byte
|
||||
randomAvatarMapMutex sync.RWMutex
|
||||
)
|
||||
|
||||
func initRandomAvatars() {
|
||||
randomAvatarMap = map[string][]byte{}
|
||||
|
|
|
@ -19,8 +19,10 @@ import (
|
|||
"github.com/casbin/casnode/object"
|
||||
)
|
||||
|
||||
var CasdoorOrganization = ""
|
||||
var CasdoorApplication = ""
|
||||
var (
|
||||
CasdoorOrganization = ""
|
||||
CasdoorApplication = ""
|
||||
)
|
||||
|
||||
func init() {
|
||||
object.InitConfig()
|
||||
|
|
|
@ -14,8 +14,10 @@
|
|||
|
||||
package discuzx
|
||||
|
||||
var dbName = "ultrax"
|
||||
var discuzxDomain = "https://www.discuz.net/"
|
||||
var discuzxAttachmentBaseUrl = "https://attachment.discuz.net/forum/"
|
||||
var (
|
||||
dbName = "ultrax"
|
||||
discuzxDomain = "https://www.discuz.net/"
|
||||
discuzxAttachmentBaseUrl = "https://attachment.discuz.net/forum/"
|
||||
)
|
||||
|
||||
var avatarPoolBaseUrl = "https://cdn.casbin.com/avatar-pool/"
|
||||
|
|
|
@ -23,8 +23,10 @@ import (
|
|||
"github.com/casbin/casnode/object"
|
||||
)
|
||||
|
||||
var AddThreadsConcurrency = 100
|
||||
var AddThreadsBatchSize = 10000
|
||||
var (
|
||||
AddThreadsConcurrency = 100
|
||||
AddThreadsBatchSize = 10000
|
||||
)
|
||||
|
||||
func addThreads(threads []*Thread, threadPostsMap map[int][]*Post, attachmentMap map[int][]*Attachment, forumMap map[int]*Forum, classMap map[int]*Class) {
|
||||
arrayMutex := sync.RWMutex{}
|
||||
|
|
|
@ -25,14 +25,16 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
var reBold *regexp.Regexp
|
||||
var reAlign *regexp.Regexp
|
||||
var reFont *regexp.Regexp
|
||||
var reUrl *regexp.Regexp
|
||||
var reSize *regexp.Regexp
|
||||
var reSize2 *regexp.Regexp
|
||||
var reSize3 *regexp.Regexp
|
||||
var reVideo *regexp.Regexp
|
||||
var (
|
||||
reBold *regexp.Regexp
|
||||
reAlign *regexp.Regexp
|
||||
reFont *regexp.Regexp
|
||||
reUrl *regexp.Regexp
|
||||
reSize *regexp.Regexp
|
||||
reSize2 *regexp.Regexp
|
||||
reSize3 *regexp.Regexp
|
||||
reVideo *regexp.Regexp
|
||||
)
|
||||
|
||||
func init() {
|
||||
reBold, _ = regexp.Compile("\\[b](.*?)\\[/b]")
|
||||
|
|
|
@ -23,9 +23,11 @@ import (
|
|||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
var adapter *Adapter
|
||||
var CasdoorOrganization string
|
||||
var CasdoorApplication string
|
||||
var (
|
||||
adapter *Adapter
|
||||
CasdoorOrganization string
|
||||
CasdoorApplication string
|
||||
)
|
||||
|
||||
type Session struct {
|
||||
SessionKey string `xorm:"char(64) notnull pk"`
|
||||
|
|
|
@ -30,8 +30,10 @@ type BasicInfo struct {
|
|||
Value string `xorm:"mediumtext"`
|
||||
}
|
||||
|
||||
var fileDate, version string
|
||||
var onlineMemberNum, highestOnlineNum int
|
||||
var (
|
||||
fileDate, version string
|
||||
onlineMemberNum, highestOnlineNum int
|
||||
)
|
||||
|
||||
func InitForumBasicInfo() {
|
||||
GetForumVersion()
|
||||
|
|
|
@ -21,8 +21,7 @@ type FrontConf struct {
|
|||
Tags []string `xorm:"varchar(200)" json:"tags"`
|
||||
}
|
||||
|
||||
var (
|
||||
Confs = []*FrontConf{
|
||||
var Confs = []*FrontConf{
|
||||
{Id: "forumName", Value: "Casnode", Field: "visualConf", Tags: nil},
|
||||
{Id: "logoImage", Value: "https://cdn.casbin.com/forum/static/img/logo.png", Field: "visualConf", Tags: nil},
|
||||
{Id: "footerLogoImage", Value: "https://cdn.casbin.com/forum/static/img/logo-footer.png", Field: "visualConf", Tags: nil},
|
||||
|
@ -36,7 +35,6 @@ var (
|
|||
{Id: "advertise", Value: "Not yet", Field: "", Tags: nil},
|
||||
{Id: "thanks", Value: "Not yet", Field: "", Tags: nil},
|
||||
}
|
||||
)
|
||||
|
||||
func InitFrontConf() {
|
||||
var confs []*FrontConf
|
||||
|
|
|
@ -326,7 +326,7 @@ func createTopicWithMessages(messages []gitter.Message, room gitter.Room, node N
|
|||
}
|
||||
}
|
||||
|
||||
var mentioned = false // if @user
|
||||
mentioned := false // if @user
|
||||
for _, mention := range msg.Mentions {
|
||||
if mention.ScreenName == lastMsg.From.Username {
|
||||
mentioned = true
|
||||
|
|
|
@ -228,7 +228,7 @@ func AddReplyNotification(senderId, content string, objectId, topicId int) {
|
|||
}
|
||||
|
||||
delete(memberMap, receiverId)
|
||||
for receiverId2, _ := range memberMap {
|
||||
for receiverId2 := range memberMap {
|
||||
wg.Add(1)
|
||||
go func(receiverId2 string) {
|
||||
defer wg.Done()
|
||||
|
@ -278,7 +278,7 @@ func AddTopicNotification(objectId int, author, content string) {
|
|||
}
|
||||
}
|
||||
|
||||
for k, _ := range memberMap {
|
||||
for k := range memberMap {
|
||||
wg.Add(1)
|
||||
k := k
|
||||
go func() {
|
||||
|
|
|
@ -16,8 +16,11 @@ import (
|
|||
|
||||
// var chromeCtx ctx.Context
|
||||
var chromeCtxPool *SsrPool
|
||||
var isChromeInstalled bool
|
||||
var isChromeInit bool
|
||||
|
||||
var (
|
||||
isChromeInstalled bool
|
||||
isChromeInit bool
|
||||
)
|
||||
|
||||
type PageCache struct {
|
||||
time time.Time
|
||||
|
|
|
@ -24,8 +24,7 @@ func init() {
|
|||
}
|
||||
|
||||
func initAPI() {
|
||||
ns :=
|
||||
beego.NewNamespace("/api",
|
||||
ns := beego.NewNamespace("/api",
|
||||
beego.NSInclude(
|
||||
&controllers.ApiController{},
|
||||
),
|
||||
|
|
|
@ -57,7 +57,7 @@ func Keyword(word []string) []string {
|
|||
for _, v := range word {
|
||||
wordnum[v] = wordnum[v] + 1
|
||||
}
|
||||
for s, _ := range wordnum {
|
||||
for s := range wordnum {
|
||||
words = append(words, s)
|
||||
}
|
||||
if len(wordnum) < 5 {
|
||||
|
|
|
@ -45,7 +45,7 @@ func ReadStringFromPath(path string) string {
|
|||
}
|
||||
|
||||
func WriteStringToPath(s string, path string) {
|
||||
err := ioutil.WriteFile(path, []byte(s), 0644)
|
||||
err := ioutil.WriteFile(path, []byte(s), 0o644)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue